Finding the transition matrix for the rational canonical form Let $A$ be the $3\times3$ matrix
$$\begin{bmatrix} 3 &  4 & 0 \\-1 & -3 & -2 \\ 1 & 2 & 1 \end{bmatrix}$$
The characterisitc and minimal polynomials are both $(x-1)^2(x+1)$
The eigenspace for $\lambda=1$ is 
$$\left\{ \begin{bmatrix} 2 \\-1 \\ 1 \end{bmatrix} \right\}$$
The eigenspace for $\lambda=-1$ is:
$$\left\{ \begin{bmatrix} 2 \\-2 \\ 1 \end{bmatrix} \right\}$$
The rational canonical form $R$ is:
$$\begin{bmatrix} -1 &  0 & 0 \\0 & 0 & -1 \\ 0 & 1 & 2 \end{bmatrix}$$
I want to find the transition matrix $P$ such that $A=PRP^{-1}$ 
I thought we had to find $3$ independent vectors...one from the eigenspace of $1$, another from the eigenspace of $-1$, and then any other third vector such that the three would be linearly independent. So I chose P to be:
$$\begin{bmatrix} 2 &  2 & 1 \\-2 & -1 & 0 \\ 1 & 1 & 0 \end{bmatrix}$$
But when I multiplied $PRP^{-1}$, I did not get $A$...I'm not sure why. 
I would appreciate it if anybody could tell me where I went wrong and how I can fix it. 
Thanks in advance

Hints:
We are given:
$$\tag 1 A = \begin{bmatrix} 3 &  4 & 0 \\-1 & -3 & -2 \\ 1 & 2 & 1 \end{bmatrix}$$
Jordan Form


*

*Correct on eigenvalues

*You need three independent eigenvectors, and one of those ends up being a generalized one.

*You would have, $A = P \cdot J\cdot P^{-1}$, where $J$ represents the Jordan Normal Form and is made up of the three eigenvalues plus the Jordan block and $P$ is made up of the three independent eigenvectors for the three eigenvalues.


We get:
$$A = P \cdot J \cdot P^{-1} = \begin{bmatrix} 2 & 2 & 1 \\ -2 & -1 & 0 \\ 1 & 1 & 0 \end{bmatrix} \cdot \begin{bmatrix} -1 & 0 & 0 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} 0 & -1 & -1 \\ 0 & 1 & 2 \\ 1 & 0 & -2 \end{bmatrix}$$
Rational Canonical Form
The characteristic polynomial for $(1)$ is:
$$-1 + x + x^2 - x^3 = (-1 + x)^2 (1 + x)$$
If we do the invariant factor decomposition, we write:
$$xI - A = \begin{bmatrix} x-3 & -4 & 0 \\ 1 & x+3 & 2 \\ -1 & -2 & x-1 \end{bmatrix}$$
Using row and column operations (in $\mathbb{Q}[x]$), we arrive at:
$$\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 - x - x^2 + x^3 \end{bmatrix}$$
We see that since the minimal and characteristic polynomial have the same roots, the only possibilities for the minimal polynomial are $(-1 + x)^2 (1 + x)$. We can check that:
$$(A-I)^2(A+I) = \begin{bmatrix} 16 & 64 & 0 \\ -1 & -32 & -8 \\ 1 & 8 & 0 \end{bmatrix} \ne 0.$$
It follows that there are no other invariant factors for $A$ and the minimal polynomial is $(-1 + x)^2 (1 + x)$, which, of course, we see in the invariant factor decomposition.
Because the only invariant factor is $(-1 + x)^2 (1 + x)$, we can write the rational canonical form as:
$$R = \begin{bmatrix} 0 & 0 & 0 \\ 1 & 0 & 1 \\ 0 & 1 & 0 \end{bmatrix}$$
There are several ways to find the matrix $P$, but I like using the row operations from the invariant factor decomposition. If we use those (work it to reduce to the matrix I show above), we get:
$$P = \begin{bmatrix} -2 & -6 & -18 \\ 0 & 0 & -8 \\ 1 & -1 & -7 \end{bmatrix}$$
From this we get:
$$\displaystyle P^{-1} = \begin{bmatrix} -\frac{1}{8} & \frac{3}{8} & \frac{3}{4} \\ -\frac{1}{8} & -\frac{1}{2} & -\frac{1}{4} \\ 0 & \frac{1}{8} & 0 \end{bmatrix}$$
We can verify:
$$P \cdot R \cdot P ^{-1} = \begin{bmatrix} 3 &  4 & 0 \\-1 & -3 & -2 \\ 1 & 2 & 1 \end{bmatrix} = A$$
From the comments, and from the book you mention (which I do not have), it should have worked, but I am not sure since I would like to read the details. There are several ways of approaching these and they are not trivial, nor are they unique.
Also, note the very important observation of the matrices $P$ for the Jordan versus the Rational Canonical forms, they are not the same.
Other references you might like to check out:


*

*Abstract Algebra, Dummit and Foote

*Linear Algebra, Edwards

*Algebra, Vivek Sahai, Bist Vikas

