Skip to main content

Diagonalization and Similarity

Diagonalization changes coordinates so that a linear transformation becomes simple. A diagonal matrix acts independently on coordinate axes; a diagonalizable matrix acts independently along eigenvector directions. Similarity formalizes the idea that two matrices can describe the same linear transformation in different bases.

This is where eigenvectors become computationally powerful. If a matrix can be written as A=PDP1A=PDP^{-1}, then powers, recurrences, and many qualitative questions reduce to the diagonal entries of DD. The matrix PP changes from eigenvector coordinates to standard coordinates, while P1P^{-1} changes back.

Definitions

Square matrices AA and BB are similar if there is an invertible matrix PP such that

B=P1AP.B=P^{-1}AP.

A matrix AA is diagonalizable if it is similar to a diagonal matrix:

P1AP=D.P^{-1}AP=D.

Equivalently,

A=PDP1.A=PDP^{-1}.

The columns of PP are usually chosen to be eigenvectors of AA, and the corresponding diagonal entries of DD are their eigenvalues.

The algebraic multiplicity of an eigenvalue is its multiplicity as a root of the characteristic polynomial. The geometric multiplicity is the dimension of its eigenspace.

Similarity is an equivalence relation: AA is similar to itself, similarity is symmetric, and similarity is transitive. Similar matrices represent the same linear map in different bases.

Key results

An n×nn\times n matrix AA is diagonalizable if and only if it has nn linearly independent eigenvectors. If P=[v1  vn]P=[\mathbf{v}_1\ \cdots\ \mathbf{v}_n] and Avi=λiviA\mathbf{v}_i=\lambda_i\mathbf{v}_i, then

AP=[Av1Avn]=[λ1v1λnvn]=PD.AP= \begin{bmatrix} A\mathbf{v}_1&\cdots&A\mathbf{v}_n \end{bmatrix} = \begin{bmatrix} \lambda_1\mathbf{v}_1&\cdots&\lambda_n\mathbf{v}_n \end{bmatrix} =PD.

Multiplying by P1P^{-1} gives P1AP=DP^{-1}AP=D.

If an n×nn\times n matrix has nn distinct eigenvalues, then it is diagonalizable, because eigenvectors corresponding to distinct eigenvalues are linearly independent. The converse is false: a diagonalizable matrix can have repeated eigenvalues as long as the eigenspaces are large enough.

For each eigenvalue,

1geometric multiplicityalgebraic multiplicity.1\leq \text{geometric multiplicity}\leq \text{algebraic multiplicity}.

A matrix is diagonalizable exactly when the sum of the geometric multiplicities of its eigenvalues is nn.

If A=PDP1A=PDP^{-1}, then powers are easy:

Ak=PDkP1.A^k=PD^kP^{-1}.

This works because the middle factors cancel:

A2=(PDP1)(PDP1)=PD2P1.A^2=(PDP^{-1})(PDP^{-1})=PD^2P^{-1}.

The same cancellation repeats for higher powers.

Similarity preserves the characteristic polynomial. If B=P1APB=P^{-1}AP, then

det(λIB)=det(λIP1AP)=det(P1(λIA)P).\det(\lambda I-B) = \det(\lambda I-P^{-1}AP) = \det(P^{-1}(\lambda I-A)P).

Using multiplicativity of determinants gives

det(P1)det(λIA)det(P)=det(λIA),\det(P^{-1})\det(\lambda I-A)\det(P)=\det(\lambda I-A),

because det(P1)det(P)=1\det(P^{-1})\det(P)=1. Therefore similar matrices have the same eigenvalues, determinant, and trace. They may look different entry by entry, but their coordinate-independent spectral information is the same.

Diagonalization is best understood as an eigenbasis test. The standard basis vectors are ideal for a diagonal matrix because each one is an eigenvector. A diagonalizable matrix is one whose action becomes diagonal after choosing a better basis. In that basis, the first coordinate evolves independently from the second, the second independently from the third, and so on. Coupled equations become uncoupled scalar equations.

Not every failure of diagonalization is caused by missing eigenvalues. A matrix can have all eigenvalues real and still lack enough independent eigenvectors. The matrix

[1101]\begin{bmatrix} 1&1\\ 0&1 \end{bmatrix}

has only the eigenvalue 11, and its eigenspace is one-dimensional. Since a 2×22\times2 matrix needs two independent eigenvectors to be diagonalizable, it fails the test. This kind of example is the reason geometric multiplicity matters.

When diagonalization is available, it is especially effective for discrete dynamical systems. If xk+1=Axk\mathbf{x}_{k+1}=A\mathbf{x}_k and A=PDP1A=PDP^{-1}, then

xk=Akx0=PDkP1x0.\mathbf{x}_k=A^k\mathbf{x}_0=PD^kP^{-1}\mathbf{x}_0.

The entries of DkD^k are powers of eigenvalues. Large absolute eigenvalues dominate long-term behavior, eigenvalues with absolute value less than one decay, and negative eigenvalues alternate signs. This is the bridge from algebraic factorization to qualitative dynamics.

Visual

PropertySimilar matricesDiagonalizable matrices
DefinitionB=P1APB=P^{-1}APP1AP=DP^{-1}AP=D diagonal
Preserves eigenvaluesyesyes
Preserves determinant and traceyesyes
Requires eigenbasisnoyes
Main usechange coordinatescompute powers and decouple dynamics

Worked example 1: Diagonalize a 2 by 2 matrix

Problem: diagonalize

A=[4123].A= \begin{bmatrix} 4&1\\ 2&3 \end{bmatrix}.

Step 1: use the eigenpairs from the eigenvalue computation:

λ1=5,v1=[11],λ2=2,v2=[12].\lambda_1=5,\quad \mathbf{v}_1=\begin{bmatrix}1\\1\end{bmatrix}, \qquad \lambda_2=2,\quad \mathbf{v}_2=\begin{bmatrix}1\\-2\end{bmatrix}.

Step 2: build PP from the eigenvectors and DD from the matching eigenvalues:

P=[1112],D=[5002].P= \begin{bmatrix} 1&1\\ 1&-2 \end{bmatrix}, \qquad D= \begin{bmatrix} 5&0\\ 0&2 \end{bmatrix}.

Step 3: compute P1P^{-1}. Since det(P)=3\det(P)=-3,

P1=13[2111]=[2/31/31/31/3].P^{-1} = \frac{1}{-3} \begin{bmatrix} -2&-1\\ -1&1 \end{bmatrix} = \begin{bmatrix} 2/3&1/3\\ 1/3&-1/3 \end{bmatrix}.

Step 4: verify A=PDP1A=PDP^{-1}. First compute

PD=[1112][5002]=[5254].PD= \begin{bmatrix} 1&1\\ 1&-2 \end{bmatrix} \begin{bmatrix} 5&0\\ 0&2 \end{bmatrix} = \begin{bmatrix} 5&2\\ 5&-4 \end{bmatrix}.

Then

PDP1=[5254][2/31/31/31/3]=[4123].PDP^{-1} = \begin{bmatrix} 5&2\\ 5&-4 \end{bmatrix} \begin{bmatrix} 2/3&1/3\\ 1/3&-1/3 \end{bmatrix} = \begin{bmatrix} 4&1\\ 2&3 \end{bmatrix}.

Checked answer: A=PDP1A=PDP^{-1}.

Worked example 2: Use diagonalization to compute a power

Problem: compute A3A^3 for the same matrix.

Step 1: use

A3=PD3P1.A^3=PD^3P^{-1}.

Step 2: cube the diagonal matrix entrywise:

D3=[530023]=[125008].D^3= \begin{bmatrix} 5^3&0\\ 0&2^3 \end{bmatrix} = \begin{bmatrix} 125&0\\ 0&8 \end{bmatrix}.

Step 3: multiply.

PD3=[1112][125008]=[125812516].PD^3= \begin{bmatrix} 1&1\\ 1&-2 \end{bmatrix} \begin{bmatrix} 125&0\\ 0&8 \end{bmatrix} = \begin{bmatrix} 125&8\\ 125&-16 \end{bmatrix}.

Now

PD3P1=[125812516][2/31/31/31/3]=[86397847].PD^3P^{-1} = \begin{bmatrix} 125&8\\ 125&-16 \end{bmatrix} \begin{bmatrix} 2/3&1/3\\ 1/3&-1/3 \end{bmatrix} = \begin{bmatrix} 86&39\\ 78&47 \end{bmatrix}.

Step 4: check by repeated multiplication. A2=[1871411]A^2=\begin{bmatrix}18&7\\14&11\end{bmatrix}, and

A3=A2A=[1871411][4123]=[86397847].A^3=A^2A= \begin{bmatrix} 18&7\\ 14&11 \end{bmatrix} \begin{bmatrix} 4&1\\ 2&3 \end{bmatrix} = \begin{bmatrix} 86&39\\ 78&47 \end{bmatrix}.

Checked answer: A3=[86397847]A^3=\begin{bmatrix}86&39\\78&47\end{bmatrix}.

Code

import numpy as np

A = np.array([[4, 1],
[2, 3]], dtype=float)

values, P = np.linalg.eig(A)
D = np.diag(values)
A_rebuilt = P @ D @ np.linalg.inv(P)

print(values)
print(A_rebuilt)
print(np.linalg.matrix_power(A, 3))
print(P @ np.linalg.matrix_power(D, 3) @ np.linalg.inv(P))

Numerical eigensolvers may return eigenvectors scaled differently or ordered differently. The diagonalization is valid as long as the columns of PP match the corresponding diagonal entries of DD.

Common pitfalls

  • Putting eigenvalues in DD in an order that does not match the eigenvectors in PP.
  • Assuming a repeated eigenvalue automatically prevents diagonalization. It depends on eigenspace dimension.
  • Assuming every matrix is diagonalizable. Some matrices do not have enough independent eigenvectors.
  • Confusing P1AP=DP^{-1}AP=D with PAP1=DPAP^{-1}=D. The basis-change order matters.
  • Forgetting that similar matrices are the same size.
  • Computing powers as PkDk(P1)kP^kD^k(P^{-1})^k. The cancellation gives PDkP1PD^kP^{-1}, not that expression.

The most important diagnostic for diagonalization is the eigenvector count. After finding each eigenspace, add their dimensions. If the total is nn for an n×nn\times n matrix, the matrix is diagonalizable. If the total is less than nn, it is not. Distinct eigenvalues are a convenient sufficient condition, but they are not the definition.

When constructing PP, order is bookkeeping. If the first column of PP is an eigenvector for λ=5\lambda=5, then the first diagonal entry of DD must be 55. If the second column is an eigenvector for λ=2\lambda=2, the second diagonal entry must be 22. Many incorrect diagonalizations come from correct eigenvectors and correct eigenvalues placed in mismatched order.

Similarity should be read as a change of coordinates, not as an arbitrary algebraic trick. The matrix P1P^{-1} converts a standard-coordinate input into coordinates in the new basis. The diagonal matrix DD performs the simple action in that basis. The matrix PP converts the result back. This interpretation makes the formula A=PDP1A=PDP^{-1} natural.

Diagonalization is powerful but not always numerically ideal. If the eigenvector matrix PP is poorly conditioned, computations using PDP1PDP^{-1} may amplify rounding error. Orthogonal diagonalization for symmetric matrices avoids this issue because orthogonal matrices preserve lengths and have condition number 11 in the Euclidean norm. This is one reason symmetric eigenvalue problems are especially well behaved.

A diagonal form also makes invariant subspaces visible. Each coordinate axis in the diagonal basis is preserved by the transformation. If several eigenvectors correspond to the same eigenvalue, every vector in their eigenspace is preserved as a direction up to the same scaling. This explains why repeated eigenvalues can still be harmless when their eigenspaces are large enough.

Similarity is not the same as row equivalence. Row-equivalent matrices arise from left multiplication by elementary matrices and generally do not have the same eigenvalues. Similar matrices involve both P1P^{-1} and PP, representing a change of basis in the same space, and they preserve spectral data. Confusing these two equivalence notions leads to incorrect eigenvalue arguments.

When a matrix is not diagonalizable, one can still study it through other forms, such as Jordan form in more advanced courses or Schur form in numerical work. The introductory lesson is simpler: diagonalization is a powerful special case, and the test is the existence of an eigenbasis.

A good final verification is to multiply APAP and PDPD. If the columns of PP are correctly matched with the diagonal entries of DD, these two products are equal. This avoids computing P1P^{-1} just to check the eigenvector pairing.

This check catches most ordering mistakes.

Connections