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 matrix is a rectangular array with rows and columns, with in row and column . Two matrices are equal when they have the same dimensions and all corresponding entries are equal. The transpose of is the matrix defined by 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 .
Matrices of the same dimensions are added entrywise, and scalar multiplication is entrywise: The zero matrix has every entry zero. The identity matrix has ones on the diagonal and zeros elsewhere. The diagonal matrix with diagonal entries is written .
Example 1.2 (Matrix arithmetic). Let Then
Addition requires matching dimensions. Multiplication uses a different compatibility rule.
1.2 Matrix multiplication
Definition 1.3 (Matrix multiplication). If is and is , then their product is the matrix with The product is defined only when the inner dimensions agree. In that case the matrices are conformable:
Each entry of is a row of multiplied against a column of .
Example 1.4 (Matrix multiplication). Let Then is and is , so is . The reverse product is also defined in this example, but it is different in both size and entries: Since , this example also shows that matrix multiplication is not generally commutative.
Whenever the products are conformable, and the identity matrices satisfy and for an matrix .
Vectors can be treated as matrices with one column. For , is a matrix whose entry is the inner product , whereas is an matrix.
1.3 Linear combinations, span, and independence
Definition 1.5 (Linear combination). Let be a collection of vectors. A linear combination of is a vector with .
Below is a collection of vectors we will use to illustrate concepts in this lecture.
Example 1.6 (A linear combination). Let , , and . Here , so is a linear combination of and , with .
Definition 1.7 (Subspace and span). Let and let .
The set is a subspace of if it is nonempty and
Their span is the set of all such combinations:
Every span is a subspace. Indeed, adding two linear combinations of , or multiplying one by a scalar, produces another linear combination of the same vectors.
The span of one nonzero vector is the line 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 be a subspace.
The collection of vectors is linearly independent if for all . Otherwise it is linearly dependent.
A basis of is a linearly independent collection of vectors that spans .
The dimension of is the number of vectors in a basis of .
In we can illustrate all four possible dimensions of subspaces — , , , and . That is, every subspace of is one of the following: the origin; a line through the origin; a plane through the origin; or all of . Figure 1.1 shows one subspace of each dimension. This is the picture to keep in mind for any subspace of : a subspace is flat, passes through the origin, and has dimension at most . Unless it is , it extends without bound in every direction that it contains.
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 Because , the three-vector collection is dependent and may be deleted without changing its span. The remaining vectors and are independent: if , then which forces . Thus form a basis of , and the three vectors span . Figure 1.2 illustrates these relationships.
We use the standard finite-dimensional facts that every subspace of has a basis, any two bases of the same subspace have the same number of vectors, and every independent collection in has at most vectors. The standard basis of is the collection , where is the vector with in coordinate and 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 to , and we use this perspective to study the solution sets of systems of linear equations. The same product also has two useful interpretations. We begin by naming the rows and columns of , and then develop each interpretation.
2.1 Two readings of a matrix-vector product
Let
Write the rows of as and its columns as . Thus
Suppose . We call the input and the output. The product can be represented as
The product is thus a linear combination of the columns of , with entries of as weights. For the row interpretation of matrix , we need to consider an equation .
Definition 2.1 (Linear system). For an matrix and , the equation is a linear system with coefficient matrix and right-hand side . 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 :
Each row is thus a restriction on what the input could be to reach output using matrix . At the same time, the column representation essentially asks which linear combination of the columns of produces the target .
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 The rows and columns of are and The column interpretation gives For the row interpretation writes as
The theorem below shows that a function from to is linear if and only if it can be represented as an 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 is a linear map, or a linear transformation, if for all and .
Here is the input and is the output.
Theorem 2.4 (Matrices represent linear maps). A function is linear if and only if there is an matrix such that for every . In that case is unique, and its th column is . If is linear with matrix , then the composition is linear with matrix .
Proof (optional). Linear implies matrix. Let be linear. Every is the linear combination of the standard basis, so linearity applied to each term gives Let , which is because each lies in . Since is the combination of the columns of with weights , the display says exactly that .
Matrix implies linear. If for an matrix , then and , so is linear.
Uniqueness. Suppose for every . Taking makes and the th columns of and , so the two matrices agree column by column and . The same substitution in identifies the th column of as .
Composition. Let be linear with matrix . For every , associativity of the matrix product gives so is represented by the matrix , and it is linear by the second part. ◻
2.2 Row space, column space, and rank
Definition 2.5 (Row and column spaces).
Let be an matrix. Its row space and column space are By (1), so the column space is the range of the linear map .
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 ,
Definition 2.7 (Rank). The rank of is their common dimension:
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 can produce.
Example 2.8 (Rank of a matrix). Let The first two columns of form a basis of . Thus 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 produces the output , so . Let be a proposed change to the input. After the change, the new input is . It produces the same output exactly when Thus leaves unchanged if and only if . The collection of all such changes is the null space.
Definition 2.9 (Null space). For an matrix , its null space, or kernel, is The dimension of is called the nullity of .
Every null space is a subspace. Indeed, if and , then 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 .
Its elements have two interpretations. In the row interpretation, so adding to changes the left-hand side of every constraint by zero. In the column reading, Here is the change in the weight on column . Thus means that these changes cancel, leaving the output unchanged. A nonzero such 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 can produce. The nullity is the dimension of the set of changes that leave unchanged. The rank–nullity theorem relates these two counts. We use it without proof.
Theorem 2.10 (Rank–nullity theorem). If is an matrix, then
Example 2.11 (Null space of a matrix). Let Here and , so . To identify the null space, solve : Subtracting twice the first equation from the second gives . Substitution into the first gives . Letting , This illustrates rank–nullity: Here the nullity means that one scalar, , can be chosen freely when describing changes that preserve all restrictions. More generally, if , then coefficients can be chosen freely; these are the degrees of freedom.
2.4 The solution set
The column interpretation answers the existence question immediately:
The following theorem describes the solution set of a consistent linear system in terms of a particular solution and the null space (which is the solution set for ).
Theorem 2.12 (Solution set). If is one solution of , then the full solution set is Consequently, a consistent system has a unique solution if and only if .
Proof. If , then , so . Conversely, if , then . ◻
Together with the column-space criterion, the theorem gives the complete description
Example 2.13 (Solution set of a linear system). Let The null space is and one particular solution is . Therefore Adding the displayed null vector gives another solution: reflecting that the third column of 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 be .
if and only if has at least one solution for every .
if and only if has at most one solution for every .
The first clause follows because exactly when , which means every belongs to the column space. For the second clause, rank–nullity gives 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 |
|---|---|
| every has exactly one | |
| every has infinitely many | |
| none or exactly one, depending on | |
| none or infinitely many, depending on |
3 Square matrices and invertibility
Definition 3.1 (Inverse). An matrix is invertible, or nonsingular, if there is an matrix satisfying If no inverse exists, is singular.
An inverse is unique: if and are both inverses of , then .
Theorem 3.2 (Invertible-matrix equivalences).
For an matrix , the following are equivalent:
is invertible;
;
the columns of are linearly independent;
;
for every , the system has exactly one solution.
When these conditions hold, the solution is .
The equivalence of clauses (2)–(5) follows from full row and column rank and the affine solution-set theorem. If is invertible, multiplying by gives the unique solution . Conversely, if every has a unique solution , put those solutions into the columns of . Then , and the triviality of forces , so .
The determinant is a function that turns a square matrix into a scalar.
Definition 3.3 (Determinant). For a matrix, . For , let denote the matrix obtained from by deleting row and column . The determinant of is
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 ( determinant). Let . Here and , so
Example 3.5 ( determinant). Let . Each of the three terms now needs a determinant:
The determinant supplies a scalar test for the equivalent conditions above.
Theorem 3.6 (Determinant criterion). A square matrix is invertible if and only if .
Example 3.7 (The inverse in the case). Let If , multiplying in either order gives As long as the determinant , we can divide by it to get the inverse:
4 Eigenvalues and eigenvectors
Definition 4.1 (Eigenvalues and eigenvectors). Let be a real matrix. A scalar is an eigenvalue of if there is a nonzero vector such that Such a vector is an eigenvector associated with .
The eigenvalue equation can be rewritten as
As such, we immediately have the following equivalences, which are useful for computing eigenvalues and eigenvectors.
Theorem 4.2 (Eigenvalue equivalences).
For a real matrix and , the following are equivalent:
is an eigenvalue of ;
;
is singular;
.
Proof (optional). (1) (2). By Definition 4.1, is an eigenvalue exactly when for some . By (4) such a satisfies , and conversely. So an eigenvalue exists precisely when has a nonzero null vector, which is the statement .
(2) (3). Apply Theorem 3.2 to the square matrix : it is invertible if and only if its null space is trivial. Negating both sides, is singular if and only if .
(3) (4). Apply Theorem 3.6 to : it is invertible if and only if . 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 in Theorem 4.2.
Corollary 4.3 (Zero eigenvalue). A square matrix is singular if and only if is an eigenvalue of . Equivalently, is invertible if and only if all of its eigenvalues are nonzero.
The equation is the characteristic equation. Its left-hand side is the characteristic polynomial. The roots of the characteristic polynomial are the eigenvalues of . For each eigenvalue , the associated eigenvectors are the nonzero elements of .
Example 4.4 (Eigenvalues and eigenvectors of a matrix).
Let Subtracting from each diagonal entry and taking the determinant gives the characteristic polynomial Its roots are the eigenvalues and .
To find the eigenvectors belonging to , solve : so both equations reduce to , and . For , solve : so both equations reduce to , and .
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 matrix has degree , so has at most 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 . Its characteristic polynomial is , which has the single root . Thus has one distinct eigenvalue rather than two.
Example 4.7 (No real eigenvalues). Let Since Definition 4.1 requires , this matrix has no eigenvalues and no nonzero eigenvectors in . 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 matrix is the sum of its diagonal entries,
Theorem 4.9 (Trace and determinant). Let be an matrix whose characteristic polynomial factors into real linear terms, Then
Definition 4.10 (Diagonalizable matrix). An matrix is diagonalizable if there are an invertible matrix and a diagonal matrix with
Theorem 4.11 (Diagonalization). An matrix is diagonalizable if and only if it has linearly independent eigenvectors . In that case one may take where is the eigenvalue belonging to . In particular, is diagonalizable whenever it has distinct real eigenvalues.
This result is particularly useful for real symmetric matrices, which always have linearly independent eigenvectors and are therefore diagonalizable.