Let $A=\left[\begin{array}{lll}0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1\end{array}\right]$ Then the number of $3 \times 3$ matrices B with entries from the set $\{1,2,3,4,5\}$ and satisfying $\mathrm{AB}=\mathrm{BA}$ is
Let matrix $B=\left[\begin{array}{lll}a & b & c \\ d & e & f \\ g & n & i\end{array}\right]$
$\because \quad \mathrm{AB}=\mathrm{BA}$
$\left[\begin{array}{lll}0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1\end{array}\right]\left[\begin{array}{lll}a & b & c \\ d & e & f \\ g & h & i\end{array}\right]=\left[\begin{array}{lll}a & b & c \\ d & e & f \\ g & h & i\end{array}\right]\left[\begin{array}{lll}0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1\end{array}\right]$
$\left[\begin{array}{lll}\mathrm{d} & \mathrm{e} & \mathrm{f} \\ \mathrm{a} & \mathrm{b} & \mathrm{c} \\ \mathrm{g} & \mathrm{h} & \mathrm{i}\end{array}\right]=\left[\begin{array}{lll}\mathrm{b} & \mathrm{a} & \mathrm{c} \\ \mathrm{e} & \mathrm{d} & \mathrm{f} \\ \mathrm{h} & \mathrm{g} & \mathrm{i}\end{array}\right]$
$\Rightarrow \mathrm{d}=\mathrm{b}, \mathrm{e}=\mathrm{a}, \mathrm{f}=\mathrm{c}, \mathrm{g}=\mathrm{h}$
$\therefore$ Matrix B $=\left[\begin{array}{lll}\mathrm{a} & \mathrm{b} & \mathrm{c} \\ \mathrm{b} & \mathrm{a} & \mathrm{c} \\ \mathrm{g} & \mathrm{g} & \mathrm{i}\end{array}\right]$
No. of ways of selecting $\mathrm{a}, \mathrm{b}, \mathrm{c}, \mathrm{g}, \mathrm{i}$
$=5 \times 5 \times 5 \times 5 \times 5$
$=5^{5}=3125$
$\therefore$ No. of Matrices $\mathrm{B}=3125$