Advanced Linear Algebra
Eigenvectors and eigenvalues
The directions a transformation only scales
A matrix takes the whole plane and warps it - most arrows come out pointing somewhere new. But hidden inside every transformation are a handful of special directions that refuse to turn. Feed one in, and what comes out points the exact same way - only longer or shorter. Those unbending directions are its eigenvectors; the amount each one stretches is its eigenvalue. Find them and you've found the transformation's own private set of axes - the frame in which its tangled behaviour becomes pure, simple scaling.
The one-line idea
One equation says it all
Everything above collapses into a single, deceptively small equation. For a square matrix , a nonzero vector is an eigenvector, with eigenvalue , exactly when:
Read it slowly. The left side, , is the full transformation - matrix multiply, the machinery that normally rotates, shears, and stretches. The right side, , is nothing but scalar times the same vector - pure stretching, no turning. The equation demands they be equal: for this one special , the whole matrix does no more than a single number would. All the complicated off-axis mixing cancels out along that direction. If the vector triples; if it sits perfectly still; if is negative it flips through the origin.
Go on an eigen-hunt
Below, a fixed matrix warps the plane. The faint dashed circle is every possible unit input direction; the amber loop is where that circle lands - an ellipse, because the matrix stretches some directions more than others. Spin the input arrow (drag it, or use the slider) and watch its image. The rotation meter shows how far the image is turned off the input's line. Hunt for the angles where it drops to zero: there, input and output share a line, the arrow snaps and glows, and you've caught an eigenvector with its .
The image is turned 16° off the input's line - not an eigenvector. Keep hunting.
The "aha": the meter hits exactly zero
Why this is the "skeleton" of a transformation
Once you know the eigenvectors, you understand the whole matrix. Line them up as the columns of a matrix and put the eigenvalues on the diagonal of , and the transformation factors into three clean moves:
This is diagonalization, and it reads right-to-left as a story: rotates the world so the eigenvectors become the ordinary axes, does nothing but scale each axis by its eigenvalue, and rotates back. In its own eigenbasis, a matrix is just a set of independent stretch knobs - no rotation, no shear, no coupling. That is why eigenvalues govern stability: repeatedly applying (as dynamical systems, Markov chains, and training loops all do) multiplies each eigendirection by . Eigenvalues with blow up, decay to zero, and persist forever. The largest eigenvalue decides the long-run fate.
How to actually find them: the characteristic equation
Rewrite as . For a nonzero to solve this, the matrix must squash space flat - it must be singular - which means its determinant is zero:
For our that is , so , giving and - exactly the two stretch factors the demo snapped onto. Plug each back in and solve to recover its eigenvector.
Why PCA hunts these exact directions
Here is the payoff that reaches all the way into machine learning. Take a cloud of data points and compute its covariance matrix - a symmetric matrix whose entries measure how the features vary together. Its eigenvectors are the directions along which the data spreads out the most, and each eigenvalue is the amount of variance captured in that direction. The top eigenvector points along the cloud's longest axis; the next, perpendicular to it, along the second-longest; and so on. That is exactly Principal Component Analysis: keep the few eigenvectors with the largest eigenvalues and you've compressed high-dimensional data down to the directions that actually carry information, with provably minimal loss. The special axes of a transformation and the meaningful axes of a dataset turn out to be the same idea.
import numpy as np
A = np.array([[2, 1], [1, 2]])
vals, vecs = np.linalg.eig(A)
# vals -> [3., 1.] the eigenvalues (stretch factors)
# vecs -> columns are unit eigenvectors: [.707, .707] and [-.707, .707]
# PCA is exactly this, run on the data's covariance matrix:
C = np.cov(data, rowvar=False) # symmetric covariance
variances, axes = np.linalg.eigh(C) # eigh: for symmetric matrices
# largest 'variances' -> the principal component directions in 'axes'Check yourself
A nonzero vector v is an eigenvector of A exactly when Av is:
In the eigen-hunt, the rotation meter reads exactly zero when:
Recall: state the eigen-equation, say what v and λ mean geometrically, and name the ML method that finds the eigenvectors of a covariance matrix.
The equation, its geometry, and its ML payoff. Try to state it, then check.
Lock it in
- An eigenvector is a direction a matrix only stretches; the eigenvalue is how much, all captured by Av = λv.
- The rotation meter reads zero exactly on an eigenvector, where Av lands back on v's line.
- Diagonalization A = Q Λ Q^-1 turns a matrix into pure per-axis scaling, so eigenvalues govern stability under repeated application.
- PCA is this idea on data: the eigenvectors of the covariance matrix are the perpendicular directions of maximum variance.
Primary source
Ask your teacher