VectorLab

Visualize vectors, solve algebra & calculus step by step, with guides

← Back to the tools

Matrix Diagonalization: A = PDP⁻¹ Step by Step

Diagonalizing a matrix means rewriting it in the coordinates where it only scales each axis. This guide covers A = PDP⁻¹, when it is possible, and why it makes powers of a matrix easy.

What diagonalization means

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

A=PDP^{-1}

where D is a diagonal matrix and P is invertible. Intuitively, there is a set of axes (the eigenvector directions) in which A does nothing but scale each axis, and D records those scale factors.

xP⁻¹switch to eigenvector coordinatesDscale axis 1 by λ₁ and axis 2 by λ₂Pswitch back to ordinary coordinatesAx = P D P⁻¹ x
Ax = PDP⁻¹x: change to eigenvector coordinates, scale each axis, change back.

How D and P are built

  • D has the eigenvalues \lambda_1,\dots,\lambda_n on its diagonal and zeros elsewhere.
  • P has the matching eigenvectors \mathbf v_1,\dots,\mathbf v_n as its columns.

The order must match: column i of P is the eigenvector for the i-th diagonal entry of D. This works because AP=PD says, column by column, that A\mathbf v_i=\lambda_i\mathbf v_i.

When a matrix is diagonalizable

An n\times n matrix is diagonalizable exactly when it has n linearly independent eigenvectors. Equivalent test: for every eigenvalue, the geometric multiplicity equals the algebraic multiplicity. Two handy sufficient conditions: n distinct eigenvalues guarantee it, and every real symmetric matrix is diagonalizable.

Repeated eigenvalues

A repeated eigenvalue does not decide the question by itself. 3I has \lambda=3 twice and two independent eigenvectors, so it is (trivially) diagonalizable with P=I. You must count the independent eigenvectors in each eigenspace.

Defective matrices

A matrix with too few independent eigenvectors is defective and cannot be diagonalized. The classic example is \begin{bmatrix}1&1\\0&1\end{bmatrix}: \lambda=1 is repeated twice, but the only eigenvectors are multiples of (1,0). Only one column is available for P, so P cannot be invertible. Such matrices are handled with the Jordan form, a step beyond this guide.

Worked example

Diagonalize A=\begin{bmatrix}4&1\\2&3\end{bmatrix}.

From the earlier guides: \lambda_1=5 with \mathbf v_1=(1,1) and \lambda_2=2 with \mathbf v_2=(1,-2). Two independent eigenvectors, so it is diagonalizable.

P=\begin{bmatrix}1&1\\1&-2\end{bmatrix},\quad D=\begin{bmatrix}5&0\\0&2\end{bmatrix},\quad P^{-1}=\tfrac13\begin{bmatrix}2&1\\1&-1\end{bmatrix}

(here \det P=-3). Check the product: PD=\begin{bmatrix}5&2\\5&-4\end{bmatrix} and

PDP^{-1}=\tfrac13\begin{bmatrix}12&3\\6&9\end{bmatrix}=\begin{bmatrix}4&1\\2&3\end{bmatrix}=A

The product equals A. ✓

Why diagonalization is useful

Powers become easy, because the inner P^{-1}P factors cancel:

A^k=PD^kP^{-1}=P\begin{bmatrix}5^k&0\\0&2^k\end{bmatrix}P^{-1}

For k=2 this gives A^2=\begin{bmatrix}18&7\\14&11\end{bmatrix}, and for large k the 5^k term dominates. The same idea gives matrix exponentials for solving \mathbf x'=A\mathbf x, closed forms for recurrences, and long-run behavior of Markov chains and vibrating systems.

Common mistakes

  • Putting eigenvectors in P in a different order from the eigenvalues in D.
  • Writing P^{-1}DP instead of PDP^{-1}.
  • Using eigenvectors that are not independent, so P is not invertible.
  • Believing a repeated eigenvalue always means "not diagonalizable" (or never does). Count the eigenvectors.
  • Confusing diagonalizable with invertible. A matrix can be one without the other.

Try it: the Eigen Vector tool reports whether a matrix has a full set of independent eigenvectors, and flags defective matrices.

Related guides

Open the Eigen Vector tool →