DifferentialEquations
Chapter 7 · Section 7.5

7.5 Matrices and Vectors

In Sections 7.1–7.4 we handled systems of two equations by hand: eliminate, or guess exponentials, and keep track of every coefficient. That works for two unknowns. For three or more it quickly becomes a bookkeeping nightmare. The cure is to collect the unknowns into a single vector and the coefficients into a single matrix. A system such as

then becomes one short equation, , and the whole theory of linear systems can be written, and understood, almost exactly like the theory of a single equation .

This section collects the linear algebra we need for Sections 7.6–7.8. If you have taken a linear algebra course, skim it, but read the parts on eigenvalues and on vector functions carefully, because the matrix method is built on them. If you have not, everything you need is here, with examples.

Matrices: the basic vocabulary

Definition 7.5.1 (Matrix, vector)

An matrix is a rectangular array of numbers with rows and columns:

The number in row and column is the entry. We also write . The matrix is square if . An matrix is a column vector, or simply a vector; we denote vectors by bold lowercase letters,

Two matrices are equal when they have the same size and all corresponding entries agree. So one matrix equation stands for many scalar equations at once. That is the whole point.

Some special matrices appear constantly. The zero matrix has every entry equal to . The identity matrix has 's on the main diagonal (from top left to bottom right) and 's elsewhere. For example, the identity is

The transpose is obtained by turning rows into columns: the entry of is . We use it mainly to save space: instead of a tall column we write .

Operations with matrices

Addition and scalar multiplication work entry by entry. If and have the same size and is a number, then and . These obey the familiar rules: , , , and so on. Matrices of different sizes cannot be added.

Multiplication is less obvious, and it is designed so that a linear system can be written as a product.

Definition 7.5.2 (Matrix product)

Let be and be . The product is the matrix whose entry is

In words: the entry is "row of times column of ". The product exists only when the number of columns of equals the number of rows of .

The most important special case is a square matrix times a vector. With ,

The second form is worth remembering: is a combination of the columns of , with weights . It is the key to understanding linear independence below.

Thanks to this definition, the system at the top of the page is exactly

Row of holds the coefficients of equation , column holds the coefficients of the unknown . A missing unknown means a zero entry, just as a missing derivative meant a zero coefficient in Chapter 4.

Matrix multiplication is associative, , and distributive, . Also for square . But one rule of ordinary arithmetic fails:

Common mistake

In general . The order of the factors matters. Also, does not imply or . For instance, with we get although . Matrices with will appear in Section 7.7.

Example 7.5.1

Let and . Compute , , , and for .

Solution
  1. Sum. Entry by entry: .
  2. Combination. , , so .
  3. Product . Row times column:
  4. Product . So .
  5. Matrix times vector. .

Determinants

Every square matrix has a number attached to it, its determinant, which tells us at a glance whether the matrix can be "undone". For and matrices the definitions are:

The second formula is the cofactor expansion along the first row: each entry multiplies the determinant left after deleting its row and column, with alternating signs. The expansion can be done along any row or column, using the sign pattern

Choose the row or column with the most zeros: it saves work. The same idea defines determinants recursively.

The following properties are used again and again (they hold for every ):

  • , and the determinant of a triangular matrix is the product of its diagonal entries.
  • Swapping two rows changes the sign of the determinant.
  • Multiplying one row by multiplies the determinant by .
  • Adding a multiple of one row to another row does not change the determinant.
  • A matrix with a zero row, or with two proportional rows, has determinant .
  • and ; so everything said about rows holds for columns too.
Example 7.5.2

Evaluate for .

Solution
  1. Choose a column. The first column contains a zero, so expand along it. The signs for column 1 are .
  2. Expand.

The inverse of a matrix

For numbers, is solved by dividing by , provided . For matrices, "dividing" means multiplying by an inverse.

Definition 7.5.3 (Inverse)

An matrix is invertible (or nonsingular) if there is an matrix with

A square matrix with no inverse is called singular.

Theorem 7.5.1 (When does an inverse exist?)

A square matrix is invertible if and only if . For a matrix with ,

The formula is easy to remember: swap the diagonal entries, change the sign of the other two, divide by the determinant. You can check it by multiplying. For larger matrices the practical method is Gauss–Jordan elimination: write and side by side as , and use row operations (swap rows, multiply a row by a nonzero number, add a multiple of one row to another) until the left half becomes . The right half is then . If a zero row appears on the left, is singular.

Example 7.5.3

(a) Invert . (b) Invert and use the inverse to solve .

Solution
  1. (a) The determinant is , so the inverse is .
  2. (b) Set up.
  3. Clear column 1. Row 3 minus row 1:
  4. Clear column 2. Row 1 minus row 2, and row 3 plus row 2:
  5. Clear column 3. Row 1 plus row 3, and row 2 minus row 3:
  6. Check. Multiplying, . (Also , consistent with Theorem 7.5.1.)
  7. Solve. . Substituting back: .

The next theorem is the single most useful fact from linear algebra for this chapter. Part 2 is the reason eigenvalues are computed from a determinant.

Theorem 7.5.2 (Square linear systems)

Let be an matrix.

  1. If , then for every the system has exactly one solution, .
  2. The homogeneous system has a solution if and only if .

Part 2 follows from part 1: if , the only solution of is . If , elimination produces at least one zero row, so at least one unknown can be chosen freely, and a nonzero solution exists.

Linear independence of vectors

Definition 7.5.4 (Linear dependence and independence)

Vectors are linearly dependent if there are numbers , not all zero, with

Otherwise they are linearly independent: the only combination that gives is the one with .

Dependent means that at least one vector is a combination of the others, so it brings nothing new. Two vectors are dependent exactly when one is a multiple of the other (they lie on one line through the origin).

When we have exactly vectors with components, there is a quick test. Put the vectors side by side as the columns of an matrix . By the "combination of columns" view of the product, with . Part 2 of Theorem 7.5.2 now gives:

Theorem 7.5.3 (Determinant test for independence)

The vectors with components each are linearly independent if and only if

Example 7.5.4

(a) Are , , independent? (b) Same question for , , .

Solution
  1. (a) Determinant. Expanding along the first row, So the vectors are dependent.
  2. Find the relation. Solve , i.e. , , . The second equation gives ; then the first gives . The third is then automatic: . With : .
  3. (b) so are independent.

Eigenvalues and eigenvectors

In Section 7.4 we looked for solutions of a system of the form , . In vector language this is with a constant vector . Since and (here is the coefficient matrix), the equation becomes, after cancelling ,

This little equation is the heart of the matrix method.

What it means geometrically

Multiplying by a matrix usually changes both the length and the direction of a vector. Take and : then points in a different direction. But for a few special vectors the direction does not change; the vector is only stretched, shrunk or reversed. For this , . Those special directions are the eigenvectors, and the stretching factors are the eigenvalues.

Figure 7.5.1. For : a generic vector is turned (left), while an eigenvector stays on its own line (right). is stretched; is stretched and reversed.
Definition 7.5.5 (Eigenvalue, eigenvector)

Let be an matrix. A number (real or complex) is an eigenvalue of if there is a vector with

Every such nonzero is an eigenvector of corresponding to . (Older books say characteristic value and characteristic vector.)

Three remarks. First, is excluded, because for every and would tell us nothing. Second, if is an eigenvector, so is for every : eigenvectors are really eigendirections, and we may scale them to have simple integer entries. Third, is allowed; it is an eigenvalue exactly when has a nonzero solution, i.e. when .

Figure 7.5.2 shows the same idea for many vectors at once. At points of the unit circle we attach the arrow (shortened). Only along the eigenlines do the arrows point straight away from, or straight toward, the origin. In Section 7.6 these lines will become the straight-line solutions of .

Figure 7.5.2. Arrows attached at points of the unit circle, for the same matrix. On the eigenline of they point outward; on the eigenline of they point inward. Everywhere else they are tilted.

How to find them

Rewrite as , that is

(We need here: "" makes no sense, a matrix minus a number.) This is a homogeneous linear system for . By part 2 of Theorem 7.5.2 it has a nonzero solution if and only if its determinant vanishes.

Definition 7.5.6 (Characteristic equation)

The polynomial is the characteristic polynomial of ; it has degree . The eigenvalues of are exactly the roots of the characteristic equation

The multiplicity of as a root is its algebraic multiplicity. The number of linearly independent eigenvectors belonging to is its geometric multiplicity; it is at least and at most the algebraic multiplicity.

For a matrix the characteristic polynomial can be written down at once. With ,

where is the trace (sum of the diagonal entries). Comparing with we see that the eigenvalues add up to the trace and multiply to the determinant. The same holds for matrices (counting multiplicities), which gives a cheap check on your arithmetic.

Method in a nutshell
  1. Form (subtract from each diagonal entry) and expand . For use .
  2. Solve ; check that the roots add up to and multiply to .
  3. For each eigenvalue, solve by elimination. At least one equation is always redundant; the free unknown(s) give the eigenvector(s).
  4. Shortcut for : if a row of is , then is an eigenvector.
  5. Check: compute and compare with .
Example 7.5.5

Find the eigenvalues and eigenvectors of .

Solution
  1. Characteristic equation. and , so and , . Check: , .
  2. Eigenvector for . Both rows say , i.e. . Taking : .
  3. Eigenvector for . so and .
  4. Check. and . These are the vectors of Figure 7.5.1.
Example 7.5.6

Find the eigenvalues and eigenvectors of .

Solution
  1. Characteristic polynomial. Expand along the first row: Pulling out the common factor before multiplying out saved us from factoring a cubic.
  2. Eigenvalues. , , . Check: and .
  3. . reads From the first and third, and ; the second is then automatic. With : .
  4. . reads , , . So , , and .
  5. . reads , , . So , , and .
  6. Check one. .

In Example 7.5.6 the three eigenvectors are independent: the determinant of the matrix with columns equals . This is no accident.

Theorem 7.5.4 (Distinct eigenvalues give independent eigenvectors)

Eigenvectors corresponding to distinct eigenvalues are linearly independent. In particular, an matrix with distinct eigenvalues has linearly independent eigenvectors.

For two eigenvectors the reason is short. Suppose , with , and . Multiply by : . Subtract times the original relation: . Since and , ; then gives . The general case is proved in Section 7.8.

Complex and repeated eigenvalues

A real matrix can have complex eigenvalues. They come in conjugate pairs, and so do their eigenvectors: taking complex conjugates in (with real) gives . So once you have the eigenvector for , the one for comes for free.

Example 7.5.7

Find the eigenvalues and eigenvectors of .

Solution
  1. Characteristic equation. , , so and
  2. Eigenvector for . Use the shortcut on the first row : , or, multiplying by , .
  3. Check with the second row (it must also be satisfied): . Good.
  4. Conjugate. For an eigenvector is .
Example 7.5.8

Find the eigenvalues and eigenvectors of and compare with .

Solution
  1. Characteristic equation. , : . So with algebraic multiplicity .
  2. Eigenvectors. , so . Every eigenvector is a multiple of : the geometric multiplicity is only .
  3. Comparison. has the same characteristic polynomial , but , so every nonzero vector is an eigenvector: geometric multiplicity .

A matrix like in Example 7.5.8, with fewer independent eigenvectors than its size, is called defective. Defective matrices need the extra idea of generalized eigenvectors, which we develop in Sections 7.6 and 7.7.

Vector functions and their derivatives

The unknowns of a system depend on , so our vectors and matrices will have entries that are functions.

Definition 7.5.7 (Vector and matrix functions)

A vector function on an interval is a vector whose components are functions defined on . It is continuous (or differentiable) on if every component is. Its derivative and integral are taken component by component:

Matrix functions are treated in the same way.

Geometrically, for the point traces a curve in the plane as runs, and is the velocity vector, tangent to the curve (Figure 7.5.3). This picture is the phase plane of Section 7.6.

Figure 7.5.3. The vector function traces an ellipse. The derivative , drawn at the tip of , is tangent to the curve and points in the direction of motion.

Because everything is done componentwise, the usual rules of calculus carry over. For differentiable , a scalar function , a constant matrix and a differentiable matrix function :

In the last rule keep to the left of : order matters for matrices. A special case we use all the time: for a constant vector ,

With this notation, a general linear system of first-order equations,

is written as . It is homogeneous when .

Example 7.5.9

(a) Differentiate and compute . (b) With show that solves , but does not.

Solution
  1. (a) Derivative. Componentwise, using the product rule in the second component and the chain rule in the third:
  2. Integral. and , so the integral is .
  3. (b) Left side. .
  4. Right side. (Example 7.5.5). The two sides agree for all : is a solution. This is exactly because is an eigenvector with eigenvalue .
  5. The other function. , while . These differ, so is not a solution: is not an eigenvector.

Linear dependence of vector functions

Solutions of systems are vector functions, so we need independence for them too. The definition is the same as for vectors, except that one set of constants must work for all in the interval.

Definition 7.5.8 (Dependence of vector functions)

Vector functions are linearly dependent on if there are constants , not all zero, with for every in . Otherwise they are linearly independent on .

Careful

Independence of vector functions is not the same as independence of their values at each fixed . Take and . At every fixed the two vectors are parallel, since , and . Yet as functions they are independent: for all means for all , which forces . The multiplier is not a constant. Section 7.8 shows that this strange behaviour is impossible for solutions of a system .

Exercises

  1. Let and . Compute , and .
    Answer , ,
  2. Compute for and .
    Answer
  3. Evaluate .
    Answer
  4. Find the inverse of .
    Answer
  5. Find the inverse of by Gauss–Jordan elimination.
    Answer (the determinant is )
  6. Show that , , are linearly dependent and find a dependence relation.
    Answer The determinant is ;
  7. Are , , linearly independent?
    Answer Yes: the determinant is .
  8. Find the eigenvalues and eigenvectors of .
    Answer : ; :
  9. Find the eigenvalues and eigenvectors of .
    Answer ; for : , for :
  10. Find the eigenvalues and eigenvectors of .
    Answer ; : ; : ; :
  11. Find for , and evaluate .
    Answer ; the integral is .
  12. Let . Verify that solves . What does this say about ? Find the other eigenvalue and an eigenvector for it.
    Answer Both sides equal , so is an eigenvector with eigenvalue . Since the trace is , the other eigenvalue is , with eigenvector .