AnyLearn
All lessons
Mathintermediate

Eigenvalues and Eigenvectors

Some vectors only get scaled by a matrix — they don't rotate at all. These eigenvectors reveal the skeleton of a linear transformation. Master the eigen-equation, the characteristic polynomial, diagonalization, and why eigenstructure powers PCA, PageRank, and stability analysis.

Not signed in — your progress and quiz score won't be saved.
Lesson progress1 / 9

The eigen-equation: directions that only scale

Most vectors get both rotated and scaled when you multiply by a matrix. But special vectors — eigenvectors — only get scaled:

Av=λv,v0.A\mathbf{v} = \lambda\mathbf{v}, \quad \mathbf{v}\ne\mathbf{0}.

λC\lambda\in\mathbb{C} is the eigenvalue (the scaling factor); v\mathbf{v} is the corresponding eigenvector (the invariant direction).

Geometric meaning: AA maps the line through v\mathbf{v} back to itself, just stretched or flipped. If λ>1\lambda>1, the direction is amplified. If 0<λ<10<\lambda<1, it's compressed. If λ<0\lambda<0, it's flipped and scaled. If λ=0\lambda=0, the entire direction is killed — v\mathbf{v} lands in the null space.

This is the skeleton of the transformation: eigenvectors are the axes that AA acts on most simply. Any other vector is a superposition of eigenvectors, and the matrix just scales each component independently.

Full lesson text

All 9 steps on one page — for reading, reference, and search.

Show

1. The eigen-equation: directions that only scale

Most vectors get both rotated and scaled when you multiply by a matrix. But special vectors — eigenvectors — only get scaled:

Av=λv,v0.A\mathbf{v} = \lambda\mathbf{v}, \quad \mathbf{v}\ne\mathbf{0}.

λC\lambda\in\mathbb{C} is the eigenvalue (the scaling factor); v\mathbf{v} is the corresponding eigenvector (the invariant direction).

Geometric meaning: AA maps the line through v\mathbf{v} back to itself, just stretched or flipped. If λ>1\lambda>1, the direction is amplified. If 0<λ<10<\lambda<1, it's compressed. If λ<0\lambda<0, it's flipped and scaled. If λ=0\lambda=0, the entire direction is killed — v\mathbf{v} lands in the null space.

This is the skeleton of the transformation: eigenvectors are the axes that AA acts on most simply. Any other vector is a superposition of eigenvectors, and the matrix just scales each component independently.

2. Finding eigenvalues: the characteristic polynomial

Av=λvA\mathbf{v}=\lambda\mathbf{v} rearranges to (AλI)v=0(A-\lambda I)\mathbf{v}=\mathbf{0}. For a nonzero v\mathbf{v} to exist, AλIA-\lambda I must be singular:

det(AλI)=0.\det(A - \lambda I) = 0.

This is the characteristic polynomial in λ\lambda. For an n×nn\times n matrix it has degree nn, so there are exactly nn eigenvalues (counted with multiplicity, possibly complex).

Example. A=[3102]A=\begin{bmatrix}3&1\\0&2\end{bmatrix}:

det(AλI)=(3λ)(2λ)0=λ25λ+6=(λ3)(λ2).\det(A-\lambda I) = (3-\lambda)(2-\lambda) - 0 = \lambda^2 - 5\lambda + 6 = (\lambda-3)(\lambda-2).

Eigenvalues: λ1=3\lambda_1=3, λ2=2\lambda_2=2. Then solve (A3I)v=0(A-3I)\mathbf{v}=\mathbf{0} for v1\mathbf{v}_1 and (A2I)v=0(A-2I)\mathbf{v}=\mathbf{0} for v2\mathbf{v}_2:

v1=[10],v2=[11].\mathbf{v}_1=\begin{bmatrix}1\\0\end{bmatrix},\quad \mathbf{v}_2=\begin{bmatrix}1\\-1\end{bmatrix}.

3. Diagonalization: the payoff

If an n×nn\times n matrix has nn linearly independent eigenvectors, pack them as columns of PP and their eigenvalues on the diagonal of DD:

AP=PD    A=PDP1,D=[λ1λn].AP = PD \implies A = PDP^{-1}, \quad D = \begin{bmatrix}\lambda_1 & & \\ & \ddots & \\ & & \lambda_n\end{bmatrix}.

This is diagonalization. Why it matters — matrix powers become trivial:

Ak=(PDP1)k=PDkP1,Dk=[λ1kλnk].A^k = (PDP^{-1})^k = PD^kP^{-1}, \quad D^k = \begin{bmatrix}\lambda_1^k & & \\ & \ddots & \\ & & \lambda_n^k\end{bmatrix}.

Multiplying AA by itself kk times is now just raising nn scalars to the kkth power. Computing A100A^{100} for a 1000×10001000\times 1000 matrix is otherwise nightmarish; in the eigenbasis, it's trivial. Diagonalization is the upgrade from "apply AA repeatedly" to "scale each component by λk\lambda^k".

4. Symmetric matrices: the clean case

For a real symmetric matrix A=AA=A^\top, the spectral theorem guarantees:

  1. All eigenvalues are real.
  2. Eigenvectors from different eigenvalues are orthogonal.
  3. AA is always diagonalizable: A=QΛQA=Q\Lambda Q^\top where QQ has orthonormal columns.

This orthogonal diagonalization — Q1=QQ^{-1}=Q^\top — is far nicer than generic PDP1PDP^{-1}. Symmetric matrices arise everywhere: covariance matrices, graph Laplacians, Hessians in optimization, kernel matrices in SVMs. Their eigenvalues are real (no complex surprises), and their eigenvectors form a clean orthonormal basis of Rn\mathbb{R}^n.

For PCA, the covariance matrix Σ=(1/m)XX\Sigma=(1/m)X^\top X is symmetric positive semi-definite: all eigenvalues 0\ge 0, and the eigenvectors are the principal components — the directions of maximum variance in the data.

5. Applications: PCA, PageRank, and stability

Eigenstructure drives three landmark algorithms:

PCA (Principal Component Analysis). Given centered data matrix XX, form Σ=XX\Sigma=X^\top X. Its eigenvectors are the principal components. Project data onto the top-kk eigenvectors to reduce dimension while preserving maximum variance. Eigenvalue λi\lambda_i tells you the variance explained by component ii.

PageRank. The web is a graph; Aij=1/out-degree(j)A_{ij}=1/\text{out-degree}(j) if page jj links to ii. The rank vector r\mathbf{r} satisfies Ar=rA\mathbf{r}=\mathbf{r} — it is the eigenvector for eigenvalue 1 (the Perron eigenvector of a stochastic matrix). Google's trillion-dollar insight: importance is the dominant eigenvector.

Dynamical stability. A linear system xt+1=Axt\mathbf{x}_{t+1}=A\mathbf{x}_t is stable iff every eigenvalue has λ<1|\lambda|<1. If any λ>1|\lambda|>1, the system blows up. The eigenvalue with largest magnitude — the spectral radius ρ(A)\rho(A) — determines long-term behavior.

6. The algebraic and geometric multiplicities

An eigenvalue λ\lambda may appear more than once as a root of the characteristic polynomial.

  • Algebraic multiplicity mam_a: how many times λ\lambda is a root of det(AλI)\det(A-\lambda I).
  • Geometric multiplicity mgm_g: the dimension of the eigenspace ker(AλI)\ker(A-\lambda I) — how many independent eigenvectors share λ\lambda.

Always 1mgma1\le m_g\le m_a. If mg<mam_g < m_a for any eigenvalue, AA is defective — it lacks enough eigenvectors to diagonalize.

Example: A=[2102]A=\begin{bmatrix}2&1\\0&2\end{bmatrix} has λ=2\lambda=2 with ma=2m_a=2 but mg=1m_g=1 (the eigenspace is only span([1,0])\operatorname{span}([1,0]^\top)). AA cannot be diagonalized; its Jordan form has a 2×22\times 2 Jordan block. Defective matrices are rare in practice (they require exact coincidences) but occur in control theory and differential equations.

7. NumPy: eigenvalues and diagonalization check

NumPy computes eigenvalues via np.linalg.eig (general) or np.linalg.eigh (symmetric, faster and guaranteed real):

import numpy as np

# General matrix
A = np.array([[3, 1], [0, 2]], dtype=float)
vals, vecs = np.linalg.eig(A)
print("eigenvalues:", vals)        # [3., 2.]
print("eigenvectors:\n", vecs)     # columns are eigenvectors

# Verify A @ v = lambda * v
for i in range(len(vals)):
    lhs = A @ vecs[:, i]
    rhs = vals[i] * vecs[:, i]
    print(f"lambda={vals[i]:.1f}: residual = {np.max(np.abs(lhs - rhs)):.2e}")

# Diagonalization: A = P D P^{-1}
P = vecs
D = np.diag(vals)
A_reconstructed = P @ D @ np.linalg.inv(P)
print("Reconstruction error:", np.max(np.abs(A - A_reconstructed)))  # ~1e-15

# Powers via diagonalization
k = 10
Ak = P @ np.diag(vals**k) @ np.linalg.inv(P)
print("A^10 via diagonalization:\n", np.round(Ak))

For a symmetric matrix, always use eigh — it's faster (O(n3/3)O(n^3/3) vs O(n3)O(n^3)) and returns real eigenvalues in sorted order.

8. When diagonalization fails: a worked comparison

Not every matrix is diagonalizable. Compare two matrices with the same characteristic polynomial:

PropertyA=[2102]A=\begin{bmatrix}2&1\\0&2\end{bmatrix}B=[2002]B=\begin{bmatrix}2&0\\0&2\end{bmatrix}
Characteristic poly(λ2)2(\lambda-2)^2(λ2)2(\lambda-2)^2
ma(λ=2)m_a(\lambda=2)22
mg(λ=2)m_g(\lambda=2)12
Diagonalizable?NoYes (B=2IB=2I)
Long-run behaviorPolynomial growth t2tt\cdot 2^tExponential 2t2^t

The defective matrix AA produces polynomial factors when iterated — critical in delay-differential equations and resonance phenomena. The Jordan form J=[2102]J=\begin{bmatrix}2&1\\0&2\end{bmatrix} is the canonical form for this behavior. It's not a curiosity: defective modes appear in structural mechanics (repeated natural frequencies under damping) and in digital filters.

9. Trace, determinant, and eigenvalue relations

Two elegant identities connect eigenvalues to matrix entries:

tr(A)=i=1nλi(trace = sum of eigenvalues)\operatorname{tr}(A) = \sum_{i=1}^n \lambda_i \qquad \text{(trace = sum of eigenvalues)}

det(A)=i=1nλi(determinant = product of eigenvalues)\det(A) = \prod_{i=1}^n \lambda_i \qquad \text{(determinant = product of eigenvalues)}

These are immediate from the characteristic polynomial (λλ1)(λλn)(\lambda-\lambda_1)\cdots(\lambda-\lambda_n). Quick consequences:

  • det(A)=0\det(A)=0 iff at least one λi=0\lambda_i=0 — confirming the singular/null-space connection.
  • For a 2×22\times 2 matrix: λ2tr(A)λ+det(A)=0\lambda^2 - \operatorname{tr}(A)\lambda + \det(A) = 0 — a quick formula for eigenvalues without expanding the full determinant.
  • The trace is invariant under similarity transformations: tr(PDP1)=tr(D)=λi\operatorname{tr}(PDP^{-1})=\operatorname{tr}(D)=\sum\lambda_i. The trace is also the sum of diagonal entries — so you can read off λi\sum\lambda_i instantly from the matrix without computing a single eigenvalue.

Check your understanding

The lesson ends with a 5-question quiz. Take it in the player above to see your score.

  1. A $3\times 3$ matrix $A$ has eigenvalues $1, -2, 3$. What is $\det(A)$?
    • 2
    • 6
    • -6
    • -2
  2. Matrix $A$ has eigenvector $\mathbf{v}$ with eigenvalue $\lambda=0$. What does this imply?
    • $A$ is the zero matrix.
    • $A$ is the identity matrix.
    • $A$ is singular — its null space contains $\mathbf{v}$.
    • $A$ is diagonalizable with all-zero diagonal.
  3. Why does diagonalization $A=PDP^{-1}$ make computing $A^k$ so much easier?
    • Because $D$ is orthogonal, so $D^k=D$ for all $k$.
    • Because $P$ and $P^{-1}$ cancel in the product, leaving only $D$.
    • Because $A^k=PD^kP^{-1}$ and $D^k$ is diagonal with entries $\lambda_i^k$ — $n$ scalar powers instead of $n^2$ matrix multiplications.
    • Because the trace of $D^k$ equals $\operatorname{tr}(A)^k$.
  4. For a real symmetric matrix, which statement is guaranteed by the spectral theorem?
    • All eigenvalues are positive.
    • All eigenvalues are real and eigenvectors from distinct eigenvalues are orthogonal.
    • The matrix is always invertible.
    • The characteristic polynomial has no repeated roots.
  5. A matrix has algebraic multiplicity 3 for eigenvalue $\lambda=5$ but geometric multiplicity 1. This means:
    • The matrix has only one eigenvalue, repeated three times.
    • The matrix is defective — it lacks enough eigenvectors to diagonalize.
    • The matrix is orthogonally diagonalizable with a $3\times 3$ block.
    • The eigenspace for $\lambda=5$ has dimension 3.

Related lessons