Choose axes the matrix loves
In standard coordinates a matrix can look tangled. But suppose we use its eigenvectors as the new axes — an eigenbasis. Along each axis the matrix does nothing but scale by that axis's eigenvalue. In those coordinates the matrix is diagonal: zeros everywhere except scale factors on the diagonal.
A = P * D * P^(-1) P = eigenvectors as columns D = eigenvalues on the diagonal, e.g. [[2,0],[0,3]] P^(-1) translates standard coords -> eigen coords
Why this makes powers trivial
Computing A^k directly means multiplying messy matrices over and over. With diagonalization, the inner P^(-1) and P cancel between repeats, leaving just D^k — and raising a diagonal matrix to a power means raising each diagonal entry to that power. That's it.
A^k = P * D^k * P^(-1) D = [[2,0],[0,3]] D^10 = [[1024,0],[0,59049]] (just 2^10 and 3^10)
An honest caveat: not every matrix is diagonalizable
The whole trick needs P to be invertible, which means you need enough independent eigenvectors to fill the basis — n of them for an n-by-n matrix. Some matrices simply do not have that many, and they cannot be diagonalized over the reals.
- Take the shear A = [[1,1],[0,1]] and solve det(A - lambda*I) = (1-lambda)^2 = 0.
- The only eigenvalue is lambda = 1, repeated twice — but it yields just one direction of eigenvectors, (1,0).
- One independent eigenvector cannot fill a 2D basis, so P is not invertible and the shear is not diagonalizable.