Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

Recipe

Diagonalize a matrix

Use when: you have a square matrix A and need P, D with A=PDP^{-1}

Goal: the eigenvalues and a matching set of independent eigenvectors, assembled into P and D

Taught in Eigenvalues, eigenvectors, and diagonalization, revisited

  1. 1

    Form A-\lambda I by subtracting \lambda from each diagonal entry. Then solve \det(A-\lambda I)=0 for \lambda.

    Example

    For A=\begin{pmatrix}5&4\\1&2\end{pmatrix}, \det(A-\lambda I)=(5-\lambda)(2-\lambda)-4=\lambda^2-7\lambda+6=(\lambda-6)(\lambda-1), so \lambda=6 or \lambda=1.

    Why: an eigenvalue is exactly a \lambda that makes A-\lambda I singular. A square matrix is singular in exactly one case. That case is when its determinant is zero.

  2. 2

    For each \lambda, solve (A-\lambda I)v=0 for a nonzero v.

    Example

    For \lambda=6: (A-6I)v=0 reduces to v=(4,1). For \lambda=1: (A-I)v=0 reduces to v=(-1,1).

    Why: rearranging Av=\lambda v gives (A-\lambda I)v=0. Its nonzero solutions are exactly A's eigenvectors.

  3. 3

    A 2\times2 matrix needs 2 independent eigenvectors to diagonalize. An n\times n matrix needs n.

    Example

    A has two distinct eigenvalues, 6 and 1. So its two eigenvectors (4,1) and (-1,1) are automatically independent.

    • distinct eigenvalues — their eigenvectors are automatically independent. So continue.
    • a repeated eigenvalue can have fewer independent eigenvectors than its multiplicity — then A cannot be diagonalized.

    Why: P needs a full set of independent columns. Only then is P invertible. Otherwise PDP^{-1} is undefined.

  4. 4

    Put each eigenvector into a column of P. Put its eigenvalue in the matching spot on D's diagonal.

    Example

    Column 1 holds \lambda=6 and its eigenvector (4,1). Column 2 holds \lambda=1 and its eigenvector (-1,1): P=\begin{pmatrix}4&-1\\1&1\end{pmatrix},\qquad D=\begin{pmatrix}6&0\\0&1\end{pmatrix}

    Why: Av_i=\lambda_i v_i has to hold, column by column. Only then is AP=PD true.

  5. 5

    Compute P^{-1}. Then check that PDP^{-1} multiplies back out to A.

    ⚡ Shortcut

    For a 2\times2 matrix P=\begin{pmatrix}a&b\\c&d\end{pmatrix}, P^{-1}=\frac{1}{ad-bc}\begin{pmatrix}d&-b\\-c&a\end{pmatrix}. That's faster than general row reduction.

    Why: this step actually confirms A is diagonalizable. It doesn't just assume that.

Common mistakes

  • Subtracting \lambda from every entry of A instead of only the diagonal.
  • Writing P^{-1}DP instead of PDP^{-1}.
  • Putting an eigenvector in a column that doesn't match its eigenvalue's column in D.
  • Assuming a repeated eigenvalue always blocks diagonalization. Check its eigenvector count instead.