Given some matrix A, $A \in \mathbb{R}^{nxn}$
Find all matrices B, $B \in \mathbb{R}^{n×n}$, such that
$AB =BA$
I found an interesting way to solve this problem, and I want to ask you all is this is a valid solution.
First define any infinite sequence of coefficients $\alpha_k$ where k is an integer such that $k\geq0$. Then write B as the following.
$ B = \sum_{k=0}^{\infty} \alpha_k A^k $
It is easy to prove that B will always commute with A.
$ AB = A\sum_{k=0}^{\infty} \alpha_k A^k = \sum_{k=0}^{\infty} \alpha_k A^{k+1} = \sum_{k=0}^{\infty} \alpha_k A^k A = BA $
Can all matrices $B$ that commute with $A$ be represented in this way, or is this a special case that is not true of all matrices B that commute with A?