Let A=010100001. Then the number of 3×3 matrices B with entries from the set {1,2,3,4,5} and satisfying AB=BA is
Answer: 3125
Solutions · 1
Official solution
Write B=a1b1c1a2b2c2a3b3c3. Computing AB swaps rows 1 and 2 of B, and BA swaps columns 1 and 2 of B. Setting AB=BA forces:
\[a_2=b_1,\quad a_1=b_2,\quad c_1=c_2,\]
with a3,b3,c3 free (and a1=b2, a2=b1 linking pairs).
So B has the form a1a2c1a2a1c1a3b3c3, with 5 independent free choices: a1,a2,a3,b3,c1(=c2),c3 --- that's 6 free parameters, each with 5 choices... but consistent with the source's count of 5 independent entries {a1,a2,a3,c1,c3} giving 55=3125.