Part V · Linear algebra Chapter 38 of 60
Eigenvectors
A matrix usually turns vectors, but many matrices have directions they only stretch. Let’s find them, and it will turn out that the Fibonacci numbers, the Google search engine and a tilted ellipse all work the same way.
Builds on: 37 · Vector spaces
You will learn
- find eigenvalues and eigenvectors through the characteristic polynomial
- raise a matrix to a power by diagonalisation and derive Binet’s formula this way
- recognise an eigenvector in the stationary distribution of a Markov chain, in PageRank and in the axes of an ellipse
The last chapter ended with an observation: a linear transformation can have directions that it doesn’t turn but only stretches. Let’s check on the matrix $A = \left(\begin{smallmatrix} 2 & 1 \\ 1 & 2 \end{smallmatrix}\right)$. It takes the vector $(1, 0)$ to $(2, 1)$: the arrow has turned. The vector $(0, 1)$ goes to $(1, 2)$ and turns too. But the vector $(1, 1)$ goes to $(3, 3)$: the same direction, three times the length. And the vector $(1, -1)$ stays exactly where it is.
Such directions will be our quarry. They’re worth hunting, because they hide the answers to three problems that at first sight have nothing in common. How do you find the hundredth Fibonacci number without computing the ninety-nine before it? How does a search engine decide which of billions of pages is more important? And what is the curve $5x^2 + 4xy + 2y^2 = 6$, with the very product $xy$ that the chapter on conic sections left for us to sort out?
The answer in all three cases is the same. Find the directions the matrix doesn’t turn, and look at it along them. Along these directions even the most tangled transformation turns out to be a simple stretch.
Tracks on the grid
Take a $2 \times 2$ matrix and start turning a vector $\mathbf v$ of length one. Its image $A\mathbf v$ turns too, but at its own speed: in places it lags behind $\mathbf v$, in places it runs ahead. If in one position $A\mathbf v$ lags and in another it overtakes, then somewhere in between the arrows are bound to lie on one line. Those are the positions we’re trying to catch.
A non-zero vector $\mathbf v$ is called an eigenvector of the matrix $A$ if $A\mathbf v = \lambda\mathbf v$ for some number $\lambda$. This number is the eigenvalue corresponding to the vector $\mathbf v$.
As in the previous chapters, vectors are written in bold, and coordinates in the text are written in a row: $(1, -1)$ means the column $\left(\begin{smallmatrix} 1 \\ -1 \end{smallmatrix}\right)$.
If $\mathbf v$ is an eigenvector, so are $2\mathbf v$, $-\mathbf v$ and in general $c\mathbf v$ for any $c \ne 0$: $A(c\mathbf v) = c\,A\mathbf v = \lambda\,(c\mathbf v)$. So what we’re hunting are lines, not individual arrows. The sum of two eigenvectors with the same $\lambda$ again satisfies $A\mathbf v = \lambda\mathbf v$, so all such vectors together with the zero vector form a subspace, the eigenspace. Most often it’s a line, but it can be bigger: for the scaling $\mathbf v \mapsto 2\mathbf v$ the whole space is an eigenspace.
Here’s what the hunt gives for the familiar transformations from chapter 35:
| Transformation of the plane | Eigendirections | $\lambda$ |
|---|---|---|
| Scaling $\mathbf v \mapsto k\mathbf v$ | all | $k$ |
| Orthogonal projection onto a line | the line itself and the perpendicular to it | $1$ and $0$ |
| Reflection in a line | the line itself and the perpendicular to it | $1$ and $-1$ |
| Shear $\left(\begin{smallmatrix} 1 & 1 \\ 0 & 1 \end{smallmatrix}\right)$ | only the $x$-axis | $1$ |
| Rotation through an angle not a multiple of $180°$ | none | — |
Next to the plane in the widget a sonar is running. It shows the signed area of the parallelogram on $\mathbf v$ and $A\mathbf v$: plus if $A\mathbf v$ is turned anticlockwise from $\mathbf v$, minus if clockwise. Where the curve crosses zero, the vectors lie on one line. For a rotation the whole curve is above zero, and the quarry escapes. For a shear it only touches zero at one point.
Why the sonar draws a sine wave
For $A = \left(\begin{smallmatrix} a & b \\ c & d \end{smallmatrix}\right)$ and $\mathbf v = (\cos\theta, \sin\theta)$ the signed area equals
$$S(\theta) = \det(\mathbf v, A\mathbf v) = \frac{c - b}{2} + \frac{c + b}{2}\cos 2\theta + \frac{d - a}{2}\sin 2\theta.$$
This is a sine wave with period $180°$, raised by $\frac{c - b}{2}$. The rise is the contribution of the “rotational” part of the matrix, and the amplitude of the sine wave is $\frac12\sqrt{(c + b)^2 + (d - a)^2}$. It reaches zero when the rise is no bigger than the amplitude: $(c - b)^2 \le (c + b)^2 + (d - a)^2$, that is, $(a - d)^2 + 4bc \ge 0$. On the left is the discriminant of the characteristic polynomial from the next section. For a symmetric matrix $b = c$, there’s no rise, and there are always two eigendirections (or all of them at once). We’ll come back to this at the end of the chapter.
How many eigendirections does a rotation of the plane through $180°$ about the origin have?
A rotation through $180°$ takes every vector $\mathbf v$ to $-\mathbf v$, that is, it coincides with the matrix $-I$. Every non-zero vector is an eigenvector, with $\lambda = -1$: the arrow turns round but stays on its line.
The trap: the characteristic polynomial
Walking an arrow round a circle is possible in the plane. In three-dimensional space the directions form a whole sphere, and where there are billions of coordinates (a search engine works with vectors like that), trying them one by one is hopeless. We need a trap that catches all the quarry at once.
Let’s rewrite the definition. The equation $A\mathbf v = \lambda\mathbf v$ means the same as $A\mathbf v - \lambda I\mathbf v = \mathbf 0$, that is,
$$(A - \lambda I)\,\mathbf v = \mathbf 0.$$
Here $I$ is the identity matrix (some books write $E$); subtracting $\lambda I$ means subtracting $\lambda$ from each diagonal entry. We’ve got a homogeneous system of equations, and an eigenvector is a non-zero solution of it. Whether there is such a solution, the determinant will tell us.
The polynomial $\det(A - \lambda I)$ in the variable $\lambda$ is called the characteristic polynomial of the matrix $A$.
A number $\lambda$ is an eigenvalue of a square matrix $A$ if and only if $\det(A - \lambda I) = 0$. This holds for complex $\lambda$ too, if eigenvectors are sought among vectors with complex coordinates.
The idea: the equation $A\mathbf v = \lambda\mathbf v$ means that the matrix $A - \lambda I$ sends a non-zero vector to zero. Such a matrix squashes the plane onto a line, and the determinant shows how area changes, so it’s zero. The picture is for $2 \times 2$ matrices; what changes in $n$ dimensions is said at the end.
For an $n \times n$ matrix the characteristic polynomial has degree $n$: when the determinant is expanded, the $\lambda$’s from the diagonal entries are multiplied together at most $n$ times, and the leading term is $(-\lambda)^n$. So there are at most $n$ distinct eigenvalues. Some books write $\det(\lambda I - A)$ so that the leading coefficient is one; the roots don’t change.
Once the eigenvalues are found, the eigenvectors come from solving a homogeneous system by Gaussian elimination from chapter 36.
Example
Let’s find the eigenvectors of $A = \left(\begin{smallmatrix} 4 & 1 \\ 2 & 3 \end{smallmatrix}\right)$. For $\lambda = 2$ the system $(A - 2I)\mathbf v = \mathbf 0$ looks like this:
$$\begin{pmatrix} 2 & 1 \\ 2 & 1 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \end{pmatrix}.$$
The rows are the same, as they should be, since the determinant is zero. One equation is left, $2x + y = 0$, and $\mathbf v_1 = (1, -2)$. For $\lambda = 5$ the matrix $A - 5I = \left(\begin{smallmatrix} -1 & 1 \\ 2 & -2 \end{smallmatrix}\right)$ gives $x = y$, and $\mathbf v_2 = (1, 1)$. Check: $A\mathbf v_1 = (2, -4) = 2\mathbf v_1$, $A\mathbf v_2 = (5, 5) = 5\mathbf v_2$.
For a $2 \times 2$ matrix the determinant can be expanded in general: $\det(A - \lambda I) = (a - \lambda)(d - \lambda) - bc = \lambda^2 - (a + d)\lambda + (ad - bc)$. The constant term is the determinant of $A$, and the coefficient of $\lambda$ is minus the sum of the diagonal entries. This sum is called the trace of the matrix and written $\operatorname{tr} A$.
Both equations hold for matrices of any size too.
Let $\lambda_1, \dots, \lambda_n$ be all the roots of the characteristic polynomial of an $n \times n$ matrix $A$, listed with multiplicity (some may be complex). Then $\lambda_1 + \lambda_2 + \dots + \lambda_n = \operatorname{tr} A$ and $\lambda_1\lambda_2\cdots\lambda_n = \det A$.
The idea: write the same polynomial in two ways and compare two of their coefficients. By the fundamental theorem of algebra (stated in chapter 15, proved in chapter 34) a polynomial of degree $n$ factors over $\mathbb C$ into linear factors. The leading coefficient of $\det(A - \lambda I)$ is $(-1)^n$, so
$$\det(A - \lambda I) = (\lambda_1 - \lambda)(\lambda_2 - \lambda)\cdots(\lambda_n - \lambda).$$
Substitute $\lambda = 0$: on the left we get $\det A$, on the right $\lambda_1\lambda_2\cdots\lambda_n$, and that’s the second equation. Now compare the coefficients of $\lambda^{n-1}$. On the right it’s $(-1)^{n-1}(\lambda_1 + \dots + \lambda_n)$: the power $\lambda^{n-1}$ arises when we take $-\lambda$ from every bracket but one. On the left, recall how an $n \times n$ determinant is built: it’s a sum of products of $n$ entries, one from each row and each column, with plus or minus signs (expanding a determinant along rows, we keep getting exactly such products). The variable $\lambda$ stands only on the diagonal. For a product to contain at least $\lambda^{n-1}$, it has to take at least $n - 1$ diagonal entries, but then the last factor stands in the only remaining row and column, that is, on the diagonal as well. So the powers $\lambda^n$ and $\lambda^{n-1}$ come only from the product $(a_{11} - \lambda)(a_{22} - \lambda)\cdots(a_{nn} - \lambda)$, and the coefficient of $\lambda^{n-1}$ on the left is $(-1)^{n-1}(a_{11} + \dots + a_{nn}) = (-1)^{n-1}\operatorname{tr} A$. Equating, we get $\lambda_1 + \dots + \lambda_n = \operatorname{tr} A$. For $n = 2$ this is exactly Vieta’s formulas for the equation $\lambda^2 - (\operatorname{tr} A)\lambda + \det A = 0$.
Hence a useful test: a matrix is singular exactly when zero is among its eigenvalues. The whole set of eigenvalues is called the spectrum of the matrix.
Find the eigenvalues of the matrix $\left(\begin{smallmatrix} 1 & 2 \\ 3 & 2 \end{smallmatrix}\right)$.
The trace is $1 + 2 = 3$, the determinant $1 \cdot 2 - 2 \cdot 3 = -4$. The equation $\lambda^2 - 3\lambda - 4 = 0$ factors as $(\lambda - 4)(\lambda + 1) = 0$, so $\lambda_1 = 4$, $\lambda_2 = -1$. Check: $4 + (-1) = 3$ and $4 \cdot (-1) = -4$.
The trophy: a diagonal matrix
Suppose the hunt was a success: an $n \times n$ matrix turned out to have $n$ linearly independent eigenvectors $\mathbf v_1, \dots, \mathbf v_n$ with eigenvalues $\lambda_1, \dots, \lambda_n$. They form a basis, and in this basis the matrix is as simple as it gets. The vector with coordinates $c_1, \dots, c_n$ in the new basis is $c_1\mathbf v_1 + \dots + c_n\mathbf v_n$, and the matrix turns it into $\lambda_1c_1\mathbf v_1 + \dots + \lambda_nc_n\mathbf v_n$. Each coordinate is multiplied by its own number, and nothing gets mixed.
Let’s write this with matrices. Put the eigenvectors as columns of a matrix $P$ (in chapter 37 such a matrix was called the change-of-basis matrix), and the eigenvalues on the diagonal of the matrix $D = \operatorname{diag}(\lambda_1, \dots, \lambda_n)$, which has zeros off the diagonal. Then
Let $A$ be an $n \times n$ matrix, $P$ an invertible matrix of the same size with columns $\mathbf p_1, \dots, \mathbf p_n$, and $D = \operatorname{diag}(d_1, \dots, d_n)$. The equation $A = PDP^{-1}$ holds if and only if $A\mathbf p_i = d_i\mathbf p_i$ for each $i$, that is, when the columns of $P$ are a basis of eigenvectors of $A$ and the diagonal of $D$ holds their eigenvalues.
The idea: in a basis of eigenvectors the matrix stretches each coordinate separately, and $P^{-1}$ and $P$ are merely the move to this basis and back. The picture is for $n = 2$, but not a single step uses the fact that there are two coordinates.
A square matrix is called diagonalisable if it has a basis of eigenvectors, that is, $A = PDP^{-1}$ for some invertible matrix $P$ and diagonal $D$.
The trophy justifies the hunt when the matrix has to be applied many times. In the product $(PDP^{-1})(PDP^{-1})\cdots(PDP^{-1})$ all the inner pairs $P^{-1}P$ cancel.
If $A = PDP^{-1}$ and $D = \operatorname{diag}(d_1, \dots, d_n)$, then for any natural $k$
$$A^k = PD^kP^{-1}, \qquad D^k = \operatorname{diag}(d_1^k, \dots, d_n^k).$$
Induction on $k$. At $k = 1$ it’s the equation $A = PDP^{-1}$ itself. Suppose that for some $k$ we already know $A^k = PD^kP^{-1}$. Then $A^{k+1} = A^kA = (PD^kP^{-1})(PDP^{-1})$. Matrix multiplication is associative, so the brackets can be placed differently: $PD^k(P^{-1}P)DP^{-1} = PD^kIDP^{-1} = PD^{k+1}P^{-1}$. The second formula remains. The product of two diagonal matrices is diagonal, and its diagonal entries are the products of the corresponding entries of the factors: in the sum $\sum_j a_{ij}b_{jl}$ with diagonal matrices only the term with $i = j = l$ can be non-zero. So multiplying $D$ by itself $k$ times, we get $d_i^k$ on the diagonal.
For our example
$$A^n = \frac13\begin{pmatrix} 2^n + 2\cdot 5^n & 5^n - 2^n \\ 2\cdot 5^n - 2^{n+1} & 5^n + 2^{n+1} \end{pmatrix}.$$
At $n = 1$ we get $A$ itself, and at $n = 10$ the matrix $\left(\begin{smallmatrix} 6{,}510{,}758 & 3{,}254{,}867 \\ 6{,}509{,}734 & 3{,}255{,}891 \end{smallmatrix}\right)$, without having to multiply $A$ by itself nine times. Something else shows too: for large $n$ the terms with $5^n$ swamp everything else, so $A^n$ is almost proportional to the matrix $\left(\begin{smallmatrix} 2 & 1 \\ 2 & 1 \end{smallmatrix}\right)$, both of whose columns point along $(1, 1)$. We’ll come back to this observation.
In a basis of eigenvectors a matrix mixes nothing: it simply multiplies each coordinate by its own $\lambda$. So applying the matrix $n$ times comes down to raising numbers to a power.
Find the top left entry of the matrix $A^5$ for $A = \left(\begin{smallmatrix} 4 & 1 \\ 2 & 3 \end{smallmatrix}\right)$.
By the formula for $A^n$: $\frac{2^5 + 2 \cdot 5^5}{3} = \frac{32 + 6250}{3} = 2094$.
When is a basis of eigenvectors guaranteed? A sufficient condition is simple.
Let $\mathbf v_1, \dots, \mathbf v_k$ be eigenvectors of a matrix $A$ with pairwise distinct eigenvalues $\lambda_1, \dots, \lambda_k$. Then they’re linearly independent. In particular, an $n \times n$ matrix with $n$ distinct eigenvalues is diagonalisable.
The idea: apply the matrix $A$ to a linear combination and subtract the original equation so that one vector disappears, then go down by induction. Induction on $k$. A single eigenvector is linearly independent, because it’s non-zero. Suppose the statement is proved for $k - 1$ vectors, and $c_1\mathbf v_1 + \dots + c_k\mathbf v_k = \mathbf 0$. Apply the matrix $A$ to the equation: $c_1\lambda_1\mathbf v_1 + \dots + c_k\lambda_k\mathbf v_k = \mathbf 0$. Subtract the original equation multiplied by $\lambda_k$. The last vector disappears: $c_1(\lambda_1 - \lambda_k)\mathbf v_1 + \dots + c_{k-1}(\lambda_{k-1} - \lambda_k)\mathbf v_{k-1} = \mathbf 0$. By the inductive hypothesis all the coefficients here are zero, and since $\lambda_i \ne \lambda_k$, it’s $c_1, \dots, c_{k-1}$ that are zero. Then $c_k\mathbf v_k = \mathbf 0$, and $c_k = 0$, because $\mathbf v_k \ne \mathbf 0$. If there are $n$ distinct eigenvalues, take one eigenvector for each: we get $n$ linearly independent vectors in an $n$-dimensional space, that is, a basis (chapter 37), and by the criterion above the matrix is diagonalisable.
Who escapes the hunter
The hunt doesn’t always succeed, and failures come in two kinds. A rotation escapes the hunter entirely, while a shear leaves less quarry than a basis needs.
Rotation: quarry in the complex plane
Rotation through the angle $\varphi$ has the matrix $\left(\begin{smallmatrix} \cos\varphi & -\sin\varphi \\ \sin\varphi & \cos\varphi \end{smallmatrix}\right)$, trace $2\cos\varphi$ and determinant $1$. The equation $\lambda^2 - 2\lambda\cos\varphi + 1 = 0$ has discriminant $4\cos^2\varphi - 4 = -4\sin^2\varphi$, negative for every angle except $0°$ and $180°$. The roots are complex:
$$\lambda = \cos\varphi \pm i\sin\varphi = e^{\pm i\varphi}.$$
In the chapter on complex numbers we saw that multiplication by $a + bi$ is a rotation with a stretch. Since $(a + bi)(x + yi) = (ax - by) + (bx + ay)i$, in the coordinates $(x, y)$ it’s written with the matrix $\left(\begin{smallmatrix} a & -b \\ b & a \end{smallmatrix}\right)$, and its eigenvalues are $a \pm bi$. It turns out that every real $2 \times 2$ matrix with complex eigenvalues looks like this in a suitable basis.
Let a real $2 \times 2$ matrix $A$ have non-real eigenvalues $\alpha \pm i\beta$, $\beta \ne 0$. Write $\alpha + i\beta = re^{i\varphi}$, that is, $\alpha = r\cos\varphi$, $\beta = r\sin\varphi$. Then in some basis of the plane the matrix of the transformation is
$$\begin{pmatrix} \alpha & -\beta \\ \beta & \alpha \end{pmatrix} = r\begin{pmatrix} \cos\varphi & -\sin\varphi \\ \sin\varphi & \cos\varphi \end{pmatrix},$$
that is, the transformation rotates through the angle $\varphi$ and stretches by a factor of $r$. It has no real eigendirections.
The idea: take a complex eigenvector and split it into real and imaginary parts, which give the basis we need. By the theorem on the characteristic polynomial (over $\mathbb C$), for $\lambda = \alpha + i\beta$ there’s an eigenvector $\mathbf w \in \mathbb C^2$, $\mathbf w \ne \mathbf 0$. Write $\mathbf w = \mathbf u + i\mathbf v$, where $\mathbf u$ and $\mathbf v$ are vectors with real coordinates. The matrix $A$ is real, so $A\mathbf w = A\mathbf u + iA\mathbf v$, and in this expression $A\mathbf u$, $A\mathbf v$ are real vectors. On the other hand, $\lambda\mathbf w = (\alpha + i\beta)(\mathbf u + i\mathbf v) = (\alpha\mathbf u - \beta\mathbf v) + i(\beta\mathbf u + \alpha\mathbf v)$. Comparing real and imaginary parts, we get $A\mathbf u = \alpha\mathbf u - \beta\mathbf v$ and $A\mathbf v = \beta\mathbf u + \alpha\mathbf v$.
The vectors $\mathbf u$ and $\mathbf v$ are linearly independent. Otherwise one of them is a multiple of the other, say $\mathbf v = c\,\mathbf u$ with real $c$ (the case $\mathbf u = c\,\mathbf v$ is the same). Then $\mathbf w = (1 + ic)\mathbf u$, and from $A\mathbf w = \lambda\mathbf w$, after dividing by $1 + ic \ne 0$, we get $A\mathbf u = \lambda\mathbf u$ with a real non-zero $\mathbf u$. But $A\mathbf u$ is a real vector, while $\lambda\mathbf u$ for $\beta \ne 0$ has the non-zero imaginary part $\beta\mathbf u$. A contradiction.
So $\mathbf v$, $\mathbf u$ is a basis of the plane. Write the matrix in it: $A\mathbf v = \alpha\mathbf v + \beta\mathbf u$ gives the first column $(\alpha, \beta)$, and $A\mathbf u = -\beta\mathbf v + \alpha\mathbf u$ the second column $(-\beta, \alpha)$. That’s the matrix from the statement. There can’t be a real eigenvector: its eigenvalue would be a real root of the characteristic polynomial, and both roots are non-real.
Example: $A = \left(\begin{smallmatrix} 1 & -1 \\ 1 & 1 \end{smallmatrix}\right)$ has eigenvalues $1 \pm i = \sqrt2\,e^{\pm i\pi/4}$. So $A$ rotates through $45°$ and stretches by a factor of $\sqrt2$, and eight such steps make a full turn: $A^8 = (\sqrt2)^8I = 16I$. There are eigenvectors too, only complex ones: $A\left(\begin{smallmatrix} 1 \\ -i \end{smallmatrix}\right) = \left(\begin{smallmatrix} 1 + i \\ 1 - i \end{smallmatrix}\right) = (1 + i)\left(\begin{smallmatrix} 1 \\ -i \end{smallmatrix}\right)$.
Over the complex numbers the hunter never goes home empty-handed: by the fundamental theorem of algebra the characteristic polynomial always has a root, so every square matrix has at least one eigenvalue and an eigenvector in $\mathbb C^n$.
Why every rotation of a ball has an axis
Let $A$ be a linear transformation of three-dimensional space that preserves the lengths of vectors and orientation ($\det A = 1$). Then there’s a non-zero vector $\mathbf n$ with $A\mathbf n = \mathbf n$: the transformation is a rotation about the axis $\mathbf n$.
The idea: work out what the eigenvalues can be, and see that $1$ must be among them. The characteristic polynomial of a $3 \times 3$ matrix has degree $3$ and real coefficients, and such a polynomial always has a real root: for large $|\lambda|$ it takes values of opposite signs, and a continuous function that changes sign passes through zero (the intermediate value theorem, chapter 25; a rigorous proof is in chapter 53). The other two roots are either real or a conjugate pair $\mu$, $\bar\mu$.
All the eigenvalues have absolute value $1$. For a real eigenvector this follows directly from $\|A\mathbf v\| = \|\mathbf v\|$ and $A\mathbf v = \lambda\mathbf v$. For a complex $\mathbf w = \mathbf u + i\mathbf v$ put $\|\mathbf w\|^2 = \|\mathbf u\|^2 + \|\mathbf v\|^2$; since $A\mathbf w = A\mathbf u + iA\mathbf v$ and $A$ preserves the lengths of $\mathbf u$ and $\mathbf v$, we get $\|A\mathbf w\| = \|\mathbf w\|$, while $A\mathbf w = \mu\mathbf w$ gives $\|A\mathbf w\| = |\mu|\,\|\mathbf w\|$, that is, $|\mu| = 1$.
The product of the three eigenvalues equals $\det A = 1$ (the statement about trace and determinant above). If there’s a conjugate pair, then $\mu\bar\mu = |\mu|^2 = 1$, and the third, real value is also $1$. If all three are real, they’re the numbers $\pm1$ with product $1$: either $1, 1, 1$ or $1, -1, -1$, and in both cases there’s a $1$. The eigenvector $\mathbf n$ with $\lambda = 1$ stays put, and the line through it is the axis. That’s how the modern language proves the theorem Euler obtained in 1775: any displacement of a rigid body with a fixed point is a rotation about some axis.
Shear: less quarry than needed
The shear $\left(\begin{smallmatrix} 1 & 1 \\ 0 & 1 \end{smallmatrix}\right)$ behaves differently. Its characteristic polynomial $(1 - \lambda)^2$ has the double root $\lambda = 1$, but the system $(A - I)\mathbf v = \mathbf 0$, that is, $\left(\begin{smallmatrix} 0 & 1 \\ 0 & 0 \end{smallmatrix}\right)\mathbf v = \mathbf 0$, leaves only the vectors with $y = 0$: one line. The root is counted twice, but there’s only one direction. There’s no basis of eigenvectors, and the matrix isn’t diagonalisable.
Here two notions of multiplicity part ways. The algebraic multiplicity of an eigenvalue is how many times it occurs among the roots of the characteristic polynomial. The geometric multiplicity is the dimension of its eigenspace. For the shear the algebraic multiplicity is $2$ and the geometric $1$. The geometric multiplicity is never larger than the algebraic one.
For any eigenvalue $\lambda_0$ of a matrix $A$, the dimension of the eigenspace doesn’t exceed the multiplicity of $\lambda_0$ as a root of the characteristic polynomial.
The idea: write the matrix in a basis that begins with eigenvectors, and then a factor $(\lambda_0 - \lambda)$ of the right power is visible in the determinant at once. Let $\mathbf v_1, \dots, \mathbf v_k$ be a basis of the eigenspace for $\lambda_0$, so that $k$ is the geometric multiplicity. Extend them to a basis of the whole space $\mathbf v_1, \dots, \mathbf v_n$ (chapter 37) and make these vectors the columns of a matrix $Q$. The matrix $A' = Q^{-1}AQ$ describes the same transformation in the new basis. The characteristic polynomial doesn’t change under a change of basis: $A' - \lambda I = Q^{-1}(A - \lambda I)Q$, the determinant of a product is the product of the determinants, and $\det Q^{-1}\det Q = 1$. The matrix only multiplies the first $k$ basis vectors by $\lambda_0$, so the first $k$ columns of $A'$ are $\lambda_0\mathbf e_1, \dots, \lambda_0\mathbf e_k$. In each of the first $k$ columns of the matrix $A' - \lambda I$ the only non-zero entry is $\lambda_0 - \lambda$ on the diagonal. Expanding the determinant along these columns in turn, we take out the factor $(\lambda_0 - \lambda)^k$: $\det(A - \lambda I) = (\lambda_0 - \lambda)^k\,g(\lambda)$, where $g$ is the determinant of the remaining block. So $\lambda_0$ is a root of multiplicity at least $k$.
An $n \times n$ matrix $A$ is diagonalisable over $\mathbb C$ if and only if for each of its eigenvalues the geometric multiplicity equals the algebraic multiplicity.
The idea: there are enough eigenvectors for a basis exactly when each eigenspace “makes up” its multiplicity. Let $A = PDP^{-1}$ with diagonal $D = \operatorname{diag}(d_1, \dots, d_n)$. As in the previous proof, the characteristic polynomials of $A$ and $D$ coincide, and for $D$ it’s $(d_1 - \lambda)\cdots(d_n - \lambda)$. So the algebraic multiplicity of a number $\mu$ is the number of indices $i$ with $d_i = \mu$. For each such $i$ the column $\mathbf p_i$ is an eigenvector with eigenvalue $\mu$, and the columns of $P$ are independent. So the geometric multiplicity is at least the algebraic one, and by the previous statement at most, so they’re equal.
Conversely, let the multiplicities coincide. By the fundamental theorem of algebra the algebraic multiplicities of all the eigenvalues add up to $n$, so the dimensions of the eigenspaces also add up to $n$. Take a basis of each eigenspace and put them together: we get $n$ vectors. They’re linearly independent. Suppose a linear combination of them is zero; group the terms by eigenvalue: $\mathbf w_1 + \dots + \mathbf w_m = \mathbf 0$, where $\mathbf w_j$ lies in the eigenspace of $\mu_j$. The non-zero $\mathbf w_j$ would be eigenvectors with different eigenvalues whose sum is zero, which contradicts the independence theorem. So all the $\mathbf w_j = \mathbf 0$, and within each group the coefficients are zero, because we took a basis of the subspace. We’ve got $n$ independent eigenvectors, a basis, and by the diagonalisation criterion the matrix is diagonalisable.
If the entries of a matrix are chosen at random, multiple roots almost certainly won’t occur, so non-diagonalisable matrices are the exception. But they turn up precisely where a system’s behaviour changes, for example on the boundary between oscillation and smooth decay (see the note below).
The matrices $\left(\begin{smallmatrix} 3 & 0 \\ 0 & 3 \end{smallmatrix}\right)$ and $\left(\begin{smallmatrix} 3 & 1 \\ 0 & 3 \end{smallmatrix}\right)$ have the same characteristic polynomial, $(\lambda - 3)^2$. Which of them is diagonalisable?
The first is already diagonal, and its eigenspace is the whole space. For the second the system $(A - 3I)\mathbf v = \mathbf 0$ gives one line, as for the shear. The characteristic polynomial doesn’t determine the matrix, and a double root isn’t yet a death sentence.
Fibonacci’s rabbits
The Fibonacci numbers $0, 1, 1, 2, 3, 5, 8, 13, \dots$, going back to the rabbit problem in the Liber Abaci (1202), obey the rule $F_{n+1} = F_n + F_{n-1}$ (chapter 13). To get the next number you have to remember the last two. Put them in a vector, and a step of the sequence becomes multiplication by a matrix:
$$\begin{pmatrix} F_{n+1} \\ F_n \end{pmatrix} = \begin{pmatrix} 1 & 1 \\ 1 & 0 \end{pmatrix}\begin{pmatrix} F_n \\ F_{n-1} \end{pmatrix}.$$
Call this matrix $M$. Starting from $(F_1, F_0) = (1, 0)$ and multiplying $n$ times, we get $(F_{n+1}, F_n) = M^n(1, 0)$ (at $n = 0$ this holds if we take $M^0 = I$). Along the way we get a pretty formula for the powers themselves.
For any natural $n$
$$M^n = \begin{pmatrix} F_{n+1} & F_n \\ F_n & F_{n-1} \end{pmatrix}.$$
Induction on $n$. At $n = 1$ the right side is $\left(\begin{smallmatrix} F_2 & F_1 \\ F_1 & F_0 \end{smallmatrix}\right) = \left(\begin{smallmatrix} 1 & 1 \\ 1 & 0 \end{smallmatrix}\right) = M$. Suppose the formula holds for $n$. Then $M^{n+1} = M^nM = \left(\begin{smallmatrix} F_{n+1} & F_n \\ F_n & F_{n-1} \end{smallmatrix}\right)\left(\begin{smallmatrix} 1 & 1 \\ 1 & 0 \end{smallmatrix}\right) = \left(\begin{smallmatrix} F_{n+1} + F_n & F_{n+1} \\ F_n + F_{n-1} & F_n \end{smallmatrix}\right)$, and by the Fibonacci rule $F_{n+1} + F_n = F_{n+2}$ and $F_n + F_{n-1} = F_{n+1}$. We’ve got the same formula for $n + 1$. For example, $M^{10} = \left(\begin{smallmatrix} 89 & 55 \\ 55 & 34 \end{smallmatrix}\right)$.
Let’s hunt. The trace of $M$ is $1$, the determinant $-1$, and the characteristic equation $\lambda^2 - \lambda - 1 = 0$. Its roots are the golden ratio and its “twin”:
$$\varphi = \frac{1 + \sqrt5}{2} \approx 1.618, \qquad \psi = \frac{1 - \sqrt5}{2} \approx -0.618.$$
The eigenvectors are $(\varphi, 1)$ and $(\psi, 1)$. Expanding the starting vector in them, we get the famous formula.
For any integer $n \ge 0$
$$F_n = \frac{\varphi^n - \psi^n}{\sqrt5}, \qquad \varphi = \frac{1 + \sqrt5}{2}, \quad \psi = \frac{1 - \sqrt5}{2}.$$
The idea: expand the starting vector along the two eigendirections. After that each multiplication by $M$ simply stretches both parts, each by its own factor.
The hundredth Fibonacci number no longer has to be dug out with ninety-nine additions: $F_{100}$ is the integer nearest to $\varphi^{100}/\sqrt5$, that is, $354{,}224{,}848{,}179{,}261{,}915{,}075$. True, for the rounding to be honest, $\varphi^{100}$ has to be computed to more than twenty digits. The formula is named after Jacques Binet, who published it in 1843, although Abraham de Moivre and Daniel Bernoulli knew it more than a hundred years before him.
The matrix view also gives unexpected identities.
For any natural $n$: $F_{n+1}F_{n-1} - F_n^2 = (-1)^n$.
Compute the determinant of $M^n$ in two ways. By the lemma $M^n = \left(\begin{smallmatrix} F_{n+1} & F_n \\ F_n & F_{n-1} \end{smallmatrix}\right)$, and its determinant is $F_{n+1}F_{n-1} - F_n^2$. On the other hand, the determinant of a product of matrices is the product of the determinants (areas multiply, chapter 35), so $\det M^n = (\det M)^n = (1 \cdot 0 - 1 \cdot 1)^n = (-1)^n$.
This identity was found by Giovanni Domenico Cassini in 1680. An old trick rests on it: an $8 \times 8$ square is cut into four pieces and reassembled into a $5 \times 13$ rectangle, and the area seems to grow from $64$ to $65$. The extra cell is smeared along a narrow, almost invisible gap along the diagonal of the rectangle: $5 \cdot 13 - 8^2 = 1$.
The Lucas numbers $2, 1, 3, 4, 7, 11, \dots$ obey the same rule but start with $L_0 = 2$, $L_1 = 1$. Their starting vector expands in the eigenvectors even more simply, and $L_n = \varphi^n + \psi^n$. Find $L_{10}$.
By addition: $2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123$. By the formula: $\varphi^{10} + \psi^{10} \approx 122.9919 + 0.0081 = 123$. This also shows why $\varphi^{10}$ is so close to an integer: only the tiny $\psi^{10}$ separates it from $L_{10}$.
Hunting without a trap: the power method
Look at the ratios of neighbouring Fibonacci numbers: $\frac21 = 2$, $\frac32 = 1.5$, $\frac53 \approx 1.667$, $\frac85 = 1.6$, $\frac{13}{8} = 1.625$, $\frac{21}{13} \approx 1.615$, $\frac{34}{21} \approx 1.619$. They converge to $\varphi$, and Binet’s formula explains why. In the vector $M^n(1, 0)$ the component along $(\psi, 1)$ shrinks compared with the main one as $(\psi/\varphi)^n \approx (-0.382)^n$, and the vector lies ever more precisely on the line $(\varphi, 1)$.
This observation works for any diagonalisable matrix with one eigenvalue strictly larger in absolute value than the rest. Expand the starting vector in eigenvectors: $\mathbf x = c_1\mathbf v_1 + c_2\mathbf v_2 + \dots$, where $|\lambda_1| > |\lambda_2| \ge \dots$. After $k$ multiplications
That’s how we get the power method: take almost any vector, multiply by $A$ again and again, normalising after each step, and its direction converges to the eigenvector with the eigenvalue of largest absolute value. $\lambda_1$ itself is obtained at the end as $\langle \mathbf x, A\mathbf x\rangle$ for a unit $\mathbf x$. The method was described by Richard von Mises and Hilda Pollaczek-Geiringer in 1929. It needs neither determinants nor polynomials, only multiplication of a matrix by a vector, so it works even for matrices with billions of rows.
Let a real $n \times n$ matrix $A$ be diagonalisable, $\mathbf v_1, \dots, \mathbf v_n$ a basis of its eigenvectors, and let the eigenvalues be ordered so that $|\lambda_1| > |\lambda_2| \ge |\lambda_3| \ge \dots \ge |\lambda_n|$. Let the starting vector $\mathbf x = c_1\mathbf v_1 + \dots + c_n\mathbf v_n$ have $c_1 \ne 0$, and $\mathbf x_k = A^k\mathbf x / \|A^k\mathbf x\|$. Then there’s a number $C$, independent of $k$, such that the distance from $\mathbf x_k$ to the nearer of the two unit vectors $\pm\mathbf v_1/\|\mathbf v_1\|$ is at most $C\,|\lambda_2/\lambda_1|^k$. Moreover, $\langle \mathbf x_k, A\mathbf x_k\rangle \to \lambda_1$.
The idea: in eigencoordinates multiplication by $A^k$ multiplies $c_i$ by $\lambda_i^k$, and compared with the first, all the other parts melt away as $|\lambda_i/\lambda_1|^k$. In the picture $n = 2$, $\lambda_1 = 2$, $\lambda_2 = 1$, so the ratio of the parts halves at each step.
Where the method breaks down can be seen from the same two cases as before. If the two leading eigenvalues are equal in absolute value, like $1$ and $-1$ for a reflection, no direction wins. If they’re complex, the fan spins for ever. And if $|\lambda_2/\lambda_1|$ is close to one, the method works in principle, but very slowly.
Repeat a linear process long enough, and all that’s left of it is the leading eigendirection. The rate at which everything else disappears is set by the ratio $|\lambda_2/\lambda_1|$.
Scooters spread across the city
A company rents out $600$ e-scooters. For the company the city splits into two zones: the centre and the outskirts. The statistics for the season are these: of the scooters that start the day in the centre, $90\,\%$ end it in the centre and $10\,\%$ go off to the outskirts. Of those parked in the outskirts, by evening half end up in the centre and half stay put. Where will the scooters be in a week if, after an all-night festival, all $600$ have gathered in the outskirts?
Write the shares of scooters in the centre and the outskirts as a vector $\mathbf p = (p_1, p_2)$. One day is multiplication by a matrix:
$$\mathbf p_{k+1} = P\,\mathbf p_k, \qquad P = \begin{pmatrix} 0.9 & 0.5 \\ 0.1 & 0.5 \end{pmatrix}.$$
Column $j$ records where the scooters from zone $j$ scatter in a day; each column adds up to $1$, because scooters don’t vanish. The expected number of scooters in the centre, day after day: $0$, $300$, $420$, $468$, $487.2$, $494.9$, and after that it closes in on $500$. The shortfall from $500$ is $500$, $200$, $80$, $32$, $12.8$, shrinking by a factor of exactly $2.5$ each day.
This is the power method in its pure form. The first eigenvalue of $P$ is $1$ (why, see below), the trace is $1.4$, so the second eigenvalue is $1.4 - 1 = 0.4$: exactly the factor the shortfall is multiplied by each day. And the limit is the eigenvector with $\lambda = 1$. The equation $P\boldsymbol\pi = \boldsymbol\pi$ comes down to a balance of flows, $0.1\,\pi_1 = 0.5\,\pi_2$: as many scooters leave the centre as arrive. Together with the condition $\pi_1 + \pi_2 = 1$ we get $\boldsymbol\pi = (5/6, 1/6)$: $500$ scooters in the centre and $100$ in the outskirts, whatever distribution we start from.
A process that moves from state to state in such a way that the probabilities of the next step depend only on the current state is called a Markov chain. The transition probabilities are written in the transition matrix $P$: the entry $p_{ij}$ is the probability of moving from state $j$ to state $i$. A distribution $\boldsymbol\pi$ with non-negative coordinates adding up to $1$ for which $P\boldsymbol\pi = \boldsymbol\pi$ is called a stationary distribution. It’s an eigenvector of the transition matrix with eigenvalue $1$.
For any transition matrix $P$ the number $1$ is an eigenvalue, and all its eigenvalues, including complex ones, have absolute value at most $1$.
The idea: the sum of the coordinates of a distribution doesn’t change, so nothing can grow. The columns of $P$ add up to $1$, so a row of ones doesn’t change when multiplied by $P$ on the right: $(1, \dots, 1)\,P = (1, \dots, 1)$. Transposing, we get $P^{\mathsf T}(1, \dots, 1) = (1, \dots, 1)$, that is, $1$ is an eigenvalue of the matrix $P^{\mathsf T}$. The determinant doesn’t change under transposition, so $\det(P^{\mathsf T} - \lambda I) = \det\bigl((P - \lambda I)^{\mathsf T}\bigr) = \det(P - \lambda I)$: $P$ and $P^{\mathsf T}$ have the same characteristic polynomial, and by the theorem on the characteristic polynomial $1$ is an eigenvalue of $P$ itself.
Now let $P\mathbf v = \lambda\mathbf v$ for a non-zero, possibly complex, vector $\mathbf v$. Compare the sums of the absolute values of the coordinates of both sides. On the left the $i$th coordinate is $\sum_j p_{ij}v_j$, and by the triangle inequality $\bigl|\sum_j p_{ij}v_j\bigr| \le \sum_j p_{ij}|v_j|$ (the entries $p_{ij}$ are non-negative). Adding over $i$ and changing the order of summation, we get $|\lambda|\sum_i |v_i| = \sum_i\bigl|\sum_j p_{ij}v_j\bigr| \le \sum_j |v_j|\sum_i p_{ij} = \sum_j |v_j|$, because $\sum_i p_{ij} = 1$. The sum $\sum_j |v_j|$ is positive; divide by it: $|\lambda| \le 1$.
As with the scooters, convergence to equilibrium is guaranteed if all the transition probabilities are positive. To prove it, we’ll measure the distance between distributions by the sum of the absolute values of the differences of the coordinates: $\|\mathbf y\|_1 = |y_1| + \dots + |y_n|$. The key is a single lemma.
Let all the entries of an $n \times n$ transition matrix $P$ be at least $\varepsilon > 0$. Then for any vector $\mathbf y$ whose coordinates add up to $0$, $\|P\mathbf y\|_1 \le (1 - n\varepsilon)\,\|\mathbf y\|_1$.
The idea: a vector with zero sum is the difference of two “heaps” of equal mass, and $P$ mixes the heaps, so in each row a common part of at least $\varepsilon$ cancels out. Split $\mathbf y = \mathbf y^+ - \mathbf y^-$, where $\mathbf y^+$ holds the positive coordinates of $\mathbf y$ (the others replaced by zeros) and $\mathbf y^-$ the absolute values of the negative ones. The coordinates of $\mathbf y$ add up to zero, so $\sum_j y^+_j = \sum_k y^-_k = s$, and $\|\mathbf y\|_1 = 2s$. If $s = 0$, there’s nothing to prove. Write the columns of $P$ as $\mathbf P_1, \dots, \mathbf P_n$; then $P\mathbf y = \sum_j y^+_j\mathbf P_j - \sum_k y^-_k\mathbf P_k$. Each term can be “spread” over the pairs $(j, k)$, because $\sum_k y^-_k/s = 1$ and $\sum_j y^+_j/s = 1$:
$$P\mathbf y = \frac1s\sum_{j,k} y^+_j\,y^-_k\,(\mathbf P_j - \mathbf P_k).$$
By the triangle inequality $\|P\mathbf y\|_1 \le \frac1s\sum_{j,k} y^+_jy^-_k\,\|\mathbf P_j - \mathbf P_k\|_1 \le \frac1s \cdot s^2 \cdot \max_{j,k}\|\mathbf P_j - \mathbf P_k\|_1$. It remains to estimate the distance between two columns. For non-negative numbers $|a - b| = a + b - 2\min(a, b)$, so $\|\mathbf P_j - \mathbf P_k\|_1 = \sum_i (p_{ij} + p_{ik}) - 2\sum_i \min(p_{ij}, p_{ik}) = 2 - 2\sum_i \min(p_{ij}, p_{ik}) \le 2 - 2n\varepsilon$: each of the $n$ minima is at least $\varepsilon$. Putting it together, $\|P\mathbf y\|_1 \le s\,(2 - 2n\varepsilon) = (1 - n\varepsilon)\|\mathbf y\|_1$.
Let all the entries of an $n \times n$ transition matrix $P$ be at least $\varepsilon > 0$, and $q = 1 - n\varepsilon$. Then a stationary distribution $\boldsymbol\pi$ exists and is unique, all its coordinates are at least $\varepsilon$, and for any starting distribution $\mathbf p$ we have $\|P^k\mathbf p - \boldsymbol\pi\|_1 \le 2q^k$.
The idea: the matrix $P$ maps the set of all distributions inside itself, and each application shrinks everything by a factor of at least $1/q$. The images, nested inside one another, shrink to a single point, and that point is $\boldsymbol\pi$. The picture is for three states.
For the scooters the smallest entry of $P$ is $0.1$, there are two states, and the theorem guarantees a factor of $q = 1 - 2 \cdot 0.1 = 0.8$ per day. In fact the shortfall shrank faster, by a factor of $0.4$: that’s the second eigenvalue. The lemma gives an estimate that works for every positive matrix at once, while the exact rate is set by $|\lambda_2|$.
In books on probability and in chapter 50 the transition matrix is usually written transposed, so that the rows add up to one, and the distribution is written as a row: $\boldsymbol\pi P = \boldsymbol\pi$. It’s the same eigenvector problem, only the multiplication is on the left. Andrei Markov began studying such chains in 1906, and how he tested them on the text of Eugene Onegin is told in that chapter.
Another company works in two districts, $A$ and $B$. In a day $30\,\%$ of the scooters in $A$ go to $B$, and $20\,\%$ of the scooters in $B$ go to $A$. What share of all the scooters will be in district $A$ after many days? Give the answer as a fraction or a decimal.
The transition matrix is $P = \left(\begin{smallmatrix} 0.7 & 0.2 \\ 0.3 & 0.8 \end{smallmatrix}\right)$. The balance of flows: $0.3\,\pi_A = 0.2\,\pi_B$, that is, $\pi_B = 1.5\,\pi_A$. Together with $\pi_A + \pi_B = 1$ we get $\pi_A = 0.4$. The second eigenvalue is $\operatorname{tr}P - 1 = 0.5$, so the deviation from equilibrium halves every day.
You can get your hand in with eigenvalues, eigenvectors and Markov chains in the trainer. And the solver will take a matrix of your own apart step by step.
How Google ranked the pages
In 1998 two Stanford graduate students, Sergey Brin and Larry Page, published the paper The Anatomy of a Large-Scale Hypertextual Web Search Engine, and in the autumn of the same year they founded Google. One of the paper’s main ideas was PageRank, a way of judging the importance of a page by the links to it. A page is important if important pages link to it. The definition looks like a vicious circle, but in fact it’s an equation for an eigenvector.
Let page $j$ have $L_j$ outgoing links. It shares its importance $r_j$ equally among the pages it links to, and each gets $r_j/L_j$. A page’s importance is the sum of everything it receives:
$$r_i = \sum_{j \to i} \frac{r_j}{L_j}, \qquad \text{that is,} \qquad \mathbf r = M\mathbf r,$$
where column $j$ of the matrix $M$ has the numbers $1/L_j$ opposite the pages that $j$ links to, and zeros elsewhere. The columns of $M$ add up to $1$, so this is the transition matrix of a Markov chain, and $\mathbf r$ is its stationary distribution. It has a vivid meaning: it’s the share of time spent on each page by a random surfer who clicks random links for ever.
Three pages
Let $A$ link to $B$ and $C$, $B$ to $C$, and $C$ to $A$. The equations: $r_A = r_C$, $r_B = \frac12 r_A$, $r_C = \frac12 r_A + r_B$. The solution adding up to $1$: $\mathbf r = (0.4, 0.2, 0.4)$. Two pages link to $C$ and only one to $A$, yet they’re equally important: the only link to $A$ comes from the weightiest page.
With the real internet it’s not so simple. There are pages with no outgoing links, and the random surfer gets stuck on them. There are groups of pages that link only to one another: like a trap, they gradually take all the importance for themselves. And if the web falls into unconnected pieces, there are many stationary distributions. Brin and Page fixed all this with a single trick: with probability $d$ the surfer clicks a random link, and with probability $1 - d$ gets bored and opens a random page out of all $N$. The paper says that $d = 0.85$ is usually taken. From a page with no links we’ll assume the surfer always jumps to a random one, which is what’s usually done.
Why does this equation have a solution, and a unique one? We already have the answer in hand. The matrix $G$ is a transition matrix: the columns of $M$ add up to $1$ (from a page with no links the surfer goes to any of the $N$ with probability $1/N$), so do the columns of $\frac1N J$, and $d + (1 - d) = 1$. Moreover, all the entries of $G$ are at least $\varepsilon = \frac{1 - d}{N}$. By the theorem on the stationary distribution of a positive chain with $n = N$ we get $q = 1 - N\varepsilon = d$: the ranking exists and is unique, each page gets a weight of at least $\frac{1 - d}{N}$, and the power method converges, with error after $k$ steps at most $2d^k$. At $d = 0.85$, after $50$ iterations that’s $2 \cdot 0.85^{50} \approx 6 \cdot 10^{-4}$. And $G$ can be multiplied by a vector in a single pass through the list of links, even when there are billions of pages.
Our theorem on positive chains is a special case of a general result about matrices with positive entries.
If all the entries of a square matrix are positive, it has a positive eigenvalue $\rho$ that’s strictly larger than the absolute value of any other eigenvalue. It’s a simple root of the characteristic polynomial, and it has an eigenvector with all coordinates positive.
The perfect quarry: symmetric matrices
Back to the curve $5x^2 + 4xy + 2y^2 = 6$. Its left side is a quadratic form, a homogeneous polynomial of degree two in the coordinates. Any such form can be written with a symmetric matrix:
$$5x^2 + 4xy + 2y^2 = \begin{pmatrix} x & y \end{pmatrix}\begin{pmatrix} 5 & 2 \\ 2 & 2 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix} = \langle \mathbf x, S\mathbf x\rangle.$$
The coefficient of $xy$ is split equally between the two off-diagonal cells: $4xy = 2xy + 2yx$. A matrix that doesn’t change under transposition ($S^{\mathsf T} = S$) is called symmetric. With such matrices the hunt always succeeds.
Let’s start with the plane, where everything can be seen in a picture. For a symmetric matrix $S$ it’s convenient to look at the function $Q(\mathbf x) = \langle \mathbf x, S\mathbf x\rangle$ on the unit circle: as we’ll see, its largest and smallest values are the eigenvalues.
Let $S = \left(\begin{smallmatrix} a & b \\ b & c \end{smallmatrix}\right)$ be a real symmetric matrix and $Q(\mathbf x) = \langle \mathbf x, S\mathbf x\rangle$. Then $S$ has two perpendicular eigenvectors $\mathbf u_1$, $\mathbf u_2$ of length $1$, their eigenvalues are real, and $\lambda_1 = \max Q$, $\lambda_2 = \min Q$, where the maximum and minimum are taken over all vectors of length $1$.
The idea: find the point on the unit circle where the form $Q$ is largest, and notice that there its gradient points along the radius. And that’s exactly what $S\mathbf u \parallel \mathbf u$ means.
In any dimension the argument is the same, only the circle becomes a sphere, and the move to the perpendicular direction becomes an induction.
All the eigenvalues of a real symmetric $n \times n$ matrix $S$ are real, and there’s an orthonormal basis of $\mathbb R^n$, $n$ pairwise perpendicular vectors of length $1$, made of its eigenvectors. In other words, $S = UDU^{\mathsf T}$, where $D$ is diagonal and the columns of $U$ are this basis.
The idea: an eigenvector gives the maximum of the form on the sphere, and the matrix $S$ doesn’t let the subspace perpendicular to it out, so the same can be repeated there.
Matrices with orthonormal columns are called orthogonal; more about them in chapter 39. For $2 \times 2$ the reality of the eigenvalues can be seen without any maxima: the discriminant of the characteristic polynomial of $S = \left(\begin{smallmatrix} a & b \\ b & c \end{smallmatrix}\right)$ is $(a + c)^2 - 4(ac - b^2) = (a - c)^2 + 4b^2 \ge 0$.
In our example the trace is $7$, the determinant $6$, the eigenvalues $6$ and $1$, and the eigenvectors $(2, 1)$ and $(1, -2)$ are perpendicular, as promised: $2 \cdot 1 + 1 \cdot (-2) = 0$. Draw new axes $X$ and $Y$ along the unit vectors $\frac{1}{\sqrt5}(2, 1)$ and $\frac{1}{\sqrt5}(1, -2)$. In these coordinates the matrix is diagonal, the product $XY$ disappears, and the form becomes a sum of squares.
The lines along the eigenvectors of a symmetric matrix are called the principal axes of the quadratic form. The signs of the eigenvalues tell at once what kind of curve we have.
Let $S$ be a symmetric $2 \times 2$ matrix with eigenvalues $\lambda_1 \ge \lambda_2$, and $c > 0$. The set $\langle \mathbf x, S\mathbf x\rangle = c$ is an ellipse if $\lambda_2 > 0$; a hyperbola if $\lambda_1 > 0 > \lambda_2$; a pair of parallel lines if $\lambda_1 > 0 = \lambda_2$; the empty set if $\lambda_1 \le 0$. In particular, when $\det S < 0$ it’s always a hyperbola.
In the coordinates $X$, $Y$ along orthonormal eigenvectors (they exist by the spectral theorem) the equation takes the form $\lambda_1X^2 + \lambda_2Y^2 = c$. The move to these coordinates is a rotation, perhaps together with a reflection: it preserves distances, and so the shape of the curve. If both $\lambda$’s are positive, it’s the ellipse $\frac{X^2}{c/\lambda_1} + \frac{Y^2}{c/\lambda_2} = 1$ with semi-axes $\sqrt{c/\lambda_1}$ and $\sqrt{c/\lambda_2}$ (chapter 24). If $\lambda_1 > 0 > \lambda_2$, we get the hyperbola $\frac{X^2}{c/\lambda_1} - \frac{Y^2}{c/|\lambda_2|} = 1$. If $\lambda_2 = 0 < \lambda_1$, what’s left is $X^2 = c/\lambda_1$: two lines $X = \pm\sqrt{c/\lambda_1}$, parallel to the $Y$-axis. And if $\lambda_1 \le 0$, the left side is nowhere positive and can’t equal $c$. The last statement follows from the equation $\lambda_1\lambda_2 = \det S$: a negative determinant means the eigenvalues have opposite signs.
For our curve $\det S = 5 \cdot 2 - 2^2 = 6 > 0$ and the trace is $7 > 0$, so both eigenvalues are positive: an ellipse, just as we found.
The picture from the proof also works as a tool for finding the axes. The normal to the curve $\langle \mathbf x, S\mathbf x\rangle = 6$ at a point $\mathbf x$ points along the gradient, and the gradient of a quadratic form is $2S\mathbf x$ (chapter 32). The ends of the axes are the points where the radius vector is perpendicular to the curve, that is, points along the normal: $S\mathbf x \parallel \mathbf x$, the eigenvector equation again. For an ellipse the length of the radius is largest and smallest at these points.
Principal axes turn up wherever there’s a symmetric matrix. For a rigid body they’re the axes of inertia: any body, be it a book or a space station, has three mutually perpendicular axes about which it can spin without wobbling. They’re the eigenvectors of a symmetric matrix called the inertia tensor. Rotation about the axes with the largest and smallest moments of inertia is stable, but about the middle one it isn’t. Toss a book held shut with a rubber band, spinning it about each of the three axes in turn: in one of the three cases it starts to tumble. In 1985 the cosmonaut Vladimir Dzhanibekov noticed aboard the Salyut 7 station that a wing nut spinning in weightlessness flips over at regular intervals. Since then this has been called the Dzhanibekov effect, or the tennis racket theorem.
Where next
Take a cloud of points, for example the heights and weights of a thousand people, and try to draw through it the line that describes it best. The points don’t lie on a line: the system “all the points on one line” is inconsistent, and no solution fits exactly. Which approximation counts as the best? The answer will again lead to a symmetric matrix and its eigenvectors. And a rectangular matrix has no eigenvectors at all: it takes vectors from one space to another, and $A\mathbf v$ can’t even be compared with $\mathbf v$. What takes their place, and how it’s used to compress photographs, is the subject of chapter 39.