Lectures

Math Camp

Lecture 3: Linear Algebra

Linear algebra studies linear systems: systems of equations in which every equation is linear. It is the foundation of optimization and also a powerful tool for analyzing nonlinear systems. In this lecture we introduce the basic vocabulary and operations of linear algebra, and we study the solution sets of linear systems. Throughout this lecture, vectors are columns.

1 Matrix algebra

1.1 Matrix vocabulary and basic arithmetic

Definition 1.1 (Matrices and transpose). An m×nm\times n matrix A=(aij)A=(a_{ij}) is a rectangular array with mm rows and nn columns, with aija_{ij} in row ii and column jj. Two matrices are equal when they have the same dimensions and all corresponding entries are equal. The transpose of AA is the n×mn\times m matrix AA^{\top} defined by (A)ij=aji.(A^{\top})_{ij}=a_{ji}. A matrix is square if it has the same number of rows and columns, diagonal if every off-diagonal entry is zero, and symmetric if A=AA=A^{\top}.

Matrices of the same dimensions are added entrywise, and scalar multiplication is entrywise: (A+B)ij=aij+bij,(αA)ij=αaij.(A+B)_{ij}=a_{ij}+b_{ij}, \qquad (\alpha A)_{ij}=\alpha a_{ij}. The m×nm\times n zero matrix has every entry zero. The n×nn\times n identity matrix InI_n has ones on the diagonal and zeros elsewhere. The diagonal matrix with diagonal entries d1,,dnd_1,\ldots,d_n is written diag(d1,,dn)\operatorname{diag}(d_1,\ldots,d_n).

Example 1.2 (Matrix arithmetic). Let A=(120103),B=(011210).A=\begin{pmatrix}1&2&0\\-1&0&3\end{pmatrix}, \qquad B=\begin{pmatrix}0&1&1\\2&-1&0\end{pmatrix}. Then A+B=(131113),2A=(240206),A=(112003).A+B=\begin{pmatrix}1&3&1\\1&-1&3\end{pmatrix}, \qquad 2A=\begin{pmatrix}2&4&0\\-2&0&6\end{pmatrix}, \qquad A^{\top}=\begin{pmatrix}1&-1\\2&0\\0&3\end{pmatrix}.

Addition requires matching dimensions. Multiplication uses a different compatibility rule.

1.2 Matrix multiplication

Definition 1.3 (Matrix multiplication). If AA is m×nm\times n and BB is n×pn\times p, then their product ABAB is the m×pm\times p matrix with (AB)ij=k=1naikbkj.(AB)_{ij}=\sum_{k=1}^{n}a_{ik}b_{kj}. The product is defined only when the inner dimensions agree. In that case the matrices are conformable: (m×n)(n×p)=(m×p).(m\times n)(n\times p)=(m\times p).

Each entry of ABAB is a row of AA multiplied against a column of BB.

Example 1.4 (Matrix multiplication). Let C=(120011),D=(100111).C=\begin{pmatrix}1&2&0\\0&1&1\end{pmatrix}, \qquad D=\begin{pmatrix}1&0\\0&1\\1&1\end{pmatrix}. Then CC is 2×32\times3 and DD is 3×23\times2, so CD=(1212)CD =\begin{pmatrix}1&2\\1&2\end{pmatrix} is 2×22\times2. The reverse product is also defined in this example, but it is different in both size and entries: DC=(120011131).DC =\begin{pmatrix} 1&2&0\\ 0&1&1\\ 1&3&1 \end{pmatrix}. Since CDDCCD\neq DC, this example also shows that matrix multiplication is not generally commutative.

Whenever the products are conformable, (AB)C=A(BC),A(B+C)=AB+AC,(AB)=BA,(AB)C=A(BC), \qquad A(B+C)=AB+AC, \qquad (AB)^{\top}=B^{\top}A^{\top}, and the identity matrices satisfy AIn=AAI_n=A and ImA=AI_mA=A for an m×nm\times n matrix AA.

Vectors can be treated as matrices with one column. For x,ynx,y\in\mathbb{R}^{n}, xyx^{\top}y is a 1×11\times1 matrix whose entry is the inner product xyx\cdot y, whereas xyxy^{\top} is an n×nn\times n matrix.

1.3 Linear combinations, span, and independence

Definition 1.5 (Linear combination). Let v1,,vknv_1,\ldots,v_k\in\mathbb{R}^{n} be a collection of vectors. A linear combination of v1,,vkv_1,\ldots,v_k is a vector i=1kαivi\sum_{i=1}^{k}\alpha_iv_i with αi\alpha_i\in\mathbb{R}.

Below is a collection of vectors we will use to illustrate concepts in this lecture.

Example 1.6 (A linear combination). Let v1=(12)v_1=\begin{pmatrix}1\\2\end{pmatrix}, v2=(22)v_2=\begin{pmatrix}2\\2\end{pmatrix}, and v3=(34)v_3=\begin{pmatrix}3\\4\end{pmatrix}. Here v3=v1+v2v_3=v_1+v_2, so v3v_3 is a linear combination of v1v_1 and v2v_2, with α1=α2=1\alpha_1=\alpha_2=1.

Definition 1.7 (Subspace and span). Let VnV\subseteq\mathbb{R}^{n} and let v1,,vknv_1,\ldots,v_k\in\mathbb{R}^{n}.

  • The set VV is a subspace of n\mathbb{R}^{n} if it is nonempty and x,yV,α,βαx+βyV.x,y\in V, \quad \alpha,\beta\in\mathbb{R} \quad\Longrightarrow\quad \alpha x+\beta y\in V.

  • Their span is the set of all such combinations: span{v1,,vk}={i=1kαivi:α1,,αk}.\operatorname{span}\{v_1,\ldots,v_k\} =\left\{\sum_{i=1}^{k}\alpha_iv_i: \alpha_1,\ldots,\alpha_k\in\mathbb{R}\right\}.

Every span is a subspace. Indeed, adding two linear combinations of v1,,vkv_1,\ldots,v_k, or multiplying one by a scalar, produces another linear combination of the same vectors.

The span of one nonzero vector vv is the line {αv:α}\{\alpha v:\alpha\in\mathbb{R}\} through the origin. A line that does not go through the origin cannot be a subspace, because every subspace contains the zero vector.

Definition 1.8 (Independence, basis, and dimension). Let VnV\subseteq\mathbb{R}^{n} be a subspace.

  • The collection v1,,vkv_1,\ldots,v_k of vectors is linearly independent if α1v1++αkvk=0α1==αk=0\alpha_1v_1+\cdots+\alpha_kv_k=0 \quad\Longrightarrow\quad \alpha_1=\cdots=\alpha_k=0 for all α1,,αk\alpha_1,\ldots,\alpha_k\in\mathbb{R}. Otherwise it is linearly dependent.

  • A basis of VV is a linearly independent collection of vectors that spans VV.

  • The dimension dimV\dim V of VV is the number of vectors in a basis of VV.

In 3\mathbb{R}^3 we can illustrate all four possible dimensions of subspaces — 00, 11, 22, and 33. That is, every subspace of 3\mathbb{R}^3 is one of the following: the origin; a line through the origin; a plane through the origin; or all of 3\mathbb{R}^3. Figure 1.1 shows one subspace of each dimension. This is the picture to keep in mind for any subspace of n\mathbb{R}^{n}: a subspace is flat, passes through the origin, and has dimension at most nn. Unless it is {0}\{0\}, it extends without bound in every direction that it contains.

Figure 1.1. The four kinds of subspaces of \mathbb{R}^3, one for each dimension: the origin alone, a line through the origin, a plane through the origin, and the whole space. Every subspace of \mathbb{R}^3 is one of these. Each is flat and contains the origin. The line and plane panels show representative viewing windows: those subspaces continue without bound. There is one dimension-0 subspace and one dimension-3 subspace, but infinitely many dimension-1 and dimension-2 subspaces.

One could think of linear dependence as redundancy: if vectors are dependent, then at least one of them can be expressed as a linear combination of the others.

Example 1.9. Let v1=(12),v2=(22),v3=(34).v_1=\begin{pmatrix}1\\2\end{pmatrix}, \qquad v_2=\begin{pmatrix}2\\2\end{pmatrix}, \qquad v_3=\begin{pmatrix}3\\4\end{pmatrix}. Because v3=v1+v2v_3=v_1+v_2, the three-vector collection is dependent and v3v_3 may be deleted without changing its span. The remaining vectors v1v_1 and v2v_2 are independent: if α1v1+α2v2=0\alpha_1v_1+\alpha_2v_2=0, then α1+2α2=0,2α1+2α2=0,\alpha_1+2\alpha_2=0, \qquad 2\alpha_1+2\alpha_2=0, which forces α1=α2=0\alpha_1=\alpha_2=0. Thus v1,v2v_1,v_2 form a basis of 2\mathbb{R}^2, and the three vectors span 2\mathbb{R}^2. Figure 1.2 illustrates these relationships.

Figure 1.2. The vectors v_1,v_2,v_3 in \mathbb{R}^2. The solid arrows all begin at the origin. The dashed translated copies complete the shaded parallelogram and show v_3=v_1+v_2. Thus v_3 contributes no new direction: v_1,v_2 are independent and already span \mathbb{R}^2, while the three-vector collection is dependent. The span is the entire plane, not only the shaded parallelogram.

We use the standard finite-dimensional facts that every subspace of n\mathbb{R}^{n} has a basis, any two bases of the same subspace have the same number of vectors, and every independent collection in n\mathbb{R}^{n} has at most nn vectors. The standard basis of n\mathbb{R}^{n} is the collection e1,,ene_1,\ldots,e_n, where eie_i is the vector with 11 in coordinate ii and 00 in every other coordinate.

2 Linear maps and linear systems

So far we have treated matrices as arrays of numbers. We now show that matrices represent linear functions from n\mathbb{R}^{n} to m\mathbb{R}^m, and we use this perspective to study the solution sets of systems of linear equations. The same product AxAx also has two useful interpretations. We begin by naming the rows and columns of AA, and then develop each interpretation.

2.1 Two readings of a matrix-vector product

Let A=(a11a12a1na21a22a2nam1am2amn).A= \begin{pmatrix} a_{11} & a_{12} & \cdots & a_{1n}\\ a_{21} & a_{22} & \cdots & a_{2n}\\ \vdots & \vdots & \ddots & \vdots\\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{pmatrix}.

Write the rows of AA as r1,r2,,rmr_1,r_2,\ldots,r_m and its columns as c1,c2,,cnc_1,c_2,\ldots,c_n. Thus A=(r1r2rm)=(c1c2cn).A= \begin{pmatrix}r_1\\r_2\\\vdots\\r_m\end{pmatrix} =\begin{pmatrix}c_1&c_2&\cdots&c_n\end{pmatrix}.

Suppose xnx\in\mathbb{R}^{n}. We call xx the input and AxmAx\in\mathbb{R}^m the output. The product can be represented as

Ax=(a11a1nam1amn)(x1xn)=(a11x1++a1nxnam1x1++amnxn)=x1c1++xncn.Ax = \begin{pmatrix} a_{11} \ldots a_{1n} \\ \vdots\\ a_{m1} \ldots a_{mn} \end{pmatrix} \begin{pmatrix} x_{1} \\ \vdots\\ x_{n} \end{pmatrix} = \begin{pmatrix} a_{11}x_1+\cdots+a_{1n}x_n\\ \vdots\\ a_{m1}x_1+\cdots+a_{mn}x_n \end{pmatrix} = x_1c_1+\cdots+x_nc_n.(1)

The product AxAx is thus a linear combination of the columns of AA, with entries of xx as weights. For the row interpretation of matrix AA, we need to consider an equation Ax=bAx=b.

Definition 2.1 (Linear system). For an m×nm\times n matrix AA and bmb\in\mathbb{R}^m, the equation Ax=b,xn,Ax=b, \qquad x\in\mathbb{R}^{n}, is a linear system with coefficient matrix AA and right-hand side bb. It is consistent if it has a solution and inconsistent otherwise.

The row interpretation writes the system as one scalar equation for each row of AA:

Ax=brix=ai1x1++ainxn=bi,for each row i.Ax=b \quad\Longleftrightarrow\quad r_i x=a_{i1}x_1+\cdots+a_{in}x_n=b_i, \qquad \text{for each row }i.(2)

Each row is thus a restriction on what the input xx could be to reach output bb using matrix AA. At the same time, the column representation essentially asks which linear combination of the columns of AA produces the target bb.

Make sure you understand the representations in (1) and (2), as they will be crucial for understanding just about everything that comes next. Here is the running example.

Example 2.2. Let A=(123224),x=(x1x2x3).A=\begin{pmatrix}1&2&3\\2&2&4\end{pmatrix}, \qquad x=\begin{pmatrix}x_1\\x_2\\x_3\end{pmatrix}. The rows and columns of AA are r1=(123),r2=(224),r_1=\begin{pmatrix}1&2&3\end{pmatrix}, \qquad r_2=\begin{pmatrix}2&2&4\end{pmatrix}, and c1=(12),c2=(22),c3=(34).c_1=\begin{pmatrix}1\\2\end{pmatrix}, \qquad c_2=\begin{pmatrix}2\\2\end{pmatrix}, \qquad c_3=\begin{pmatrix}3\\4\end{pmatrix}. The column interpretation gives Ax=x1c1+x2c2+x3c3=x1(12)+x2(22)+x3(34).Ax =x_1c_1+x_2c_2+x_3c_3 =x_1\begin{pmatrix}1\\2\end{pmatrix} +x_2\begin{pmatrix}2\\2\end{pmatrix} +x_3\begin{pmatrix}3\\4\end{pmatrix}. For b=(34),b=\begin{pmatrix}3\\4\end{pmatrix}, the row interpretation writes Ax=bAx=b as x1+2x2+3x3=3,2x1+2x2+4x3=4.x_1+2x_2+3x_3=3, \qquad 2x_1+2x_2+4x_3=4.

The theorem below shows that a function from n\mathbb{R}^{n} to m\mathbb{R}^m is linear if and only if it can be represented as an m×nm\times n matrix. We use the word map or transformation instead of the word function to emphasize that the domain and codomain are vector spaces, and that the function preserves the vector space structure.

Definition 2.3 (Linear map). A function T:nmT:\mathbb{R}^{n}\to\mathbb{R}^m is a linear map, or a linear transformation, if T(x+y)=T(x)+T(y),T(αx)=αT(x)T(x+y)=T(x)+T(y), \qquad T(\alpha x)=\alpha T(x) for all x,ynx,y\in\mathbb{R}^{n} and α\alpha\in\mathbb{R}.

Here xx is the input and T(x)T(x) is the output.

Theorem 2.4 (Matrices represent linear maps). A function T:nmT:\mathbb{R}^{n}\to\mathbb{R}^m is linear if and only if there is an m×nm\times n matrix AA such that T(x)=AxT(x)=Ax for every xnx\in\mathbb{R}^{n}. In that case AA is unique, and its jjth column is T(ej)T(e_j). If S:mpS:\mathbb{R}^m\to\mathbb{R}^p is linear with matrix BB, then the composition STS\circ T is linear with matrix BABA.

Proof (optional). Linear implies matrix. Let TT be linear. Every xnx\in\mathbb{R}^{n} is the linear combination x=x1e1++xnenx=x_1e_1+\cdots+x_ne_n of the standard basis, so linearity applied to each term gives T(x)=T(j=1nxjej)=j=1nxjT(ej).T(x)=T\left(\sum_{j=1}^{n}x_je_j\right) =\sum_{j=1}^{n}x_jT(e_j). Let A=[T(e1)T(en)]A=[\,T(e_1)\ \cdots\ T(e_n)\,], which is m×nm\times n because each T(ej)T(e_j) lies in m\mathbb{R}^m. Since AxAx is the combination of the columns of AA with weights x1,,xnx_1,\ldots,x_n, the display says exactly that T(x)=AxT(x)=Ax.

Matrix implies linear. If T(x)=AxT(x)=Ax for an m×nm\times n matrix AA, then A(x+y)=Ax+AyA(x+y)=Ax+Ay and A(αx)=α(Ax)A(\alpha x)=\alpha(Ax), so TT is linear.

Uniqueness. Suppose Ax=BxAx=Bx for every xnx\in\mathbb{R}^{n}. Taking x=ejx=e_j makes AejAe_j and BejBe_j the jjth columns of AA and BB, so the two matrices agree column by column and A=BA=B. The same substitution in T(x)=AxT(x)=Ax identifies the jjth column of AA as T(ej)T(e_j).

Composition. Let SS be linear with matrix BB. For every xnx\in\mathbb{R}^{n}, associativity of the matrix product gives (ST)(x)=S(T(x))=B(Ax)=(BA)x,(S\circ T)(x)=S(T(x))=B(Ax)=(BA)x, so STS\circ T is represented by the p×np\times n matrix BABA, and it is linear by the second part. ◻

2.2 Row space, column space, and rank

Definition 2.5 (Row and column spaces).

Let AA be an m×nm\times n matrix. Its row space and column space are Row(A)=span{r1,,rm}n,Col(A)=span{c1,,cn}m.\operatorname{Row}(A)=\operatorname{span}\{r_1,\ldots,r_m\}\subseteq\mathbb{R}^{n}, \qquad \operatorname{Col}(A)=\operatorname{span}\{c_1,\ldots,c_n\}\subseteq\mathbb{R}^m. By (1), Col(A)={Ax:xn},\operatorname{Col}(A)=\{Ax:x\in\mathbb{R}^{n}\}, so the column space is the range of the linear map xAxx\mapsto Ax.

The row and column spaces live in different ambient spaces, but they have the same dimension. We use this fundamental result without proof.

Theorem 2.6 (Equality of row and column rank). For every matrix AA, dimRow(A)=dimCol(A).\dim\operatorname{Row}(A)=\dim\operatorname{Col}(A).

Definition 2.7 (Rank). The rank of AA is their common dimension: rankA=dimRow(A)=dimCol(A).\operatorname{rank}A=\dim\operatorname{Row}(A)=\dim\operatorname{Col}(A).

The row reading interprets rank as the number of independent restrictions. The column reading interprets it as the dimension of the set of outputs that AA can produce.

Example 2.8 (Rank of a matrix). Let A=(123224).A=\begin{pmatrix}1&2&3\\2&2&4\end{pmatrix}. The first two columns of AA form a basis of 2\mathbb{R}^2. Thus Col(A)=2,rankA=2.\operatorname{Col}(A)=\mathbb{R}^2, \qquad \operatorname{rank}A=2. The two rows are consequently independent: the system contains two independent restrictions on three variables.

2.3 Null space and changes that preserve the restrictions

Suppose the input xx produces the output bb, so Ax=bAx=b. Let hnh\in\mathbb{R}^{n} be a proposed change to the input. After the change, the new input is x+hx+h. It produces the same output exactly when A(x+h)=bAh=0.A(x+h)=b \quad\Longleftrightarrow\quad Ah=0. Thus hh leaves AxAx unchanged if and only if Ah=0Ah=0. The collection of all such changes is the null space.

Definition 2.9 (Null space). For an m×nm\times n matrix AA, its null space, or kernel, is N(A)={hn:Ah=0}.N(A)=\{h\in\mathbb{R}^{n}:Ah=0\}. The dimension of N(A)N(A) is called the nullity of AA.

Every null space is a subspace. Indeed, if u,vN(A)u,v\in N(A) and α,β\alpha,\beta\in\mathbb{R}, then A(αu+βv)=αAu+βAv=0.A(\alpha u+\beta v)=\alpha Au+\beta Av=0. We have now seen two ways to specify a subspace: a span specifies one using generating vectors, whereas a null space specifies one using equations of the form Ax=0Ax=0.

Its elements have two interpretations. In the row interpretation, Ah=0ai1h1++ainhn=0for every row i,Ah=0 \quad\Longleftrightarrow\quad a_{i1}h_1+\cdots+a_{in}h_n=0 \quad\text{for every row }i, so adding hh to xx changes the left-hand side of every constraint by zero. In the column reading, Ah=0h1c1++hncn=0.Ah=0 \quad\Longleftrightarrow\quad h_1c_1+\cdots+h_nc_n=0. Here hjh_j is the change in the weight on column cjc_j. Thus Ah=0Ah=0 means that these changes cancel, leaving the output unchanged. A nonzero such hh exists exactly when the columns are linearly dependent.

Rank and nullity measure two different things. The rank is the dimension of the set of outputs that AA can produce. The nullity is the dimension of the set of changes that leave AxAx unchanged. The rank–nullity theorem relates these two counts. We use it without proof.

Theorem 2.10 (Rank–nullity theorem). If AA is an m×nm\times n matrix, then rankA+dimN(A)=n.\operatorname{rank}A+\dim N(A)=n.

Example 2.11 (Null space of a matrix). Let A=(123224).A=\begin{pmatrix}1&2&3\\2&2&4\end{pmatrix}. Here n=3n=3 and rankA=2\operatorname{rank}A=2, so dimN(A)=1\dim N(A)=1. To identify the null space, solve Ah=0Ah=0: h1+2h2+3h3=0,2h1+2h2+4h3=0.h_1+2h_2+3h_3=0, \qquad 2h_1+2h_2+4h_3=0. Subtracting twice the first equation from the second gives h2=h3h_2=-h_3. Substitution into the first gives h1=h3h_1=-h_3. Letting t=h3t=-h_3, N(A)={(ttt):t}=span{(111)}.N(A) =\left\{\begin{pmatrix}t\\t\\-t\end{pmatrix}:t\in\mathbb{R}\right\} =\operatorname{span}\left\{\begin{pmatrix}1\\1\\-1\end{pmatrix}\right\}. This illustrates rank–nullity: rankA+dimN(A)=2+1=3=n.\operatorname{rank}A+\dim N(A)=2+1=3=n. Here the nullity 11 means that one scalar, tt, can be chosen freely when describing changes that preserve all restrictions. More generally, if rankA=r\operatorname{rank}A=r, then nrn-r coefficients can be chosen freely; these are the nrn-r degrees of freedom.

2.4 The solution set

The column interpretation answers the existence question immediately:

Ax=b is consistentbCol(A).Ax=b\text{ is consistent} \quad\Longleftrightarrow\quad b\in\operatorname{Col}(A).(3)

The following theorem describes the solution set of a consistent linear system Ax=bAx=b in terms of a particular solution and the null space (which is the solution set for Ax=0Ax=0).

Theorem 2.12 (Solution set). If x0x_0 is one solution of Ax=bAx=b, then the full solution set is {xn:Ax=b}=x0+N(A),where x0+N(A)={x0+h:hN(A)}.\{x\in\mathbb{R}^{n}:Ax=b\}=x_0+N(A), \qquad \text{where }x_0+N(A)=\{x_0+h:h\in N(A)\}. Consequently, a consistent system has a unique solution if and only if N(A)={0}N(A)=\{0\}.

Proof. If Ax=b=Ax0Ax=b=Ax_0, then A(xx0)=0A(x-x_0)=0, so xx0N(A)x-x_0\in N(A). Conversely, if hN(A)h\in N(A), then A(x0+h)=Ax0+Ah=bA(x_0+h)=Ax_0+Ah=b. ◻

Together with the column-space criterion, the theorem gives the complete description {xn:Ax=b}={,bCol(A),x0+N(A),bCol(A).\{x\in\mathbb{R}^{n}:Ax=b\} = \begin{cases} \varnothing, & b\notin\operatorname{Col}(A),\\ x_0+N(A), & b\in\operatorname{Col}(A). \end{cases}

Example 2.13 (Solution set of a linear system). Let A=(123224),b=(34).A=\begin{pmatrix}1&2&3\\2&2&4\end{pmatrix}, \qquad b=\begin{pmatrix}3\\4\end{pmatrix}. The null space is N(A)=span{(111)},N(A)=\operatorname{span}\left\{\begin{pmatrix}1\\1\\-1\end{pmatrix}\right\}, and one particular solution is x0=(001)x_0=\begin{pmatrix}0\\0\\1\end{pmatrix}. Therefore {x:Ax=b}=(001)+span{(111)}.\{x:Ax=b\} =\begin{pmatrix}0\\0\\1\end{pmatrix} +\operatorname{span}\left\{\begin{pmatrix}1\\1\\-1\end{pmatrix}\right\}. Adding the displayed null vector gives another solution: (001)+(111)=(110),\begin{pmatrix}0\\0\\1\end{pmatrix} +\begin{pmatrix}1\\1\\-1\end{pmatrix} =\begin{pmatrix}1\\1\\0\end{pmatrix}, reflecting that the third column of AA is the sum of its first two columns.

2.5 Rank, existence, and uniqueness

The preceding results give the two full-rank criteria.

Theorem 2.14 (Full row and column rank). Let AA be m×nm\times n.

  1. rankA=m\operatorname{rank}A=m if and only if Ax=bAx=b has at least one solution for every bmb\in\mathbb{R}^m.

  2. rankA=n\operatorname{rank}A=n if and only if Ax=bAx=b has at most one solution for every bmb\in\mathbb{R}^m.

The first clause follows because rankA=m\operatorname{rank}A=m exactly when Col(A)=m\operatorname{Col}(A)=\mathbb{R}^m, which means every bmb\in\mathbb{R}^m belongs to the column space. For the second clause, rank–nullity gives rankA=nN(A)={0}.\operatorname{rank}A=n \quad\Longleftrightarrow\quad N(A)=\{0\}. The solution-set theorem then says that a consistent system has exactly one solution.

Together, rank and the column-space criterion classify every system:

Rank condition Solutions
rankA=m=n\operatorname{rank}A=m=n every bb has exactly one
rankA=m<n\operatorname{rank}A=m<n every bb has infinitely many
rankA=n<m\operatorname{rank}A=n<m none or exactly one, depending on bb
rankA<min{m,n}\operatorname{rank}A<\min\{m,n\} none or infinitely many, depending on bb

3 Square matrices and invertibility

Definition 3.1 (Inverse). An n×nn\times n matrix AA is invertible, or nonsingular, if there is an n×nn\times n matrix A1A^{-1} satisfying A1A=AA1=In.A^{-1}A=AA^{-1}=I_n. If no inverse exists, AA is singular.

An inverse is unique: if BB and CC are both inverses of AA, then B=B(AC)=(BA)C=CB=B(AC)=(BA)C=C.

Theorem 3.2 (Invertible-matrix equivalences).

For an n×nn\times n matrix AA, the following are equivalent:

  1. AA is invertible;

  2. rankA=n\operatorname{rank}A=n;

  3. the columns of AA are linearly independent;

  4. N(A)={0}N(A)=\{0\};

  5. for every bnb\in\mathbb{R}^{n}, the system Ax=bAx=b has exactly one solution.

When these conditions hold, the solution is x=A1bx=A^{-1}b.

The equivalence of clauses (2)–(5) follows from full row and column rank and the affine solution-set theorem. If AA is invertible, multiplying Ax=bAx=b by A1A^{-1} gives the unique solution x=A1bx=A^{-1}b. Conversely, if every Ax=ejAx=e_j has a unique solution xjx^j, put those solutions into the columns of B=[x1xn]B=[\,x^1\ \cdots\ x^n\,]. Then AB=InAB=I_n, and the triviality of N(A)N(A) forces BA=InBA=I_n, so B=A1B=A^{-1}.

The determinant is a function that turns a square matrix into a scalar.

Definition 3.3 (Determinant). For a 1×11\times1 matrix, det(a)=a\det(a)=a. For n2n\geq2, let A1jA_{1j} denote the (n1)×(n1)(n-1)\times(n-1) matrix obtained from AA by deleting row 11 and column jj. The determinant of AA is detA=j=1n(1)1+ja1jdetA1j.\det A=\sum_{j=1}^{n}(-1)^{1+j}a_{1j}\det A_{1j}.

This is called cofactor expansion along the first row: each entry of the first row is multiplied by the determinant of the matrix left after deleting that entry’s row and column, and the signs alternate. Expanding along any other row or column gives the same number.

Example 3.4 (2×22\times2 determinant). Let A=(abcd)A=\begin{pmatrix}a&b\\c&d\end{pmatrix}. Here A11=(d)A_{11}=(d) and A12=(c)A_{12}=(c), so detA=adbc.\det A=ad-bc.

Example 3.5 (3×33\times3 determinant). Let A=(abcdefghi)A=\begin{pmatrix}a&b&c\\d&e&f\\g&h&i\end{pmatrix}. Each of the three terms now needs a 2×22\times2 determinant: detA=a(eifh)b(difg)+c(dheg).\det A=a(ei-fh)-b(di-fg)+c(dh-eg).

The determinant supplies a scalar test for the equivalent conditions above.

Theorem 3.6 (Determinant criterion). A square matrix AA is invertible if and only if detA0\det A\neq0.

Example 3.7 (The inverse in the 2×22\times2 case). Let A=(abcd),detA=adbc.A=\begin{pmatrix}a&b\\c&d\end{pmatrix}, \qquad \det A=ad-bc. If detA0\det A\neq0, multiplying in either order gives (abcd)(dbca)=(adbc)I2.\begin{pmatrix}a&b\\c&d\end{pmatrix} \begin{pmatrix}d&-b\\-c&a\end{pmatrix} =(ad-bc)I_2. As long as the determinant adbc0ad-bc\neq0, we can divide by it to get the inverse: A1=1adbc(dbca).A^{-1} =\frac{1}{ad-bc} \begin{pmatrix}d&-b\\-c&a\end{pmatrix}.

4 Eigenvalues and eigenvectors

Definition 4.1 (Eigenvalues and eigenvectors). Let AA be a real n×nn\times n matrix. A scalar λ\lambda\in\mathbb{R} is an eigenvalue of AA if there is a nonzero vector vnv\in\mathbb{R}^{n} such that Av=λv.Av=\lambda v. Such a vector vv is an eigenvector associated with λ\lambda.

The eigenvalue equation can be rewritten as

Av=λv(AλI)v=0.Av=\lambda v \quad\Longleftrightarrow\quad (A-\lambda I)v=0.(4)

As such, we immediately have the following equivalences, which are useful for computing eigenvalues and eigenvectors.

Theorem 4.2 (Eigenvalue equivalences).

For a real n×nn\times n matrix AA and λ\lambda\in\mathbb{R}, the following are equivalent:

  1. λ\lambda is an eigenvalue of AA;

  2. N(AλI){0}N(A-\lambda I)\neq\{0\};

  3. AλIA-\lambda I is singular;

  4. det(AλI)=0\det(A-\lambda I)=0.

Proof (optional). (1) \Leftrightarrow (2). By Definition 4.1, λ\lambda is an eigenvalue exactly when Av=λvAv=\lambda v for some v0v\neq0. By (4) such a vv satisfies (AλI)v=0(A-\lambda I)v=0, and conversely. So an eigenvalue exists precisely when AλIA-\lambda I has a nonzero null vector, which is the statement N(AλI){0}N(A-\lambda I)\neq\{0\}.

(2) \Leftrightarrow (3). Apply Theorem 3.2 to the square matrix AλIA-\lambda I: it is invertible if and only if its null space is trivial. Negating both sides, AλIA-\lambda I is singular if and only if N(AλI){0}N(A-\lambda I)\neq\{0\}.

(3) \Leftrightarrow (4). Apply Theorem 3.6 to AλIA-\lambda I: it is invertible if and only if det(AλI)0\det(A-\lambda I)\neq0. Negating both sides gives the claim. ◻

If one of the eigenvalues of a matrix is zero, then the matrix is singular; that can be seen by taking λ=0\lambda=0 in Theorem 4.2.

Corollary 4.3 (Zero eigenvalue). A square matrix AA is singular if and only if 00 is an eigenvalue of AA. Equivalently, AA is invertible if and only if all of its eigenvalues are nonzero.

The equation det(AλI)=0\det(A-\lambda I)=0 is the characteristic equation. Its left-hand side is the characteristic polynomial. The roots of the characteristic polynomial are the eigenvalues of AA. For each eigenvalue λ\lambda, the associated eigenvectors are the nonzero elements of N(AλI)N(A-\lambda I).

Example 4.4 (Eigenvalues and eigenvectors of a 2×22\times2 matrix).

Let A=(1243).A=\begin{pmatrix}1&2\\4&3\end{pmatrix}. Subtracting λ\lambda from each diagonal entry and taking the determinant gives the characteristic polynomial det(AλI)=det(1λ243λ)=(1λ)(3λ)8=λ24λ5=(λ5)(λ+1).\det(A-\lambda I) =\det\begin{pmatrix}1-\lambda&2\\4&3-\lambda\end{pmatrix} =(1-\lambda)(3-\lambda)-8 =\lambda^{2}-4\lambda-5 =(\lambda-5)(\lambda+1). Its roots are the eigenvalues λ1=5\lambda_1=5 and λ2=1\lambda_2=-1.

To find the eigenvectors belonging to λ1=5\lambda_1=5, solve (A5I)v=0(A-5I)v=0: A5I=(4242),A-5I=\begin{pmatrix}-4&2\\4&-2\end{pmatrix}, so both equations reduce to v2=2v1v_2=2v_1, and N(A5I)=span{(1,2)}N(A-5I)=\operatorname{span}\{(1,2)^{\top}\}. For λ2=1\lambda_2=-1, solve (A+I)v=0(A+I)v=0: A+I=(2244),A+I=\begin{pmatrix}2&2\\4&4\end{pmatrix}, so both equations reduce to v2=v1v_2=-v_1, and N(A+I)=span{(1,1)}N(A+I)=\operatorname{span}\{(1,-1)^{\top}\}.

Note that in each case the null space is a line rather than a single vector — any nonzero multiple of an eigenvector is again an eigenvector for the same eigenvalue.

Remark 4.5 (How many eigenvalues). The characteristic polynomial of an n×nn\times n matrix has degree nn, so AA has at most nn distinct real eigenvalues. It can have fewer for two separate reasons: a root may repeat, or a root may fail to be real.

Example 4.6 (A repeated eigenvalue). Let A=diag(2,2)A=\operatorname{diag}(2,2). Its characteristic polynomial is (2λ)2(2-\lambda)^{2}, which has the single root 22. Thus AA has one distinct eigenvalue rather than two.

Example 4.7 (No real eigenvalues). Let A=(0110),det(AλI)=λ2+1.A=\begin{pmatrix}0&-1\\1&0\end{pmatrix}, \qquad \det(A-\lambda I)=\lambda^{2}+1. Since Definition 4.1 requires λ\lambda\in\mathbb{R}, this matrix has no eigenvalues and no nonzero eigenvectors in 2\mathbb{R}^2. It does have complex eigenvalues and eigenvectors, but we do not consider those here.

Below we list some useful results featuring eigenvalues without proving them.

Definition 4.8 (Trace). The trace of an n×nn\times n matrix AA is the sum of its diagonal entries, trA=i=1naii.\operatorname{tr}A=\sum_{i=1}^{n}a_{ii}.

Theorem 4.9 (Trace and determinant). Let AA be an n×nn\times n matrix whose characteristic polynomial factors into real linear terms, det(AλI)=(λ1λ)(λ2λ)(λnλ),λ1,,λn.\det(A-\lambda I)=(\lambda_1-\lambda)(\lambda_2-\lambda)\cdots (\lambda_n-\lambda), \qquad \lambda_1,\ldots,\lambda_n\in\mathbb{R}. Then i=1nλi=trA,i=1nλi=detA.\sum_{i=1}^{n}\lambda_i=\operatorname{tr}A, \qquad \prod_{i=1}^{n}\lambda_i=\det A.

Definition 4.10 (Diagonalizable matrix). An n×nn\times n matrix AA is diagonalizable if there are an invertible n×nn\times n matrix PP and a diagonal matrix DD with A=PDP1.A=PDP^{-1}.

Theorem 4.11 (Diagonalization). An n×nn\times n matrix AA is diagonalizable if and only if it has nn linearly independent eigenvectors v1,,vnv^1,\ldots,v^n. In that case one may take P=[v1vn],D=diag(λ1,,λn),P=[\,v^1\ \cdots\ v^n\,], \qquad D=\operatorname{diag}(\lambda_1,\ldots,\lambda_n), where λi\lambda_i is the eigenvalue belonging to viv^i. In particular, AA is diagonalizable whenever it has nn distinct real eigenvalues.

This result is particularly useful for real symmetric matrices, which always have nn linearly independent eigenvectors and are therefore diagonalizable.