<s>[INST] Find all matrices that commute with $A$ 
Given $$A = \begin{bmatrix}
3 & 1 &0 \\ 
0 &3  & 1\\ 
0 &0  & 3
\end{bmatrix}$$ find matrices $B$ such that $AB=BA$.

Trivially $B=A^{-1}$ and $B=kI$ are the solutions
Also we have Characteristic Polynomial as
$$A^3-9A^2+27A-27I=0$$ $\implies$
$$(A-3I)^3=0$$
Is it possible to find other $B's$ using above Nilpotency of $A-3I$?
 [/INST] With
$N = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{bmatrix}, \tag 1$
we have
$A = 3I + N; \tag 2$
then
$AB = BA \tag 3$
implies
$(3I + N)B = B(3I + N), \tag 4$
or
$3B + NB = 3B + BN, \tag 5$
whence
$NB = NB; \tag 6$
with
$B = \begin{bmatrix} b_1 & b_2 & b_3 \\ b_4 & b_5 & b_6 \\ b_7 & b_8 & b_9 \end{bmatrix}, \tag 7$
we then have
$NB = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} b_1 & b_2 & b_3 \\ b_4 & b_5 & b_6 \\ b_7 & b_8 & b_9 \end{bmatrix} = \begin{bmatrix} b_4 & b_5 & b_6 \\ b_7 & b_8 & b_9 \\ 0 & 0 & 0 \end{bmatrix}, \tag 8$
and
$BN = \begin{bmatrix} b_1 & b_2 & b_3 \\ b_4 & b_5 & b_6 \\ b_7 & b_8 & b_9 \end{bmatrix}\begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{bmatrix}  = \begin{bmatrix} 0 & b_1 & b_2 \\ 0 & b_4 & b_5 \\ 0 & b_7 & b_8 \end{bmatrix}; \tag 9$
comparing (8) and (9) in the light of (6) yields
$b_4 = b_7 = b_8 = 0, \; b_1 = b_5 = b_9 = 0, \; b_6 = b_2, \tag{10}$
and $b_3$ unspecified/unconstrained; therefore $B$ takes the form
$B = \begin{bmatrix} 0 & b_2 & b_3 \\ 0 & 0 & b_2 \\ 0 & 0 & 0 \end{bmatrix}; \tag{11}$
it is easy to walk these calculations back and show that every $B$ as in (11) satisfies (6) and hence (3); that $B$ take the form (11) is thus both a necessary and sufficient condtition that (3) should bind.
</s>