Eigenvalues, eigenvectors and diagonalization

A matrix stretches, shears and turns the plane. Even so, some arrows keep their direction. Turn an arrow and find them yourself.

Short answer. When a matrix changes the plane, most arrows get turned. An arrow that keeps its direction (stays on the same line) is an eigenvector, and how many times longer it gets is the eigenvalue. As a formula: A v = λ v.

Matrix A = a b / c d

v = ( , )

Drag the tip of the green arrow v to turn it, or change the numbers. The orange arrow is A v. The gray line is the line v sits on. When A v lands on that line, v is an eigenvector. The lab says "Found it" when the angle gap is under 3° and v is close to a real eigen direction. The small pairs of arrows in the background show many directions u on a circle (green) and A u (orange). Pairs that sit on one line are drawn darker. That is an eigen direction. The purple dots are the result of "Apply A many times."

Definitions

The text below uses 2×2 matrices, but the definitions are the same for n×n matrices. A is an n×n matrix and I is the n×n identity matrix.

eigenvalue, eigenvector
If a non-zero vector v and a scalar λ satisfy the equation below, λ is called an eigenvalue of A, and v is called an eigenvector of A for λ.

A𝐯=λ𝐯,𝐯≠0

characteristic equation
The equation in λ below. The left side det(A − λI) is a polynomial of degree n in λ, called the characteristic polynomial. λ is an eigenvalue of A exactly when λ is a root of this equation.

det(A−λI)=0

eigenspace
For a real eigenvalue λ, the set of all eigenvectors for λ together with the zero vector. In other words, it is the set of all solutions of (A − λI)v = 0, and it is a subspace of ℝⁿ.

Eλ={𝐯∈ℝn∣(A−λI)𝐯=0}

diagonalization
If there are an invertible n×n matrix P and a diagonal matrix D such that the equation below holds, A is called diagonalizable. Then the columns of P are eigenvectors of A, and the diagonal entries of D are the matching eigenvalues. A is diagonalizable exactly when A has n linearly independent eigenvectors.

A=PDP−1,D=[λ1⋱λn]

1. Eigenvectors: arrows that keep their direction

A matrix A takes an arrow v and gives back a new arrow A v (the "plan for changing the plane" from the determinant page). Usually A v points somewhere else. On the first screen of the lab above, v = (1, 0) goes to A v = (2, 1), turned by 26.6°.

Some directions do not turn, though. A v stays on the same line as v, and only the length changes. Such an arrow is an eigenvector. How many times longer it gets is the eigenvalue. The eigenvalue is usually written with the Greek letter λ (lambda).

Try this. In "Symmetric" (2 1 / 1 2): ① Set v to (1, 1). Then A v = (3, 3). Same line, 3 times as long, so λ = 3. ② Set v to (1, −1). Then A v = (1, −1). Nothing changes, so λ = 1. ③ Set v to (−2, −2). Then A v = (−6, −6). The length and sign are different, but it is the same line, so λ is still 3. ④ Turn on "Show answer." The two dashed lines pass through the background pairs where green and orange sit on one line.

2. The formula: A v = λ v and the characteristic equation

Written as a formula, the definition is:

A𝐯=λ𝐯(v is a non-zero vector, λ is a single number)

The left side is "multiply by a matrix." The right side is "multiply by one number." In this direction, the matrix acts like a single number.

To find λ, move everything to one side. I is the matrix that changes nothing, 1 0 / 0 1 (the identity matrix).

A𝐯−λ𝐯=0⟹(A−λI)𝐯=0

So the matrix A − λI sends a non-zero v to 0. That can only happen if it squashes the plane flat onto a line (or a point). Squashed flat means the determinant is 0. So:

det(A−λI)=|a−λbcd−λ|=(a−λ)(d−λ)−bc=0

Multiply it out and you get the characteristic equation of a 2×2 matrix:

λ2−(a+d)λ+(ad−bc)=0

Section 3, How the formula is built, walks through these steps one at a time with pictures.

It is a quadratic equation in λ. The quadratic formula gives λ = ( (a + d) ± √((a + d)² − 4(ad − bc)) ) ÷ 2. The value under the square root (the discriminant) gives three cases.

Value under the rootEigenvaluesIn the picture
More than 0Two different real numbersTwo eigen directions (Symmetric, 2× across 0.5× up, Flip)
0One real number, counted twiceOne eigen direction (Shear) or every direction (Double)
Less than 0Two complex numbersNo real direction stays on its line (Rotate 90°)

3. How the formula is built: the characteristic equation

Here is how the characteristic equation from section 2 comes out of A v = λ v, one step at a time. The matrix is the lab's first matrix, "Symmetric," A = 2 1 / 1 2. Press "Next" and a piece is added to the formula at the top (the orange background marks the new piece), the picture changes by that much, and the reason appears below.

Steps 1 and 2 on the left use the same colors as the lab above: green v, orange A v, and purple for the λ v that goes back. From step 3 it is the same kind of picture as on the determinant page: the plane after A − λI changes it. The gray dashed square (area 1) lands on the shaded parallelogram, and the faint lines are the changed grid. An orange parallelogram means the plane is flipped over (the determinant is negative). The graph on the right has λ across and the determinant det(A − λI) going up. The λ slider and number box work in steps 4 and 5.

Written only as equations, the steps above look like this.

A𝐯=λ𝐯,𝐯≠0

A𝐯−λI𝐯=0⟹(A−λI)𝐯=0

(A−λI)𝐯=0 has a solution 𝐯≠0⟺det(A−λI)=0

det(A−λI)=|a−λbcd−λ|=(a−λ)(d−λ)−bc

(a−λ)(d−λ)−bc=λ2−(a+d)λ+(ad−bc)=0

A=[2112]:λ2−4λ+3=(λ−1)(λ−3)=0⟹λ=1,3

  1. The definition: A v = λ v. With v = (1, 1), A v = (3, 3) = 3 × (1, 1), so λ = 3. But that is plugging in an answer we already knew. At the start you know neither the two entries of v nor λ, and λ v multiplies two unknowns, so you cannot solve it directly. The goal is to get v out of the formula.
  2. Move it to one side: (A − λI) v = 0. Move λ v to the left and you get A v − λ v = 0. You cannot take a number λ away from a matrix A, so write λ v as λI v. λI = λ 0 / 0 λ is the matrix that makes any arrow λ times as long. Now both terms are "a matrix times v," so you can pull v out. With λ = 3, A − 3I = −1 1 / 1 −1 and (A − 3I)(1, 1) = (−1 + 1, 1 − 1) = (0, 0). In the picture, go forward by A v, come back by 3v, and you are back where you started (0).
  3. Squashed flat means area 0: det(A − λI) = 0. A matrix always sends 0 to 0. But A − 3I also sends the non-zero v = (1, 1) to 0. Then for any point, the part along v disappears and only the part along one other direction is left, so the whole plane is squashed onto one line (or a point). In the picture, the far corner (1, 1) of the square moves to the origin, and the square becomes a line segment. The determinant is how many times the area grows, so the determinant is 0: (−1)×(−1) − 1×1 = 0. The other way around works too: if the determinant is 0, the two columns lie on one line, so you can always find a non-zero v that goes to 0. So "there is a non-zero v" means the same thing as "det(A − λI) = 0," and v drops out of the formula.
  4. Move λ and measure the area: det(A − λI) = (a − λ)(d − λ) − bc. A − λI is A with λ taken away only on the diagonal entries a and d: (a − λ) b / c (d − λ). Put it into the 2×2 determinant, "top left × bottom right − top right × bottom left," and you get this formula. The value changes with λ, so we draw a graph with λ across and this value going up. At λ = 0 it is A itself, so 3. At λ = 2, A − 2I = 0 1 / 1 0 flips the plane over, so −1. At λ = 1 and λ = 3 it is 0.
  5. Multiply it out: λ² − (a + d)λ + (ad − bc) = 0. Since (a − λ)(d − λ) = ad − aλ − dλ + λ², you get det(A − λI) = λ² − (a + d)λ + (ad − bc). The λ that make this 0 are the eigenvalues, and that is the characteristic equation. For this matrix it is λ² − 4λ + 3 = (λ − 1)(λ − 3), and the parabola meets the flat axis at λ = 1 and λ = 3, the eigenvalues. You can read more off the graph. Its height at λ = 0 is ad − bc, the determinant of A (3). If you write the parabola with its two roots as (λ − λ₁)(λ − λ₂) = λ² − (λ₁ + λ₂)λ + λ₁λ₂ and compare, the two roots add up to a + d and multiply to ad − bc (the first two rows of "Properties worth knowing"). If the parabola only touches the axis, the root is repeated. If it never reaches the axis, there is no real root and the eigenvalues are complex (the table in section 2).

Try this. In step 4, type numbers into the λ box. ① At λ = 0, A − λI is just A, and the determinant is 3. ② At λ = 2, A − 2I = 0 1 / 1 0. The parallelogram turns orange (flipped) and the determinant is −1. ③ At λ = 1, A − I = 1 1 / 1 1. The plane is squashed onto the line y = x, and the direction (1, −1) goes to 0. That is the eigen direction for λ = 1. ④ At λ = 3, the plane is squashed onto the line y = −x, and the direction (1, 1) goes to 0.

4. Work it out by hand: 2 1 / 1 2

Let's solve the "Symmetric" matrix from the lab, A = 2 1 / 1 2 (top row 2 1, bottom row 1 2), from the start.

  1. Find two numbers. The diagonal sum a + d = 2 + 2 = 4. The determinant ad − bc = 2×2 − 1×1 = 3.
  2. Put them in the characteristic equation. λ² − 4λ + 3 = 0. Factor it: (λ − 3)(λ − 1) = 0. So λ = 3 and λ = 1.
  3. The eigenvector for λ = 3. A − 3I = −1 1 / 1 −1. The first row of (A − 3I) v = 0 says −x + y = 0, so y = x. That gives v = (1, 1). Check: A (1, 1) = (2 + 1, 1 + 2) = (3, 3) = 3 × (1, 1).
  4. The eigenvector for λ = 1. A − I = 1 1 / 1 1. The first row says x + y = 0, so y = −x. That gives v = (1, −1). Check: A (1, −1) = (2 − 1, 1 − 2) = (1, −1) = 1 × (1, −1).
  5. Check the answer. The sum of the eigenvalues 3 + 1 = 4 equals the diagonal sum, and the product 3 × 1 = 3 equals the determinant. The two eigenvectors give (1, 1) · (1, −1) = 1 − 1 = 0, so they are at a right angle.

Written as equations, the same solution looks like this.

det(A−λI)=|2−λ112−λ|=(2−λ)2−1=λ2−4λ+3=(λ−3)(λ−1)=0

λ1=3:(A−3I)𝐯=[−111−1][xy]=[00]⟹y=x,𝐯1=[11]

λ2=1:(A−I)𝐯=[1111][xy]=[00]⟹y=−x,𝐯2=[1−1]

A𝐯1=[2112][11]=[33]=3𝐯1,A𝐯2=[1−1]=1𝐯2

λ1+λ2=4=a+d,λ1λ2=3=ad−bc,𝐯1·𝐯2=1·1+1·(−1)=0

In equations, (1, 1) is written standing up, as a column. It is the same arrow.

Press "Symmetric" in the lab and turn on "Show answer." You get the same result.

5. Properties worth knowing

PropertyFor 2 1 / 1 2
Add up all the eigenvalues and you get the diagonal sum (a + d)3 + 1 = 4 = 2 + 2
Multiply all the eigenvalues and you get the determinant (ad − bc). So if one eigenvalue is 0, the determinant is 0 too3 × 1 = 3 = 4 − 1
Multiply an eigenvector by any non-zero number and you get an eigenvector with the same eigenvalue(2, 2) and (−1, −1) also have λ = 3
A 2×2 matrix has at most two eigenvalues (the characteristic equation is quadratic). An n×n matrix has at most n3 and 1
A symmetric matrix (b = c) always has real eigenvalues, and you can pick its eigenvectors at right angles to each other(1, 1) and (1, −1) are at a right angle

Each time you change the matrix, the lab's readout checks the first two properties for you.

6. Negative, zero, repeated, complex

Negative. If λ is negative, A v is on the same line as v but points the other way. The length is multiplied by the absolute value of λ. "Flip" (−1 0 / 0 1) turns the across direction around (λ = −1).

Zero. If λ = 0, arrows in that direction are squashed to 0 and disappear. The plane has been pressed flat onto a line (or a point), so the determinant is 0, there is no matrix that undoes it (no inverse), and the rank drops below 2. The other way around works too: if the determinant is 0, one of the eigenvalues must be 0 (because their product is the determinant).

Repeated. This is when both roots of the characteristic equation are the same. There are two kinds. "Shear" (1 1 / 0 1) has λ = 1 twice, but there is only one eigen direction, across (1, 0). "Double" (2 0 / 0 2) has λ = 2 twice, and every direction is an eigen direction. Any arrow keeps its direction and just gets twice as long.

Complex. "Rotate 90°" (0 −1 / 1 0) turns every arrow by 90°. No direction stays on its line. The characteristic equation is λ² + 1 = 0, which has no real answer. The answers are the complex numbers λ = ±i. The picture on this page only shows real directions.

Try this. ① In "Flip," v = (1, 0) gives A v = (−1, 0). Same line, other side, so λ = −1. ② Type 1 2 / 0.5 1 into the number boxes. The eigenvalues are 2 and 0. Set v = (2, −1) and A v becomes (0, 0). ③ In "Rotate 90°," wherever you turn v, A v is 90° off. ④ Compare the background arrows in "Shear" and "Double." In "Shear," only the pairs pointing across sit on one line. In "Double," every pair does.

7. Diagonalization: using eigenvectors as the base arrows

As you saw in basis and change of coordinates, the same arrow gets different coordinates depending on which base arrows you measure it with. If you use the eigenvectors as base arrows, the matrix becomes very simple. All it does is stretch each base direction by some amount. Writing a matrix as "change base, then stretch each direction, then change back" is called diagonalization.

A=PDP−1

When you apply it to v, read it from the right. Follow v = (1, 0) through it.

  1. P⁻¹ v = (0.5, 0.5). These are the coordinates in eigenvectors. It means v = 0.5 × (1, 1) + 0.5 × (1, −1).
  2. Multiply by D to get (1.5, 0.5). The first direction is stretched 3 times, the second 1 time.
  3. Multiply by P to get 1.5 × (1, 1) + 0.5 × (1, −1) = (2, 1). Back in normal coordinates, and the same as A v.

The payoff is powers. A³ = P D³ P⁻¹, and for D³ = 27 0 / 0 1 you only cube the numbers on the diagonal. So A³ (1, 0) = 0.5 × 27 × (1, 1) + 0.5 × 1 × (1, −1) = (14, 13).

When does it work? A 2×2 matrix can be diagonalized when it has two different eigen directions. That is always true when the eigenvalues are different. It is also always true for symmetric matrices. "Shear" cannot be diagonalized because it has only one eigen direction. "Rotate 90°" cannot be diagonalized with real numbers.

8. Apply it many times and the largest eigenvalue wins

Look at the math above again: Aᵏ (1, 0) = 0.5 × 3ᵏ × (1, 1) + 0.5 × 1ᵏ × (1, −1). The (1, 1) part grows 3 times with every multiplication. The (1, −1) part stays the same. After only a few steps, the (1, 1) part is much bigger, so the arrow leans toward the direction of the eigenvalue with the largest size. After 3 steps it is already (14, 13).

Finding the eigenvector of the largest eigenvalue this way is called power iteration. It works even for huge matrices, as long as you can multiply by them. You need one eigenvalue to be strictly the largest in size, and the starting arrow needs at least a tiny part in that direction.

Try this. "Apply A many times" multiplies v by A 8 times. It resizes the lengths to fit the screen and only shows the direction. ① "Symmetric," v = (1, 0): the purple dots gather toward (1, 1). ② "2× across, 0.5× up," v = (1, 1): they quickly gather toward across, (1, 0). ③ "Shear," v = (0, 1): they slowly move toward (1, 0), the only direction. ④ "Flip," v = (1, 1): the eigenvalues 1 and −1 have the same size, so nothing wins and the dots jump between two places. ⑤ "Rotate 90°": they keep going around four places.

Where is it used?

Only square matrices have eigenvectors. If a matrix is not square, v and A v have a different number of entries, so they cannot sit on the same line. The singular value decomposition (SVD) takes a similar idea and makes it work for any matrix.

Common questions

What are eigenvectors and eigenvalues?

An eigenvector is a non-zero arrow that keeps its direction (stays on the same line) when you apply the matrix. The eigenvalue is how many times longer it gets. As a formula: A v = λ v.

How do you find eigenvalues?

For a 2×2 matrix a b / c d, solve the quadratic equation λ² − (a + d)λ + (ad − bc) = 0. Then for each λ, solve (A − λI) v = 0 to get the eigenvectors.

What does a negative or zero eigenvalue mean?

If it is negative, arrows in that direction end up on the same line but pointing the other way. If it is 0, arrows in that direction are squashed to 0 and disappear. In that case the determinant is 0 too.

Does every matrix have eigenvectors?

Only square matrices have them. Even a square matrix may have no eigenvectors among real directions, like a matrix that rotates the plane. In that case the eigenvalues are complex numbers.

Why diagonalize a matrix?

If you use the eigenvectors as your base arrows, the matrix only says "stretch each direction by some amount," so the math gets easy. In particular, applying A many times turns into multiplying the eigenvalues many times.

Words

Word used hereWord used in textbooks
arrow that keeps its directioneigenvector
how many times longereigenvalue. Usually written λ
eigen direction (the line)eigenspace
the quadratic equation for the eigenvaluescharacteristic equation
diagonal sum a + dtrace. Written tr A
the matrix I that changes nothingidentity matrix
eigenvalue counted twicerepeated eigenvalue
matrix without enough eigen directions to diagonalizedefective matrix
writing a matrix with eigenvectors as the basediagonalization. A = P D P⁻¹
matrix with numbers only on the diagonaldiagonal matrix
matrix with b = csymmetric matrix
multiplying many times to find the biggest directionpower iteration, power method
eigenvalue that is not a real numbercomplex eigenvalue

← Linear transformationsOrthogonal matrices and inner product spaces →