Skip to content

Diagonalization

Diagonalization lets you simplify a complicated matrix into a much easier form. Once diagonalized, hard problems like computing A100A^{100} become trivial.

Imagine you have a complicated matrix AA that mixes up all the components of a vector when you multiply. Diagonalization rewrites AA in a form where the transformation becomes simple: just scaling along independent directions.

A square matrix AA is diagonalizable if it can be written as:

A=PDP1A = P D P^{-1}

where:

  • PP is a matrix whose columns are the eigenvectors of AA
  • DD is a diagonal matrix with the eigenvalues on the diagonal
  • P1P^{-1} is the inverse of PP

Think of it as a three-step process for applying AA to any vector:

  1. P1P^{-1}: convert the vector into the eigenvector coordinate system
  2. DD: scale each eigenvector direction independently (this is the easy part)
  3. PP: convert back to the original coordinate system
  1. Find the eigenvalues by solving det(AλI)=0\det(A - \lambda I) = 0
  2. For each eigenvalue, find the corresponding eigenvector
  3. Check that you have enough linearly independent eigenvectors (one per eigenvalue)
  4. Form PP by placing the eigenvectors as columns
  5. Form DD by placing the eigenvalues on the diagonal (in the same order as the eigenvectors in PP)
  6. Verify: A=PDP1A = PDP^{-1}

If A=PDP1A = PDP^{-1}, then raising AA to a power becomes:

An=PDnP1A^n = P D^n P^{-1}

Since DD is diagonal, DnD^n is trivial: just raise each diagonal entry to the nnth power. No repeated matrix multiplication needed. Computing A100A^{100} takes the same effort as computing A2A^2.

A = P D P⁻¹ A = P × D × P⁻¹ original eigenvectors eigenvalues change back Computing powers: Aⁿ = P × Dⁿ × P⁻¹ (just raise each eigenvalue to nth power)

The diagram shows the decomposition: the original matrix AA breaks into three pieces. PP (eigenvector columns) converts to the eigenvector basis, DD (eigenvalues on diagonal) does simple scaling, and P1P^{-1} converts back. Computing AnA^n becomes easy because DnD^n just raises each eigenvalue to the nnth power.

Example 1: Diagonalizing a 2x2 Matrix

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

Eigenvalues: λ1=3\lambda_1 = 3, λ2=2\lambda_2 = 2

Eigenvectors: v1=1,0\mathbf{v}_1 = \langle 1, 0 \rangle (for λ=3\lambda = 3), v2=1,1\mathbf{v}_2 = \langle 1, -1 \rangle (for λ=2\lambda = 2)

Form PP with eigenvectors as columns:

P=[1101],D=[3002]P = \begin{bmatrix} 1 & 1 \\ 0 & -1 \end{bmatrix}, \quad D = \begin{bmatrix} 3 & 0 \\ 0 & 2 \end{bmatrix}

Then A=PDP1A = PDP^{-1}.

Here P1P^{-1} converts a vector from the standard basis into the eigenvector basis (so DD can do its simple scaling), and PP converts back. For this example:

P1=[1101]1=[1101]P^{-1} = \begin{bmatrix} 1 & 1 \\ 0 & -1 \end{bmatrix}^{-1} = \begin{bmatrix} 1 & 1 \\ 0 & -1 \end{bmatrix}

The process is: P1P^{-1} translates into eigenvector coordinates, DD scales each eigenvector direction independently, then PP translates back to standard coordinates.

Example 2: Computing A5A^5

Instead of multiplying AA five times:

D5=[350025]=[2430032]D^5 = \begin{bmatrix} 3^5 & 0 \\ 0 & 2^5 \end{bmatrix} = \begin{bmatrix} 243 & 0 \\ 0 & 32 \end{bmatrix}

Then A5=PD5P1A^5 = P D^5 P^{-1}. Two matrix multiplications instead of five.

Example 3: When Diagonalization Fails

If a matrix doesn’t have enough linearly independent eigenvectors, it can’t be diagonalized. For example, [1101]\begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} has λ=1\lambda = 1 (repeated) but only one independent eigenvector. This is called a defective matrix.

Diagonalization shows up in:

  • Game development: efficiently computing repeated transformations (exponential decay, smooth rotation interpolation)
  • Physics: solving systems of differential equations (coupled oscillators, vibration modes)
  • Machine learning: PCA and SVD are closely related to diagonalization
  • Engineering: stability analysis, signal processing

Example: In a game, if a character’s velocity decays exponentially each frame, the engine can use diagonalization to compute the velocity after 1000 frames in one step instead of iterating 1000 times.

A diagonalizable matrix $A$ can be written as:
The columns of $P$ in $A = PDP^{-1}$ are:
If $A$ is diagonalizable, computing $A^{10}$ is easiest by:
A matrix that cannot be diagonalized is called:
In game development, diagonalization helps with: