← All Labs
MATHS · VISUAL LAB · IDEA 23

Eigenvectors — the axes a matrix doesn't rotate

A 2×2 matrix takes the whole plane and shears, spins and stretches it. Almost every arrow comes out pointing somewhere new. But a special few come out pointing exactly along the line they started on — only longer or shorter. Those directions are the eigenvectors; the stretch factor is the eigenvalue. Drag the four matrix entries and watch the eigenlines snap into place.

DRIVE IT

Bend the plane. Find the grain.

Every faint arrow is a unit vector v; every bright arrow is Av. When they line up, you've hit an eigenvector.
p5.js · LIVE 2×2
angle 
|Av|/|v| 
Drag a matrix entry, or grab the blue tips on the canvas. Eigenlines shown when eigenvalues are real.
a (x→x)1.20
b (y→x)0.80
c (x→y)0.30
d (y→y)1.70
det A
trace A
discriminant
λ₁
λ₂
v₁ direction
v₂ direction
v (input) Av (output) eigenline aligned!
WALKTHROUGH

How to read what you're seeing

Four moves from a blob of arrows to the hidden skeleton of the map.
4 STEPS
1
Spray unit vectors. The faint slate arrows are a ring of inputs v, all length 1. Each bright teal arrow is its image Av. Most inputs get rotated — the two arrows point different ways.
2
Hunt for alignment. Sweep your eye around the ring. At certain angles the teal output lies on top of the slate input's line (same or opposite direction). Those glow gold. There you've found an eigenvector.
3
Read the stretch. On an eigenline, Av = λv. If the gold arrow is 1.7× as long, λ = 1.7. If it flips to point backwards, λ is negative. The dashed violet lines mark these invariant directions.
4
Break it. Turn a, b, c, d toward a rotation (try the Rotation 60° preset). The discriminant goes negative, the eigenlines vanish — a pure rotation leaves no real direction fixed. That's eigenvalues going complex.
AHA

The grain of a linear map

Why anyone bothered to name these.
THE POINT
AHA MOMENT
A matrix looks like four unrelated numbers. But every matrix has a hidden grain — a small set of directions it only stretches, never turns. Find that grain and the tangled transformation becomes trivial: along each eigenline the matrix is just multiplication by a number. Eigenvectors are the coordinate system in which the map wants to be described.
EXPLANATION

The maths, computed live

No faked plot — the applet solves the real characteristic equation every frame.
UNDER THE HOOD

An eigenvector of a matrix A is a nonzero vector v that A maps to a scalar multiple of itself:

The output points along the input — only the length (and maybe sign) changes. λ is the eigenvalue.

Rearranging, (A − λI)v = 0 must have a nonzero solution, which forces the matrix A − λI to be singular. So its determinant vanishes — the characteristic equation:

For a 2×2, this is just λ² − (trace)λ + (det) = 0. The applet's readout shows trace, det and the discriminant.

Solving the quadratic gives the two eigenvalues from trace τ = a+d and determinant Δ = ad−bc:

The quantity under the root is the discriminant. Positive → two real eigenlines. Zero → one repeated direction. Negative → the map rotates, no real eigenvector.

Once you have a real λ, the eigenvector is any nonzero solution of (A − λI)v = 0. For a 2×2 you can read it straight off a row:

The applet picks whichever row is non-degenerate, then normalizes. That's the dashed violet line.

Reading the geometry. The unit circle you drag maps to an ellipse. Its principal directions aren't generally the eigenvectors (those come from the symmetric part / SVD) — but when eigenvalues are real, the eigenlines are exactly the directions the ellipse touches its own supporting parallel lines to the input. The determinant is the signed area scaling: det = λ₁λ₂, and the trace is λ₁+λ₂. You can verify both live in the readout.

Why it matters. Diagonalising A = PDP⁻¹ turns matrix powers, differential equations and Markov chains into scalar arithmetic on the eigenlines. Google's PageRank, the principal axes of inertia, the normal modes of a bridge, and PCA in machine learning are all the same trick: find the directions the operator merely scales.

Try: the Shear preset has a repeated eigenvalue and only one eigenline — a "defective" matrix that can't be diagonalised. The Symmetric preset has perpendicular eigenlines (always true for symmetric A — the spectral theorem).
RESEARCH NOTE

What's genuine here

Provenance & verification.
HONESTY

Real computation. Every frame the sketch forms trace τ, determinant Δ and discriminant τ²−4Δ from the live slider values, solves λ² − τλ + Δ = 0 by the quadratic formula, and derives each eigenvector from a non-degenerate row of A − λI before normalising. Nothing is precomputed or tabled.

Cross-checks shown on screen. λ₁+λ₂ = trace and λ₁·λ₂ = det are both displayed so you can confirm the solver against the invariants at any time. The "aligned" gold highlight is triggered purely by the angle between v and Av dropping below a small threshold — an independent geometric witness that those directions really are fixed.

Degenerate cases handled. Complex eigenvalues (rotations) suppress the eigenlines and flag "no real eigenvector". Repeated real roots (shears, scalar-plus-nilpotent) report a single eigenline and a defect warning. A zero determinant (rank-deficient A) collapses the ellipse to a segment and reports a zero eigenvalue.

Built to sit alongside the repo's other applets (Lorenz, Hopf, Poincaré disc, Riemann lab). Idea #23 from the 25 maths visual-teaching ideas list. Tech: p5.js, self-contained single file, KaTeX for the formulae.