<s>[INST] How to find the minimal-polynomial of $\begin{pmatrix} 0&1&0&1\\1&0&1&0\\0&0&0&0\\0&0&0&0\end{pmatrix}$ 
$E:=\begin{pmatrix} 1&0&0&0\\0&1&0&0\\0&0&1&0\\0&0&0&1\end{pmatrix} A:= \begin{pmatrix} 0&1&0&1\\1&0&1&0\\0&0&0&0\\0&0&0&0\end{pmatrix} A^2:= \begin{pmatrix} 1&0&1&0\\0&1&0&1\\0&0&0&0\\0&0&0&0\end{pmatrix}$

My attempt:
The idea is to find a linear combination $lin(E+A+A^2+...+A^n) = A^{n+1}$
I tried it by taking the first column of each matrix and look for a solution:
(1) E|A
$x\begin{pmatrix} 1\\0\\0\\0\end{pmatrix} = \begin{pmatrix} 0\\1\\0\\0\end{pmatrix}$
This can obviously not work
(2) $lin(E+A) = A^2$
$x\begin{pmatrix} 1\\0\\0\\0\end{pmatrix} +y \begin{pmatrix} 0\\1\\0\\0\end{pmatrix} = \begin{pmatrix} 1\\0\\0\\0\end{pmatrix}$
Which works for $x=1, y=0.$
Now the minimalpolynomial should be $0\cdot E+ 1\cdot A + A^2 \rightarrow 0+x+x^2$, but it seems to be wrong in further calculations. 
 [/INST] The easiest way to find a minimal polynomial is to put the matrix in Jordan normal form. The minimal polynomial is $p(x) = \prod (x-\lambda)^{d_\lambda}$, where the product runs over the eigenvalues $\lambda$ and $d_\lambda$ is the size of the largest Jordan block for that eigenvalue (not the multiplicity of the eigenvalue).
In this case, your matrix is diagonalizable, so all the Jordan blocks are $1 \times 1$. It has 4 eigenvectors with eigenvectors 0 (multiplicity 2), 1, and -1. The minimal polynomial is $p(x) = x(x-1)(x+1)$.
</s>