Diagonalizing a Matrix

Working with matrices can often be computationally intensive, especially when performing operations like raising a matrix to a high power. Matrix diagonalization offers a powerful simplification by transforming a matrix into a special form where its eigenvalues are arranged along the main diagonal. This transformation leverages the matrix's eigenvectors to create a new basis, making many complex matrix computations significantly easier and more intuitive. Understanding diagonalization is crucial for advanced topics in linear algebra, differential equations, and quantum mechanics.

The Diagonalization Formula: A=PDP1A = PDP^{-1}

A square matrix AA is diagonalizable if it can be expressed in the form A=PDP1A = PDP^{-1}. Here, DD is a diagonal matrix containing the eigenvalues of AA, and PP is an invertible matrix whose columns are the corresponding eigenvectors of AA. The matrix P1P^{-1} is the inverse of PP. This equation effectively states that matrix AA can be transformed into a diagonal matrix DD by a change of basis defined by PP and P1P^{-1}.

📐 Diagonalization Equation

The fundamental equation for matrix diagonalization is:

A=PDP1A = PDP^{-1}

Where:
- AA is the original square matrix.
- PP is a matrix whose columns are the linearly independent eigenvectors of AA.
- DD is a diagonal matrix whose diagonal entries are the eigenvalues of AA, corresponding to the order of eigenvectors in PP.
- P1P^{-1} is the inverse of the matrix PP.

Why Diagonalize? Simplifying Matrix Powers

One of the most significant applications of diagonalization is simplifying the computation of matrix powers. Calculating AkA^k directly involves k1k-1 matrix multiplications, which can be computationally expensive for large kk. However, if A=PDP1A = PDP^{-1}, then AkA^k simplifies dramatically. Notice that A2=(PDP1)(PDP1)=PD(P1P)DP1=PDIDP1=PD2P1A^2 = (PDP^{-1})(PDP^{-1}) = PD(P^{-1}P)DP^{-1} = PDIDP^{-1} = PD^2P^{-1}. This pattern extends, meaning Ak=PDkP1A^k = PD^kP^{-1}. Since DD is a diagonal matrix, raising it to a power kk simply means raising each diagonal element to the power kk, which is a trivial operation.

pythonCalculating Matrix Powers Using Diagonalization
Check Your Understanding
Why is computing DkD^k significantly easier than AkA^k for a large kk?

Conditions for Diagonalizability

Not all square matrices can be diagonalized. A matrix AA is diagonalizable if and only if it has a complete set of linearly independent eigenvectors. For an n×nn \times n matrix, this means there must be nn linearly independent eigenvectors. This condition is always met if all eigenvalues are distinct. If eigenvalues are repeated, the matrix might still be diagonalizable, but only if the geometric multiplicity (the number of linearly independent eigenvectors for a given eigenvalue) equals its algebraic multiplicity (the number of times an eigenvalue is repeated as a root of the characteristic polynomial).

💡 Multiplicity Matters

For a matrix to be diagonalizable, for every eigenvalue λ\lambda, its geometric multiplicity (dimension of the eigenspace EλE_\lambda) must equal its algebraic multiplicity (number of times λ\lambda is a root of the characteristic polynomial). The geometric multiplicity is always less than or equal to the algebraic multiplicity, 1geom mult(λ)alg mult(λ)1 \leq \text{geom mult}(\lambda) \leq \text{alg mult}(\lambda).

Step-by-Step Diagonalization Process

Diagonalizing a matrix involves a systematic procedure that combines finding eigenvalues, determining their corresponding eigenvectors, and then assembling these components into the PP and DD matrices. This process ensures that the resulting diagonal form accurately represents the original matrix's linear transformation in a simplified basis. Following these steps carefully is essential to correctly diagonalize a matrix and unlock its computational advantages.

Matrix Diagonalization Workflow
Loading diagram...
The process of diagonalizing a matrix, from finding eigenvalues to verifying the result.

Step 1: Find Eigenvalues

The first step is to find the eigenvalues of the matrix AA. These are the scalar values λ\lambda that satisfy the characteristic equation det(AλI)=0\det(A - \lambda I) = 0, where II is the identity matrix. Solving this polynomial equation yields the eigenvalues. For an n×nn \times n matrix, there will be nn eigenvalues (counting multiplicity), which can be real or complex.

pythonFinding Eigenvalues of a Matrix

Step 2: Find Eigenvectors

For each eigenvalue λi\lambda_i, we must find its corresponding eigenvector viv_i. An eigenvector viv_i satisfies the equation Avi=λiviAv_i = \lambda_i v_i, which can be rewritten as (AλiI)vi=0(A - \lambda_i I)v_i = 0. This involves solving a system of linear equations. The eigenvectors form the basis vectors of the eigenspaces, and their linear independence is critical for diagonalization. If we cannot find nn linearly independent eigenvectors for an n×nn \times n matrix, it is not diagonalizable.

pythonFinding Eigenvectors for Each Eigenvalue

Step 3: Construct P and D

Once you have the eigenvalues and their corresponding eigenvectors, you can construct the matrices PP and DD. The matrix PP is formed by placing the eigenvectors as its columns. The matrix DD is a diagonal matrix where the diagonal entries are the eigenvalues, arranged in the same order as their corresponding eigenvectors in PP. For example, if v1v_1 is the first column of PP, then λ1\lambda_1 must be the first diagonal entry of DD.

Order Consistency

The order of eigenvectors in PP must precisely match the order of eigenvalues in DD. If

P=(v1v2vn)P = \begin{pmatrix} v_1 & v_2 & \dots & v_n \end{pmatrix}
, then
D=(λ1000λ2000λn)D = \begin{pmatrix} \lambda_1 & 0 & \dots & 0 \\ 0 & \lambda_2 & \dots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \dots & \lambda_n \end{pmatrix}
.

Step 4: Compute P1P^{-1} and Verify

The final step involves computing the inverse of the eigenvector matrix, P1P^{-1}. This is possible only if PP is invertible, which is guaranteed if its columns (the eigenvectors) are linearly independent. After calculating P1P^{-1}, you can verify the diagonalization by computing PDP1PDP^{-1} and confirming that it equals the original matrix AA. This verification step is crucial to ensure all calculations were performed correctly and that the matrix is indeed diagonalizable.

pythonConstructing P, D, $P^{-1}$ and Verifying Diagonalization
Try It Yourself
Modify the A matrix in the code example to np.array([[5, -6], [1, 0]]). Then, run the code to find its eigenvalues, eigenvectors, and verify its diagonalization. What are the eigenvalues and the reconstructed matrix?
python
Check Your Understanding
What property of the eigenvectors allows the matrix P to be invertible?

When Diagonalization Fails: Non-Diagonalizable Matrices

A matrix is not diagonalizable if it does not possess a complete set of linearly independent eigenvectors. This often occurs when an eigenvalue has an algebraic multiplicity greater than its geometric multiplicity. In such cases, you cannot form an invertible matrix PP from the eigenvectors, because you won't have enough linearly independent columns. These matrices are sometimes called defective matrices. While they cannot be diagonalized, they can often be transformed into a Jordan canonical form, which is the closest equivalent to a diagonal matrix.

pythonExample of a Non-Diagonalizable Matrix
Key Takeaways
  • Matrix diagonalization expresses a square matrix AA as PDP1PDP^{-1}, where DD is a diagonal matrix of eigenvalues and PP is a matrix of corresponding eigenvectors.

  • Diagonalization significantly simplifies computing matrix powers, as Ak=PDkP1A^k = PD^kP^{-1}, reducing complex matrix multiplication to scalar exponentiation of eigenvalues.

  • A matrix is diagonalizable if and only if it has a complete set of linearly independent eigenvectors, meaning nn independent eigenvectors for an n×nn \times n matrix.

  • The order of eigenvectors in PP must consistently match the order of eigenvalues in DD for the diagonalization to be valid.

  • A matrix is not diagonalizable if it lacks a full set of linearly independent eigenvectors, often occurring when an eigenvalue's algebraic multiplicity exceeds its geometric multiplicity.

  • The process involves finding eigenvalues, then their eigenvectors, constructing PP and DD, computing P1P^{-1}, and finally verifying A=PDP1A = PDP^{-1}.

← All lessons in Linear Algebra: Eigenvalues

Ready to keep this from fading?

Bitelrn turns lessons like this into a full course — quizzes, a knowledge map, and spaced review.

Get started free