Finding Jordan Canonical Form and its transformation matrix I'm a student and do my homework.
My $4\times 4$ matrix:
$$ A=
\begin{bmatrix}
0 & 4 & -1 & -1 \\
-1 & 4 & 0 & -1 \\
0 & 0 & 2 & 0 \\
0 & 0 & 0 &  2
\end{bmatrix}
$$
The characteristic polynomial is $(2-\lambda)^4$, so there are $4$ equal eigenvalues $\lambda=2$, and its algebraic and geometric multiplicities are
\begin{align*}
\operatorname{am}_A(2) &= 4 & \operatorname{gm}_A(2) &= 2
\end{align*}
After all, I know that the Jordan form is $4\times 4$ matrix with $\lambda=2$ on the main diagonal and there are $2$ Jordan blocks. So it looks like this but instead of $x$ it should have either $0$ or $1$. Here is the first issue.
$$
\begin{matrix}
2 & x & x & 0 \\
0 & 2 & x & x\\
0 & 0 & 2 & x\\
0 & 0 & 0 & 2 \\
\end{matrix}
$$
Also I need to find a transition matrix $P$ such that $J=P^{-1}AP$. As far as I understand it's a $4\times 4$ matrix whose columns are eigenvectors of the initial matrix $A$. So $2$ of the columns of $P$ are  $u_1 = (-1, 0, 0, 0)^{T}$ and $u_2 = (0, 0, 1, 0)^{T}$. How to find the other $2$ columns?
PS I'm not asking for an exact answer (have Wolfram for it), but try to understand how to do it on my own.
 A: First, you cannot have a $4\times 4$ invertible matrix $P$ all of whose columns are eigenvectors of $A$, since that would mean that $A$ is diagonalisable, which it is not. In fact the geometric multiplicity $2$ of the unique eigenvalue $\lambda=2$ says that you can have only $2$ independent eigenvectors. Any basis of the eigenspace $\ker(A-2I)$ will provide such a pair of independent eigenvectors. At this point you can compute the eigenspace (in fact you already did for computing the geometric multiplicity), but you don't have to choose a basis yet. For more vector of the basis you can look at kernels of higher powers of $A-2I$, starting with its square $(A-2I)^2$. Since dimensions of those kernels increase until the algebraic multiplicity $4$ is reached, there are two possibilities:

*

*Already $\dim\ker((A-2I)^2)=4$. This means the image of $A-2I$ is also its kernel (so the minimal polynomial is $(X-2)^2$) and for any pair of vectors $v_1,v_3\in\ker(A-2I)$ you can find pre-images $v_2,v_4$ such that $(A-2I)(v_{i+1})=v_i$ for $i=1,3$. Now $[v_1,v_2,v_3,v_4]$ form a Jordan basis (two Jordan blocks of size$~2$).

*Instead $\dim\ker((A-2I)^2)=3$. Now the image of $A-2I$ intersects its kernel only in a $1$-dimensional subspace (the minimal polynomial is $(X-2)^3$, so some vectors have an image under $A-2I$ that is not in its kernel, and since the image of $A-2I$ has dimension $\operatorname{rk}(A-2I)=2$, it intersects the kernel in lower dimension; that dimension cannot be $0$ however, since repeatedly applying $A-2I$ must kill all vectors). In this case the easiest way to find a Jordan basis is to start with a vector $v_3$ not in $\ker((A-2I)^2)$, take $v_2=(A-2I)(v_3)$ and $v_1=(A-2I)(v_2)$ (an eigenvector that is also in the image of $A-2I$ and even of $(A-2I)^2)$, and for $v_4$ take any eigenvector independent of $v_1$. (two Jordan blocks, of respective sizes$~3,1$).

A: Hint As you've observed, the geometric multiplicity of the (sole) eigenvalue $2$ is $2$, so the Jordan canonical form has exactly $2$ Jordan blocks, leaving just two possible Jordan canonical forms: $$J_3(2) \oplus J_1(2) \qquad \textrm{and} \qquad J_2(2)\oplus J_2(2).$$ In these cases, the minimal polynomial of $A$ is, respectively, $(t - 2)^3$ or $(t - 2)^2$. What happens when you (formally) evaluate those two polynomials at $A$?
For a defective matrix $n \times n$ like ours, there are fewer than $n$ linearly independent eigenvectors. So, we constructing the transition matrix, instead of picking a basis of eigenvectors, for each Jordan block $J_k(\lambda)$ we must find a vector ${\bf v}$ satisfying $(A - \lambda I)^k {\bf v} = {\bf 0}$ but $(A - \lambda I)^{k - 1} {\bf v} \neq {\bf 0}$. Then, for the columns of the transition matrix corresponding to that block we can take the vectors $$A^{k - 1} {\bf v}, \ldots, A {\bf v}, {\bf v}.$$
