Find $P$ such that $P^{-1}AP$ is a given matrix 
Let
  $$A = \begin{pmatrix} 1 & -3 & 0 \\ 3 & 4 & -3 \\ 3 & 3 & -2\end{pmatrix}$$
  Find an invertible $P \in M_3(\mathbb{R})$ such that
  $$B = P^{-1}AP = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 3 \\ 0 & -3 & 1\end{pmatrix}$$

The problem is that the characteristic polynomial of both $A$ and $B$ is $-(\lambda-1)(\lambda^2 - 2\lambda+10)$, which has imaginary root, so I can't just straight up find the diagonalization decomposition of $A$ and $B$ and multiply them, as $P$ might contain complex number, which isn't what I need.
Rational canonical form might work, but that is beyond my ability.
Any solution/helps would be appreciated. 
 A: Observe that the entries of the $2\times2$ block aren’t just any old values. They are the real and imaginary parts of the complex eigenvalues of $A$. Here are some useful facts about complex eigenvectors and eigenvalues of a real matrix.  


*

*If $A\mathbf v=\lambda\mathbf v$, then $\overline{A\mathbf v} = A\overline{\mathbf v} = \overline\lambda\overline{\mathbf v}.$ In other words, complex eigenvalues of a real matrix come in conjugate pairs, and you can find corresponding eigenvectors that are also complex conjugates. Note also that since they are eigenvectors with distinct eigenvalues, they are linearly independent.

*If $\mathbf v$ is a complex eigenvector of the $n\times n$ matrix $A$ with eigenvalue $\lambda = \alpha+i\beta$, then its real and imaginary parts span an invariant subspace of $A$: $$A(\Re(\mathbf v)) = \frac12A(\mathbf v+\overline{\mathbf v}) = \frac12\left((\alpha+i \beta)\mathbf v+(\alpha-i\beta)\overline{\mathbf v}\right) = \alpha\Re(\mathbf v)-\beta\Im(\mathbf v) \\ 
A(\Im(\mathbf v)) = -\frac i2A(\mathbf v-\overline{\mathbf v}) = -\frac i2\left((\alpha+i\beta)\mathbf v-(\alpha-i\beta)\overline{\mathbf v}\right) = \beta\Re(\mathbf v)+\alpha\Im(\mathbf v).$$

*The real and imaginary parts of a complex eigenvalue are linearly independent: If we have $$c_1\Re(\mathbf v)+c_2\Im(\mathbf v) = \frac{c_1}2(\mathbf v+\overline{\mathbf v})-i\frac{c_2}2(\mathbf v-\overline{\mathbf v}) = \frac12(c_1-ic_2)\mathbf v +\frac12(c_1+ic_2)\overline{\mathbf v} = 0,$$ then because $\mathbf v$ and $\overline{\mathbf v}$ are linearly independent $c_1+ic_2=c_1-ic_2=0$, therefore $c_1=c_2=0$. As a consequence, $\operatorname{span}\{\Re(\mathbf v),\Im(\mathbf v)\}=\operatorname{span}\{\mathbf v,\overline{\mathbf v}\}$.  
The upshot of the above is that if a real matrix $A$ is diagonalizable over $\mathbb C$, then it is block-diagonalizable over $\mathbb R$, with a block of the form $\small{\begin{bmatrix}\alpha&\beta\\-\beta&\alpha\end{bmatrix}}$ for each pair $\alpha\pm i\beta$ of complex conjugate eigenvalues (with appropriate multiplicity, of course). For the corresponding basis vectors you can choose the real and imaginary parts of a complex eigenvector of $A$ with eigenvalue $\alpha+i\beta$. (There’s a similar result for the Jordan normal form; see this Wikipedia article.)  
Applying this to your matrix, we see that the first column of $P$ must be an eigenvector of $1$, while the other columns should be the real and imaginary parts, respectively, of an eigenvector of $1+3i$. I expect that you know how to find suitable eigenvectors.  
Note that this method is complementary to Andrew Ostergaard’s answer. If the real matrix $A$ has complex eigenvalues $\alpha\pm i\beta$, then its characteristic polynomial will have a factor of $$(\lambda-(\alpha+i\beta))(\lambda-(\alpha-i\beta)) = \lambda^2-2\alpha\lambda+(\alpha^2+\beta^2)$$ that is irreducible over $\mathbb R$. The corresponding eigenvectors $\mathbf v$ and $\overline{\mathbf v}$ thus lie in the null space of $A^2-2\alpha A+(\alpha^2+\beta^2) I$, and since the real and imaginary parts of these two vectors are linear combinations of them, they also lie in this space. An advantage of the approach in this answer over directly computing a basis for this null space is that it allows you to get the correct order of the basis vectors right off the bat.
A: Let $P=\begin{pmatrix} 1 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 1 & 0 \end{pmatrix}$. $\;$ You can check that $P^{-1}AP=\begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 3 \\ 0 & -3 & 1 \end{pmatrix}=B$.
The way I found this matrix was as follows: in order to have $P^{-1}AP=B$, $P$ must send the standard basis vector $e_1$ to an eigenvector of the eigenvalue $1$. The eigenvectors for the eigenvalue $1$ are elements of $\ker(A-I)$. Note that $A-I$ is what you get when you plug $A$ into $x-1$.
Note that $A-I=\begin{pmatrix} 0 & -3 & 0 \\ 3 & 3 & -3 \\ 3 & 3 & -3 \end{pmatrix}$, $\;$ and $\text{rref}(A-I)=\begin{pmatrix} 1 & 0 & -1 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{pmatrix}$.
So I let $P(e_1)=\begin{pmatrix} 1 \\ 0 \\ 1 \end{pmatrix}$.
It remains to find out where $P$ should send $e_2$ and $e_3$. I found these vectors as follows: since the characteristic polynomial of $A$ is
$$c_A(x)=(x-1)(x^2-2x+10)$$
I found $P(e_2)$, $P(e_3)$ by finding a basis for $\ker(A^2-2A+10I)$. Note that $A^2-2A+10I$ is what you get when you plug $A$ into $x^2-2x+10$.
Note that $A^2-2A+10I=\begin{pmatrix} 0 & -9 & 9 \\ 0 & 0 & 0 \\ 0 & -9 & 9 \end{pmatrix}$, $\;$ and $\text{rref}(A^2-2A+10I)=\begin{pmatrix} 0 & 1 & -1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}$.
So I let $P(e_2)=\begin{pmatrix} 0 \\ 1 \\ 1 \end{pmatrix}$ and $P(e_3)=\begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix}$. $\;$ Hence $P=\begin{pmatrix} 1 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 1 & 0 \end{pmatrix}$, $\;$ and $P^{-1}AP=B$.
