# finding the P matrix (diagonalization of a matrix)

I'm trying to find the diagonalization of a matrix :

this is my matrix :

$$A =\begin{pmatrix} 0 & -1 & 0 \\ -1 & 0 & 0 \\ 1 & 1 & 1 \\ \end{pmatrix}$$

for the eigenvalues I found :

$$l_1 = l_2 = 1\quad; \quad l_3=-1$$

and for the eigenvectors I found :

$$v_1 =\begin{pmatrix} -1\\-1\\1 \end{pmatrix}$$ $$v_2=\begin{pmatrix} 0\\0\\1 \end{pmatrix}\quad\text{and}\quad v_3 =\begin{pmatrix} -1\\1\\0 \end{pmatrix}$$

but if I want to find the matrice P will it be :

$$A =\begin{pmatrix} 0 & -1 & 1 \\ 0 & 1 & 1 \\ 1 & 0 & -1 \\ \end{pmatrix}$$

Or:

$$A =\begin{pmatrix} -1 & 0 & 1 \\ 1 & 0 & 1 \\ 0 & 1 & -1 \\ \end{pmatrix}$$

Or:

$$A =\begin{pmatrix} 1 & 0 & -1 \\ 1 & 0 & 1 \\ -1 & 1 & 0 \\ \end{pmatrix}$$

etc....

I mean there is many ways to write the P matrix, but which one is the correct one ?

• They're all correct. Every $P^{-1}AP$ will be diagonal. But the diagonal elements (= eigenvalues) are shuffled from one to the other. – Julien Apr 29 '13 at 20:27
• @Amzoti That's too kind, but thanks! – Julien Apr 30 '13 at 3:02

It depends on how you write the diagonal matrix. Let's assume that $D=P^-1AP$. Let's assume that we have the following eigenvalues (they are not necessarily different), $\lambda_1 ,...\lambda_n$, with the following eigenvectors $\forall i \in [1,n], Av_i=\lambda_i v_i$.
If we write $D=diag(\lambda_1....\lambda_n)$, then $P=(v_1....v_n)$, meaning, we put the eigenvector in the column of the fitting eigenvalue in the diagonal matrix.