TExcelTAD
Home › Linear Algebra & Matrix Theory › Eigenvectors and Eigenvalues

Eigenvectors and Eigenvalues

Most vectors change direction when a matrix acts on them. A few special ones only get longer, shorter or flipped. These are the eigenvectors, and the stretch factors are the eigenvalues. They show how a matrix behaves when you apply it over and over, and they are behind PageRank, vibration analysis, PCA and the stability of simulations.

The definition

Let AA be an n×nn \times n matrix. A nonzero vector v\mathbf{v} is an eigenvector of AA if

Av=λvfor some scalar λA\mathbf{v} = \lambda\mathbf{v} \qquad \text{for some scalar } \lambda

The scalar λ\lambda is the eigenvalue that belongs to v\mathbf{v}. In words: AA sends v\mathbf{v} to a multiple of itself, so v\mathbf{v} stays on its own line through the origin.

Two details matter:

  • v=0\mathbf{v} = \mathbf{0} is never an eigenvector. A⋅0=λ⋅0A \cdot \mathbf{0} = \lambda \cdot \mathbf{0} holds for every λ\lambda, which would make every number an eigenvalue.
  • λ=0\lambda = 0 is allowed. Av=0⋅v=0A\mathbf{v} = 0 \cdot \mathbf{v} = \mathbf{0} just says that v\mathbf{v} is in the null space of AA (see Column Space, Row Space and Null Space).

Take A=[2112]A = \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix}:

A(1,1)=(2+1,1+2)=(3,3)=3⋅(1,1)eigenvector, λ=3A(1,−1)=(2−1,1−2)=(1,−1)=1⋅(1,−1)eigenvector, λ=1A(1,0)=(2,1)not a multiple of (1,0)\begin{aligned} A(1, 1) &= (2 + 1, 1 + 2) = (3, 3) = 3 \cdot (1, 1) && \text{eigenvector, } \lambda = 3 \\ A(1, -1) &= (2 - 1, 1 - 2) = (1, -1) = 1 \cdot (1, -1) && \text{eigenvector, } \lambda = 1 \\ A(1, 0) &= (2, 1) && \text{not a multiple of } (1, 0) \end{aligned}

Checking a candidate

To test whether v\mathbf{v} is an eigenvector, compute AvA\mathbf{v} and see whether it is a multiple of v\mathbf{v}. With exact arithmetic in SymPy you can compare AvA\mathbf{v} with λv\lambda\mathbf{v} directly:

python · try it yourself
from sympy import Matrix

A = Matrix([[2, 1], [1, 2]])
for v in [Matrix([1, 1]), Matrix([1, -1]), Matrix([1, 0]), Matrix([5, 5])]:
    Av = A * v
    # v is an eigenvector if Av is a multiple of v: the 2x2 matrix [v | Av] has rank 1
    if Matrix.hstack(v, Av).rank() == 1:
        lam = Av[0] / v[0] if v[0] != 0 else Av[1] / v[1]
        print(list(v), "->", list(Av), " eigenvector, lambda =", lam)
    else:
        print(list(v), "->", list(Av), " not an eigenvector")
[1, 1] -> [3, 3]  eigenvector, lambda = 3
[1, -1] -> [1, -1]  eigenvector, lambda = 1
[1, 0] -> [2, 1]  not an eigenvector
[5, 5] -> [15, 15]  eigenvector, lambda = 3

Notice (5,5)(5, 5): any nonzero multiple of an eigenvector is again an eigenvector with the same eigenvalue, because A(cv)=c(Av)=c(λv)=λ(cv)A(c\mathbf{v}) = c(A\mathbf{v}) = c(\lambda\mathbf{v}) = \lambda(c\mathbf{v}).

Eigenspaces

For a fixed eigenvalue λ\lambda, the set of all v\mathbf{v} with Av=λvA\mathbf{v} = \lambda\mathbf{v} is

Eλ={v:(A−λI)v=0}=null space of (A−λI)E_\lambda = \{ \mathbf{v} : (A - \lambda I)\mathbf{v} = \mathbf{0} \} = \text{null space of } (A - \lambda I)

This is a subspace, called the eigenspace of λ\lambda. It contains 0\mathbf{0} (the one vector that is not an eigenvector) plus all the eigenvectors for λ\lambda. So once you know λ\lambda, finding the eigenvectors is plain row reduction of A−λIA - \lambda I, a homogeneous system as in Homogeneous Systems. How to find λ\lambda in the first place is the topic of Finding Eigenvalues.

Example matrix Eigenvalues Eigenvectors
II (identity) 1 every nonzero vector
diag⁡(a,b)\operatorname{diag}(a, b), a≠ba \ne b a,ba, b multiples of e1\mathbf{e}_1, of e2\mathbf{e}_2
[2112]\begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix} 3, 1 multiples of (1,1)(1, 1), of (1,−1)(1, -1)
a projection onto a line LL 1, 0 vectors on LL, vectors⊥L\text{vectors} \perp L

Why repeated application loves eigenvectors

If Av=λvA\mathbf{v} = \lambda\mathbf{v}, then A2v=A(λv)=λ2vA^2\mathbf{v} = A(\lambda\mathbf{v}) = \lambda^2\mathbf{v}, and in general Akv=λkvA^k\mathbf{v} = \lambda^k\mathbf{v}. A matrix power that is costly on a general vector is trivial on an eigenvector. Write any vector as a combination of eigenvectors and you can see the long-run behaviour: the part along the eigenvector with the largest ∣λ∣\lvert\lambda\rvert grows fastest and soon dominates.

That observation is an algorithm, power iteration: start with almost any vector, multiply by AA again and again, and rescale each time. The direction converges to the dominant eigenvector, and the stretch factor converges to the dominant eigenvalue.

python · try it yourself
import numpy as np

A = np.array([[2.0, 1.0], [1.0, 2.0]])
v = np.array([1.0, 0.0])            # not an eigenvector
for k in range(1, 9):
    w = A @ v
    lam = float(np.linalg.norm(w) / np.linalg.norm(v))
    v = w / np.linalg.norm(w)        # rescale so the numbers stay small
    print(f"step {k}: v = ({v[0]:.5f}, {v[1]:.5f})  stretch = {lam:.5f}")
step 1: v = (0.89443, 0.44721)  stretch = 2.23607
step 2: v = (0.78087, 0.62470)  stretch = 2.86356
step 3: v = (0.73279, 0.68045)  stretch = 2.98370
step 4: v = (0.71578, 0.69832)  stretch = 2.99817
step 5: v = (0.71001, 0.70419)  stretch = 2.99980
step 6: v = (0.70808, 0.70614)  stretch = 2.99998
step 7: v = (0.70743, 0.70678)  stretch = 3.00000
step 8: v = (0.70721, 0.70700)  stretch = 3.00000

The direction heads to (1,1)/2≈(0.70711,0.70711)(1, 1)/\sqrt{2} \approx (0.70711, 0.70711) and the stretch to 3. The error shrinks by the ratio of the two eigenvalues, 13\frac{1}{3}, at every step.

In software

  • PageRank ranks web pages by the dominant eigenvector of a huge link matrix, found by exactly this power iteration (see PageRank and Markov Chains). The matrix is never stored densely; only matrix-vector products are needed.
  • PCA finds the directions of greatest variance in data as the eigenvectors of a covariance matrix (Principal Component Analysis).
  • Vibration and physics: the natural modes of a structure or a spring network are eigenvectors (Systems of Linear Differential Equations).
  • Stability: an iterated update xk+1=Axk\mathbf{x}_{k+1} = A\mathbf{x}_k (a simulation step, a recurrent network, a filter) blows up if some ∣λ∣>1\lvert\lambda\rvert > 1 and dies out if all ∣λ∣<1\lvert\lambda\rvert < 1.

Note: Eigen is German for "own" or "characteristic". An eigenvector is a vector the matrix treats as its own direction.

Exercises

Exercise 1: Spot the eigenvectors

Which of (1,0)(1, 0), (1,−1)(1, -1) and (1,2)(1, 2) are eigenvectors of A=[3102]A = \begin{bmatrix} 3 & 1 \\ 0 & 2 \end{bmatrix}? Give the eigenvalue of each one that is.

Answer

(1,0)(1, 0) with λ=3\lambda = 3 and (1,−1)(1, -1) with λ=2\lambda = 2. (1,2)(1, 2) is not an eigenvector.

Solution
A(1,0)=(3,0)=3⋅(1,0)A(1,−1)=(3−1,−2)=(2,−2)=2⋅(1,−1)A(1,2)=(3+2,4)=(5,4)51≠42, not a multiple\begin{aligned} A(1, 0) &= (3, 0) = 3 \cdot (1, 0) \\ A(1, -1) &= (3 - 1, -2) = (2, -2) = 2 \cdot (1, -1) \\ A(1, 2) &= (3 + 2, 4) = (5, 4) && \tfrac{5}{1} \ne \tfrac{4}{2},\ \text{not a multiple} \end{aligned}

Exercise 2: Eigenvector from a known eigenvalue

B=[1322]B = \begin{bmatrix} 1 & 3 \\ 2 & 2 \end{bmatrix} has eigenvalue λ=4\lambda = 4. Find an eigenvector for it.

Answer

Any nonzero multiple of (1,1)(1, 1).

Solution
B−4I=[−332−2]→row reduce[1−100]x−y=0 → v=t⋅(1,1)check: B(1,1)=(1+3,2+2)=(4,4)=4⋅(1,1)\begin{aligned} &B - 4I = \begin{bmatrix} -3 & 3 \\ 2 & -2 \end{bmatrix} \xrightarrow{\text{row reduce}} \begin{bmatrix} 1 & -1 \\ 0 & 0 \end{bmatrix} \\ &x - y = 0 \ \to\ \mathbf{v} = t \cdot (1, 1) \\ &\text{check: } B(1, 1) = (1 + 3, 2 + 2) = (4, 4) = 4 \cdot (1, 1) \end{aligned}

Exercise 3: Powers and shifts

Suppose Av=5vA\mathbf{v} = 5\mathbf{v}. Compute A3vA^3\mathbf{v}, (A−2I)v(A - 2I)\mathbf{v} and, if AA is invertible, A−1vA^{-1}\mathbf{v}, each as a multiple of v\mathbf{v}.

Answer

A3v=125vA^3\mathbf{v} = 125\mathbf{v}, (A−2I)v=3v(A - 2I)\mathbf{v} = 3\mathbf{v}, A−1v=15vA^{-1}\mathbf{v} = \frac{1}{5}\mathbf{v}.

Solution
A3v=A2(5v)=5A(5v)=125v(A−2I)v=Av−2v=5v−2v=3vAv=5v → v=A−1(5v)=5A−1v → A−1v=v/5\begin{aligned} &A^3\mathbf{v} = A^2(5\mathbf{v}) = 5A(5\mathbf{v}) = 125\mathbf{v} \\ &(A - 2I)\mathbf{v} = A\mathbf{v} - 2\mathbf{v} = 5\mathbf{v} - 2\mathbf{v} = 3\mathbf{v} \\ &A\mathbf{v} = 5\mathbf{v} \ \to\ \mathbf{v} = A^{-1}(5\mathbf{v}) = 5A^{-1}\mathbf{v} \ \to\ A^{-1}\mathbf{v} = \mathbf{v}/5 \end{aligned}

Exercise 4: Power iteration

Run power iteration on C=[4123]C = \begin{bmatrix} 4 & 1 \\ 2 & 3 \end{bmatrix}, starting from (1,0)(1, 0), for 30 steps. Which eigenvalue and which direction does it find?

Answer

λ=5\lambda = 5, direction (1,1)/2≈(0.70711,0.70711)(1, 1)/\sqrt{2} \approx (0.70711, 0.70711). The other eigenvalue is 2, so the error shrinks like (2/5)k(2/5)^k.

Solution

By hand: C(1,1)=(5,5)=5⋅(1,1)C(1, 1) = (5, 5) = 5 \cdot (1, 1). The rescaled iterates converge to that direction:

python · try it yourself
import numpy as np

C = np.array([[4.0, 1.0], [2.0, 3.0]])
v = np.array([1.0, 0.0])
for _ in range(30):
    w = C @ v
    lam = float(v @ w)              # Rayleigh quotient (v has length 1)
    v = w / np.linalg.norm(w)
print(f"lambda ~ {lam:.6f}, v ~ ({v[0]:.5f}, {v[1]:.5f})")
lambda ~ 5.000000, v ~ (0.70711, 0.70711)

Test yourself

Which statement is part of the definition of an eigenvector v\mathbf{v} of AA?

  1. λ\lambda must be nonzero
  2. AvA\mathbf{v} is perpendicular to v\mathbf{v}
  3. v\mathbf{v} must be nonzero and Av=λvA\mathbf{v} = \lambda\mathbf{v}
  4. v\mathbf{v} must have length 1

If Av=2vA\mathbf{v} = 2\mathbf{v}, what is A4vA^4\mathbf{v}?

  1. 8v8\mathbf{v}
  2. 16v16\mathbf{v}
  3. 2v2\mathbf{v}
  4. 4v4\mathbf{v}

What does power iteration converge to (for a typical starting vector)?

  1. The eigenvector of the eigenvalue with the largest absolute value
  2. The eigenvector of the smallest eigenvalue
  3. The zero vector
  4. The first column of AA