Let $A=\begin{pmatrix} a & b \\ c& d \end{pmatrix}$ be a $2 \times 2$ matrix witth eigenvalue $\lambda$.
(a) Show that unless it is zero, the vector $\begin{pmatrix} b \\ \lambda -a \end{pmatrix}$ is an eigenvector (I solved this)
(b) Find a matrix $P$ such that $P^{-1}AP$ is diagonal, assuming that $b \neq 0$ and that $A$ has distinct eigenvalues.
I need help with (b). Here is what I tried:
I know that if I consider the canonical basis of $ \mathcal{M}_2(\mathbb{R})$, then one of the two colums of $P$ has the components of the eigenvector we considered in question (a). But how do I find the other column?
I tried looking for the eigenvalues of $A$ from scratch but I get a messy expression.
Let's call the two eigenvalues $\lambda_1$ and $\lambda_2$.
Note that the sum of the eigenvalues is equal to the trace of the matrix. That is: $$\lambda_1 + \lambda_2 = a+d$$
Then $$\lambda_2= a+d-\lambda_1$$
You showed that for any eigenvalue $r$, $\pmatrix{b\\r - a}$ is an eigenvector. Thus, for $\mu$, $\pmatrix{b\\\mu-a}$ is an eigenvector. Thus, our two eigenvectors are: $$\begin{align} \vec{v}_1 &= \pmatrix{b\\\lambda_1 - a} \\ \vec{v}_2 &= \pmatrix{b\\\lambda_2- a} = \pmatrix{b\\-\lambda_1+ d} \end{align}$$
We know that to find the eigendecomposition of a matrix $A$, we let $P$ be the matrix with columns corresponding to the eigenvectors and $$\Lambda = \pmatrix{\lambda_1 & 0 \\ 0 & \lambda_2}$$
Then, $A = P\Lambda P^{-1}$.
So, for this case $$P = \pmatrix{b & b \\ \lambda_1 - a & -\lambda_1 + d}$$