<s>[INST] Jordan decomposition - help with calculation of transformationmatrices? Let $$A=\begin{pmatrix}5&1&1 \\-1&3&1\\0&0&4\end{pmatrix}$$
The Jordan-decomposition is $$A=\begin{pmatrix}-1&-1&-1/2 \\1&0&0\\0&0&-1/2\end{pmatrix}\begin{pmatrix}4&1&0 \\0&4&1\\0&0&4\end{pmatrix}\begin{pmatrix}0&1&0 \\-1&-1&1\\0&0&-2\end{pmatrix}$$
And it drives me crazy that I don't get it ! 
The characteristic polynomial is $p(\lambda)=(\lambda-4)^3$ therefore $\lambda=4$ has algebraic multiplicity $3$
Then
$(A-4I)=\begin{pmatrix}1&1&1 \\-1&-1&1\\0&0&0\end{pmatrix} \Rightarrow \dim(\text{kernel})=2<3$
$(A-4I)^2=\begin{pmatrix}0&0&2 \\0&0&-2\\0&0&0\end{pmatrix}\Rightarrow \dim(\text{kernel})=1<3$
The matrix is not diagonalizable, so we get 
$$J=\begin{pmatrix}4&1&0 \\0&4&1\\0&0&4\end{pmatrix}$$
Now I need the eigenvectors/eigenspaces/generalized eigenvetors/spaces and here is the part I have trouble with.
$(A-4I)v=\begin{pmatrix}1&1&1 \\-1&-1&1\\0&0&0\end{pmatrix}v=0 \Rightarrow v_1=-v_2 \land v_3=0 \Rightarrow v=\begin{pmatrix}1\\-1\\0\end{pmatrix} $
$(A-4I)^2u=\begin{pmatrix}0&0&2 \\0&0&-2\\0&0&0\end{pmatrix}u=0 \Rightarrow u_3=0\Rightarrow u=\begin{pmatrix}1\\0\\0\end{pmatrix}, u*=\begin{pmatrix}0\\1\\0\end{pmatrix}$
I don't understand how/what wolfram alpha did -.-
What did I wrong ? Thanks for answers.
 [/INST] We are looking for P such that $P^{-1}AP=J$ thus you need to solve the following systems $AP=PJ$ that is
$Av_1=4v_1$
$Av_2=v_1+4v_2$
$Av_3=v_2+4v_3$
where $v_1$,$v_2$,$v_3$ are the columns of P.
Once we find $v_1$ from the first system, we can find $v_2$ from the second and finally $v_3$ from the third.
See also this example
Making matrix upper triangular by finding Jordan Normal Form
More in detail
$Av_1=4v_1\implies (A-4I)v_1=0\implies \begin{pmatrix}1&1&1 \\-1&-1&1\\0&0&0\end{pmatrix}v_1=0\\\implies  v_1=\begin{pmatrix}-1 \\1\\0\end{pmatrix}$
$Av_2=v_1+4v_2\implies (A-4I)v_2=v_1 \implies \begin{pmatrix}1&1&1 \\-1&-1&1\\0&0&0 \end{pmatrix} v_2=\begin{pmatrix}-1 \\1&\\0\end{pmatrix}\\\implies  v_2=\begin{pmatrix}-1 \\0\\0\end{pmatrix}$
$Av_3=v_2+4v_3\implies (A-4I)v_3=v_2 \implies \begin{pmatrix}1&1&1 \\-1&-1&1\\0&0&0 \end{pmatrix} v_3=\begin{pmatrix}-1 \\0&\\0\end{pmatrix}\\\implies  v_3=\begin{pmatrix}-\frac12 \\0\\-\frac12\end{pmatrix}$
Thus
$$P=\begin{pmatrix}-1&-1&-1/2 \\1&0&0\\0&0&-1/2\end{pmatrix}$$
</s>