Using EigenValues to form a diagonal matrix

After going through my Linear algebra note, I know if for any matrix $A$, we find the eigenvalues and eigenvectors , we can construct a matrix P, such that $P^{-1}AP$ is a diagonal matrix.
Now for this matrix for example
$\left( \begin{array}{ccc} 1 & -2 \\ 1 & 4 \end{array} \right)$
I found that that the EigenValues are $3,2$ and the eigenvectors are;
$\left( \begin{array}{ccc} 1 \\ -1 \end{array} \right)$ , $\left( \begin{array}{ccc} 1 \\ -2 \end{array} \right)$
so now using these eigenvectors as columns, I construct matrix $P$; $\left( \begin{array}{ccc} 1 & 1 \\ -1 & -2 \end{array} \right)$ and find that $P^{-1}$ is $\left( \begin{array}{ccc} -1 & -1 \\ 2 & 1 \end{array} \right)$. So going by the examples online and my lecture notes $P^{-1}AP$ should give me a diagonal matrix with the diagonal entries being the eigenvalues. Like this $\left( \begin{array}{ccc} 2 & 0 \\ 0 & 3 \end{array} \right)$.
But when I multiply the matrices Ive got :
$P^{-1}AP$=$\left( \begin{array}{ccc} -1 & -1 \\ 2 & 1 \end{array} \right)$ $\left( \begin{array}{ccc} 1 & -2 \\ 1 & 4 \end{array} \right)$ $\left( \begin{array}{ccc} 1 & 1 \\ -1 & -2 \end{array} \right)$ = $\left( \begin{array}{ccc} 2 & 0 \\ 3 & 3 \end{array} \right)$.
Can anyone guide me to where I went wrong ?

• The eigenvector for $2$ is wrong. Mar 30, 2014 at 14:44
• Also, you've swapped the rows of your $P^{-1}$. This matters little, though, when as @GitGud says your $P$ was wrong already. Mar 30, 2014 at 14:48
• is it? If 2 is an eigenvalue then, $A$$v$=2$v$ and so by linear equations, $x-2y=2x$ and $x+4y=2y$ these yield the answer $x=-2y$ ... sorry have I done a silly mistake here somwhere? Thank you for your help. Mar 30, 2014 at 14:48
• @Kimo it would be nice if you'd post a correction as an answer yourself, so this question doesn't come up as unanswered. Mar 30, 2014 at 14:50
• Yes, ok, I will look back at this and try and figure out my mistake and post a correction. Mar 30, 2014 at 14:51

It was noted in the comments that the eigenvector for $2$ is wrong and the OP needs further help in finding an eigenvector for $2$.
Let $\begin{pmatrix} v_1\\ v_2\end{pmatrix}$ be an eigenvector for $2$. It holds that $\begin{pmatrix} 1 & -2\\ 1 & 4\end{pmatrix}\begin{pmatrix} v_1\\ v_2\end{pmatrix}=2\begin{pmatrix} v_1\\ v_2\end{pmatrix}$ and this is equivalent to $\begin{cases} v_1-2v_2&=2v_1\\ v_1+4v_2&=2v_2\end{cases}$, which in turn is equivalent to $v_1+2v_2=0$ (or $v_1=-2v_2$). Since $v$ is an eigenvector, it is not null, so take for instance $v_2=1$ to get $\begin{pmatrix} -2\\ 1\end{pmatrix}$.
• @Kimo It's no bother. It's always useful to check your computations after you find eigenvectors. By multiplying $Av$ you'd see that $Av\neq 2v$, that's how I quickly found what was wrong. Mar 30, 2014 at 15:17