Find a non diagonalizable matrix that commutes with a given matrix We are asked to find a non diagonalizable matrix that commutes with 
$\begin{pmatrix} 0 & 0 & -1 \\1 & 1 & 1 \\0 & 0 & 1\end{pmatrix}$.
What I tried: My first thought was the inverse, but this matrix is not invertible, and then I thought maybe the transpose (for some reason) and they don't commute.
How can I find such a matrix?
 A: Your matrix $A$ has characteristic polynomial $X(X-1)^2$, and satisfies $A(A-I)=0$, so its minimal polynomial is $X(X-1)$, and it is unfortunately itself diagonalisable (otherwise taking $A$ would have worked). To make it non-diagonalisable, add any nonzero nilpotent transformation of the eigenspace for $\lambda=1$ that is zero on the eigenspace for $\lambda=0$. The former eigenspace being $\{\,(x,y,z)\mid x+z=0\,\}$ and the second being spanned by $(1,-1,0)$, you could for instance add the matrix
$$ N=\begin{pmatrix}0&0&0\\0&0&1\\0&0&0\end{pmatrix}
\qquad\text{to give}\qquad
 B=\begin{pmatrix}0&0&-1\\1&1&2\\0&0&1\end{pmatrix}.
$$
Commutation follows because $A$ commutes with $N$, and since $B(B-I)\neq0$, the minimal polynomial of $B$ is $X(X-1)^2$, and $B$ is not diagonalisable
A: Note that $\Lambda =V^{-1}AV = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{bmatrix}$, where $V=\begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & -1 \\ -1 & 0 & 0 \end{bmatrix}$.
Let $B=V J V^{-1}$, where $J=\begin{bmatrix} 1 & 1 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{bmatrix}$.
$B$ is not diagonalizable, and since $\Lambda J = J \Lambda$, we have $AB=BA$.
