# Understanding the formula for a diagonal matrix $A = P^{-1}DP$.

I'm trying to understand the procedure for finding the powers of a matrix using the diagonal relation $A^n = P^{-1}D^nP$. Here's what I understand so far.

• We find eigenvalues of A. The matrix D is formed with eigenvalues in the diagonal line and zeros everywhere else. The order of entering diagonal values doesn't matter.
• The matrix $P$ is a matrix that contains eigenvectors of $A$. Again, the order does not matter.

Is this right? I'm assuming matrix is nice (invertible etc). Am I right in thinking that the diagonal matrix itself isn't useful (i.e. doesn't give you $A^2$ unless you find $P$ and $P^{-1}$ too).

• The order of the eigenvectors in $P$ has to match the order of the eigenvalues in $D$ – Omnomnomnom Jul 23 '18 at 23:19
• @Omnomnomnom Could you elaborate please? Say I've my eigenvalue entries as $a_{11} = \lambda_1, a_{22} = \lambda_2, \ldots$. – Notsredt Jul 23 '18 at 23:23
• You're assuming the matrix is diagonalizable, which requires that for each eigenvalue the algebraic multiplicity equals the geometric multiplicity. You can have singular matrices which are diagonalizable, e.g. the zero matrix. You cannot find $A$ with just $D$, since distinct matrices can have the same eigenvalues. – Thoth Jul 23 '18 at 23:23
• @Thoth Thanks. Makes sense. – Notsredt Jul 23 '18 at 23:35

Indicating the eigenvalues along the diagonal $D$ with $\lambda_i=D_{ii}$ we need that the corresponding eigenvectors $\vec v_i$ are placed as the i-th column of the matrix $P$.
Therefore the order of the eigenvalues in $D$ doesn't matter but the corresponding eigenvectors must be placed in $P$ accordingly and viceversa.
• Thanks. When does $A^n = P^{-1}A^{n}P$? I had a question which asked me to find the diagonalisation of a matrix $M^2$ which it said can be obtained as $P^{-1}M^2P$. I was expecting $P^{-1}D^2P$, which threw me off. – Notsredt Jul 23 '18 at 23:38
• @Farthing Once we have the diagonalization $M=P^{-1}DP$ we are done indeed $M^2=P^{-1}DPP^{-1}DP=P^{-1}D^2P$. – gimusi Jul 23 '18 at 23:44