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$?
 A: By just writing out the matrix multiplication and simplifying you get:
\begin{align*}
AB &= BA\\
\begin{bmatrix}
3 & 1 &0 \\ 
0 &3  & 1\\ 
0 &0  & 3
\end{bmatrix}
\begin{bmatrix}
b_{11} & b_{12} & b_{13} \\
b_{21} & b_{22} & b_{23} \\
b_{31} & b_{32} & b_{33} \\
\end{bmatrix}
&=
\begin{bmatrix}
b_{11} & b_{12} & b_{13} \\
b_{21} & b_{22} & b_{23} \\
b_{31} & b_{32} & b_{33} \\
\end{bmatrix}
\begin{bmatrix}
3 & 1 &0 \\ 
0 &3  & 1\\ 
0 &0  & 3
\end{bmatrix}\\
\begin{bmatrix}
 3b_{11} + b_{21} & 3b_{12} + b_{22} & 3b_{13}+b_{23} \\
 3b_{21} + b_{31} & 3b_{22} + b_{32} & 3b_{23}+b_{33} \\
 3b_{31} & 3b_{32} & 3b_{33}
\end{bmatrix}
&=
\begin{bmatrix}
3b_{11} & b_{11}+3b_{12} & b_{12} + 3b_{13} \\
3b_{21} & b_{21}+3b_{22} & b_{22} + 3b_{23} \\
3b_{31} & b_{31}+3b_{32} & b_{32} + 3b_{33}
\end{bmatrix} \\
\begin{bmatrix}
 b_{21} & b_{22} & b_{23} \\
 b_{31} & b_{32} & b_{33} \\
 0 & 0 & 0
\end{bmatrix}
&=
\begin{bmatrix}
 0 & b_{11} & b_{12} \\
 0 & b_{21} & b_{22}  \\
 0 & b_{31} & b_{32}
\end{bmatrix}
\end{align*}
Hence, $b_{21},b_{31},b_{32}=0$, $b_{11}=b_{22}=b_{33}$ and $b_{12}=b_{23}$, confirming the solutions are exactly those given by Robert.
A: Since$$A=3\operatorname{Id}_3+\begin{pmatrix}0&1&0\\0&0&1\\0&0&0\end{pmatrix}$$and every matrix commutes with $3\operatorname{Id}_3$, you're after the matrices that commute with$$\begin{pmatrix}0&1&0\\0&0&1\\0&0&0\end{pmatrix}.\tag1$$A simple computation shows that\begin{multline}\begin{pmatrix}a&b&c\\d&e&f\\g&h&i\end{pmatrix}\begin{pmatrix}0&1&0\\0&0&1\\0&0&0\end{pmatrix}-\begin{pmatrix}0&1&0\\0&0&1\\0&0&0\end{pmatrix}\begin{pmatrix}a&b&c\\d&e&f\\g&h&i\end{pmatrix}=\\=\begin{pmatrix}d & e-a & f-b \\ g & h-d & i-e \\ 0 & -g & -h\end{pmatrix}\end{multline}and therefore the matrix$$\begin{pmatrix}a&b&c\\d&e&f\\g&h&i\end{pmatrix}$$commutes with $(1)$ if and only if$$\left\{\begin{array}{l}d=g=h=0\\a=e=i\\f=b.\end{array}\right.$$Therefore, the answer to your question is:$$\left\{\begin{pmatrix}a&b&c\\0&a&b\\0&0&a\end{pmatrix}\,\middle|\,a,b,c\in\mathbb{R}\right\}.$$
A: Polynomials in $A$ always commute with $A$.  In this case these will be upper triangular with constant diagonals, i.e. 
$$ \pmatrix{a & b & c\cr 0 & a & b\cr 0 & 0 & a}$$
You'll want to show that these are all the solutions.
A: All matrices which are polynomial expressions in $A$ commute with $A$. On the other hand, these are the only matrices in the centralizer of $A$ iff $A$ is nonderogatory, that is, the characteristic and minimum polynomials of $A$ coincide. In this case the minimum polynomial can only be either $X-3I$, $(X-3I)^2$ or $(X-3I)^3$ (since it must be monic and divide the characteristic polynomial) and by replacing $A$ we find that it is in fact $(X-3I)^3$, so $A$ is nonderogatory and the matrices commuting with $A$ are of the form
$$\{a I_3+bA +cA^2 \ | \ a,b,c\in F\} =\left\{\begin{pmatrix}a+3b+9c & b+6c & c\\ 0 & a +3b+9c & b+6c \\ 0 & 0 & a+3b+9c \end{pmatrix} \ | \ a,b,c\in F\right\}=\left\{\begin{pmatrix} a & b & c \\ 0 & a & b \\ 0 & 0 & a \end{pmatrix} \ | \ a,b,c\in F\right\},$$
the last step by a linear change of coordinates (which does not involve any divisions, so is valid in any characteristic).
A: 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.
A: A is an upper diagonal matrix regardless of 3rd element of 1st row being 0
Hence, A all upper diagonal matrices will commute with A
