# Diagonalize matrix

I am sorry if this is stupid in advance. I know how to find eigenvalues of a matrix, but I don't understand how I am suppose to know in which order I am supposed to apply them, in order to find eigenvectors?

Example:

$$A=\begin{pmatrix} -3 & 2 & 2 \\ 2 & -3 & 2 \\ 2 & 2 & -3 \\ \end{pmatrix}$$ Which has eigenvalues of -5,-5,1.

Eigenvector of -5 is:

$$E(-5)=y\begin{pmatrix} -1\\ 1 \\ 0 \\ \end{pmatrix}+z\begin{pmatrix} -1\\ 0 \\ 1 \\ \end{pmatrix}$$

Eigenvector of 1 is $$E(1)=y\begin{pmatrix} 1\\ 1 \\ 1 \\ \end{pmatrix}$$

So basically that's ok. Now, how I am supposed in which order I should reorganize these eigenvectors? I mean, the P could be: $$P_1=\begin{pmatrix} -1 & -1 & 1 \\ 1 & 0 & 1 \\ 0 & 1 & 1 \\ \end{pmatrix}=E(-5)+E(1)$$

But it also could be $$P_2=\begin{pmatrix} 1 & -1 & -1 \\ 1 & 1 & 0 \\ 1 & 0 & 1 \\ \end{pmatrix}=E(1)+E(-5)$$ But the $P_1^{-1}$ and $P_2^{-1}$ are different! Thus, $P_2^{-1}AP$ doesn't give an diagonalized matrix, but $P_1^{-1}AP$ does.

What did I miss? How I can be sure to rearrange eigenvector in right order before proceeding to calculate $P^{-1}$?

EDIT Ok thank you very much, I should have made some mistake when calculating one of inverse matrices. I understood that rearranging eigen(values/vectors) doesn't change the fact that I will still must get a diagonalized matrix at the end.

• So often what students think is "stupid" might just as well be called "related to learning". – The Count May 15 '17 at 21:50
• As long as the eigenvalues and eigenvectors line up, you get a diagonal matrix (no one said that a diagonalization is unique). – Michael Burr May 15 '17 at 21:54

$P_1^{-1} A P_1 = \begin{bmatrix} -5\\&-5\\&&1 \end{bmatrix}\\ P_2^{-1} A P_2 = \begin{bmatrix} 1\\&-5\\&&-5 \end{bmatrix}$

Here is what I think about.

$A\mathbf v_1 = \lambda_1\mathbf v_1\\ A\begin{bmatrix} \mathbf v_1,\mathbf v_2,\mathbf v_3\end{bmatrix} = \begin{bmatrix} \mathbf v_1,\mathbf v_2,\mathbf v_3\end{bmatrix}\begin{bmatrix} \lambda_1\\&\lambda_2\\&&\lambda_3\end{bmatrix}$

$P_1^{-1}AP_1$ are $P_2^{-1}AP_2$ are both diagonal matrices.

You are just reordering the eigenvalues for the diagonal matrices.

$$P_1^{-1}AP_1 = diag(-5, -5, 1)$$

$$P_2^{-1}AP_2 = diag(1, -5, -5)$$

If $Av_j = \lambda_j v_j$, then

$$A \begin{bmatrix} v_1 & \ldots & v_n\end{bmatrix} = \begin{bmatrix} v_1 & \ldots & v_n\end{bmatrix}diag(\lambda_1 , \ldots , \lambda_n)$$

Let $P = \begin{bmatrix} v_1 & \ldots & v_n\end{bmatrix}$ and $D= diag( \lambda_1 , \ldots , \lambda_n)$,

then we have $$AP=PD$$ and hence

$$P^{-1}AP=D$$

Note that the order of $v_i$ controls the order of $\lambda_i$ in the diagonal matrix.

• So actually I shoud have a mistake when calculating $$P_2^{-1}$$, right? Reordering eigenvalues doesn't change the fact that I shoud find a diagonalized matrix at the end? – dgan May 15 '17 at 21:58
• yup, theoretically, you should still get a diagonal matrix. The error could be in $P_2^{-1}$ or other calculations. – Siong Thye Goh May 15 '17 at 21:58