Transition matrix for Jordan canonical form I have this matrix:
$$A = \begin{bmatrix}
3 & 1 & 2 \\
0 & 3 & -1 \\
0 & 0 &  3 
\end{bmatrix}$$
The characteristic polynomial is $(3-\lambda)^3,$ so the eigenvalue is $\lambda=3$ alone.
$$(A-\lambda I) = \begin{bmatrix}
0 & 1 & 2 \\
0 & 0 & -1 \\
0 & 0 &  0 
\end{bmatrix}\implies \textrm{the eigenvalue is } v=(1,0,0)\textrm{ alone.}$$
So, I have the Jordan canonical form:
$$J = \begin{bmatrix}
3 & 1 & 0 \\
0 & 3 & 1 \\
0 & 0 &  3 
\end{bmatrix}.$$
Now, I want to find the transition matrix $P$ such that $A=PJP^{-1}.$
I know that I need to find the generalized eigenvector, but I don't know what to do with them.
I saw that 
$$(A-\lambda I)^{2} = \begin{bmatrix}
0 & 0 & 0 \\
0 & 0 & -1 \\
0 & 0 &  0 
\end{bmatrix}$$
So, can I take as the generalized eigenvector the vector $w=(0,1,0)$? Since $\ker((A-\lambda)^{2})=\textrm{Span}\{v,(0,1,0)\}$, I think that is fine.
Now, 
$$(A-\lambda I)^{3} = \begin{bmatrix}
0 & 0 & 0 \\
0 & 0 & 0 \\
0 & 0 &  0 
\end{bmatrix},$$
so, the generalized eigenspace is $\Bbb{R}^{3}.$ Can I take as the final generalized eigenvector the vector $u=(0,0,1)$?
And now, how can I construct the matrix P?
I think there is something wrong, since the basis that I found is just the canonical basis, and in this basis the matrix $A$ is not in Jordan form.
 A: The basis you find, in the end, will have the form $\beta=[\mathbf{v}_1,\mathbf{v}_2,\mathbf{v}_3]$, where:


*

*$(A-3I)\mathbf{v}_3 = \mathbf{v}_2$;

*$(A-3I)\mathbf{v}_2 = \mathbf{v}_1$;

*$(A-3I)\mathbf{v}_1 = \mathbf{0}$.


So you need to find a vector, $\mathbf{v}_3$, which is (i) in the nullspace of $(A-3I)^3$; but (ii) not in the nullspace of $(A-3I)^2$. 
Here, everything is in the nullspace of $(A-3I)^3$, since $(A-3I)^3$ is the zero matrix. 
You've compute $(A-3I)^2$ incorrectly: the correct calculation gives
$$(A-3I)^2 = \left(\begin{array}{rrr}
0 & 1 & 2\\
0 & 0 & -1\\
0 & 0 & 0\end{array}\right) \left(\begin{array}{rrr}
0 & 1 & 2\\
0 & 0 & -1\\
0 & 0 & 0\end{array}\right) = \left(\begin{array}{rrr}
0 & 0 & -1\\
0 & 0 & 0\\
0 & 0 & 0
\end{array}\right).$$
The nullspace is $\{ (x,y,z) \mid z=0\}$ (note your calculation is wrong, even for the matrix you got; you don't need $y=0$, you need $z=0$). So all you need to do is take any vector that is not in that nullspace. In particular, you cannot take $(0,1,0)$ (which is in the nullspace of $(A-3I)^2$); but you can take $(0,0,1)$, which is not.
If you pick $\mathbf{v}_3=(0,0,1)$, then $\mathbf{v}_2 = (A-3I)\mathbf{v}_3 = (2,-1,0)$; and $\mathbf{v}_1 = (A-3I)\mathbf{v}_2 = (-1,0,0)$. 
