Skip to the workspace
Pebellslearn by building
Linear Algebra  ›  Capstone Project

Eigenvalues and Diagonalization

Eigenvalues, Diagonalization 15 minAn eigenvector is a direction a matrix only stretches, its eigenvalue is the stretch factor, and writing a matrix in terms of its eigenvectors makes it diagonal.

machine learning / Eigenvalues and Diagonalization

Explore each scene at your own pace.

01 · The rule

The rule

Eigenvalues and Diagonalization

Plot size against rent for a few hundred flats and the dots form a long cloud tilted up and to the right. The direction the cloud stretches along, and how far it stretches, are an eigenvector and an eigenvalue. Principal component analysis, a standard way to shrink many features into a few, is built on exactly this.

The rule

An eigenvector keeps its direction; its eigenvalue says how much it stretches.

Most vectors change direction when a matrix acts on them. A few special ones only get longer, shorter or flipped. For those, Av=λvAv = \lambda v: vv is the eigenvector and the number λ\lambda is its eigenvalue.

Take A=(2112)A = \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}:

  • v=[1,1]v = [1, 1]: Av=[3,3]=3vAv = [3, 3] = 3v. Same direction, stretched by 3, so λ=3\lambda = 3.
  • v=[1,−1]v = [1, -1]: Av=[1,−1]Av = [1, -1]. Same direction, stretched by 1, so λ=1\lambda = 1.
  • v=[1,0]v = [1, 0]: Av=[2,1]Av = [2, 1]. The direction changed, so this is not an eigenvector.

Diagonalization rewrites the matrix using its eigenvectors: A=PDP−1A = P D P^{-1}, where the columns of PP are the eigenvectors and DD is diagonal with the eigenvalues. In eigenvector coordinates the matrix is just "stretch each axis". That makes powers easy: A10=PD10P−1A^{10} = P D^{10} P^{-1}, and a diagonal matrix is raised to a power one entry at a time.

Covariance matrices, which describe how features vary together, are symmetric. Symmetric matrices always have real eigenvalues and perpendicular eigenvectors, which is why PCA can use them as new axes: the eigenvector with the largest eigenvalue points where the data spreads most.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.