Module 6: Eigenvalues
Diagonalization is the process of expressing a matrix in its "natural coordinate system" — aligned with the eigenvectors — where it becomes as simple as possible.
If A has n linearly independent eigenvectors v1,v2, then:
where P has the eigenvectors as columns, and D is diagonal with eigenvalues:
Think of Ax as three steps:
Not every matrix is diagonalizable over ℝ:
Rotation matrices are the classic example: no real eigenvectors, can't be diagonalized over ℝ.
Edit the matrix and see the P, D, P⁻¹ decomposition. The product P·D·P⁻¹ should reconstruct A exactly. Try a rotation matrix — it will report that diagonalization fails.
import numpy as np
A = np.array([[3, 1], [1, 3]])
eigenvalues, P = np.linalg.eig(A)
D = np.diag(eigenvalues)
P_inv = np.linalg.inv(P)
# A^10 = P @ D^10 @ P_inv
A_power_10 = P @ np.diag(eigenvalues**10) @ P_inv
print(np.allclose(A_power_10, np.linalg.matrix_power(A, 10))) # TrueA = P · D · P⁻¹
Columns of P are the eigenvectors. D has eigenvalues on the diagonal.
Try a rotation matrix — it can't be diagonalized over ℝ.