Let $A=\begin{bmatrix}1 & 3 & 3\\3 & 1 & 3\\-3 & -3 & -5\end{bmatrix}.$
I've computed the characteristic polynomial $\text{char(x)}=(x-1)(x+2)^2$ and minimum polynomial $\text{min(x)}=(x-1)(x+2)$. Also, I know that the rational form of $A$ will be:
$\begin{bmatrix}0 & 2 & 0\\1 & -1 & 0\\ 0 & 0 & 2\end{bmatrix}.$
Where I'm stuck is trying to find a $P$ such that $PAP^{-1}$ will equal the rational canonical form. I understand finding the basis for the kernel of the invariant spaces, but I get stuck after that.
Let $A\in M_n(K)$, $p(x)$ be its characteristic polynomial and $m(x)$ be its minimal polynomial. Recall (for those who do not know) that the rational canonical form of $A\in M_n(K)$ satisfies (in particular) that follows:
$F=diag(F_1,\cdots,F_k)\in M_n(K)$ where $F_i$ is the companion matrix of $p_i(x)\in K[x]$, $p_i$ is a divisor of $p_{i+1}$, $p_1\cdots p_k=p$ and $p_k=m$.
Here $p_1(x)=x+2,p_2(x)=(x-1)(x+2)$.
We take $e_1=[1,0,-1]^T\in\ker(A+2I)$.
For $e_2$ we choose a random vector, for example, $e_2=[1,0,0]^T$. It does not seem very random; yet, if it is not convenient, then pick another vector.
Let $e_3=Ae_2=[1,3,-3]^T$ (since $e_1,e_2,e_3$ is a basis, our choice was convenient) ; then $Ae_3=2e_2-e_3$ and we are done.