TITLE: Given a matrix, is there always another matrix which commutes with it?
QUESTION [44 upvotes]: Given a matrix $A$ over a field $F$, does there always exist a matrix $B$ such that $AB = BA$? (except the trivial case and the polynomial ring?)

REPLY [6 votes]: Let $A$ be a $n\times n$ matrix over a field $\mathbb{F}$. Let $C_A = \{B\in M_{n\times n}(\mathbb{F}) \mid AB=BA\}$. Then the minimal dimension of $C_A$ over $\mathbb{F}$ is $n$, and this is obtained precisely when the minimal polynomial and characteristic polynomial of $A$ coincide.
The idea of proof is interpreting $C_A$ as an $\mathbb{F}[x]$-endomorphism algebra of the $\mathbb{F}[x]$-module $M^A$. (Here $M^A$ is the $\mathbb{F}[x]$-module structure of $\mathbb{F}^n$). Use the Rational Canonical Form-Primary decomposition. We have the following formula for $\textrm{dim}_{\mathbb{F}} C_A$.
$$\textrm{dim}_{\mathbb{F}} C_A=\textrm{dim}_{\mathbb{F}}\textrm{ End}_{\mathbb{F}[x]}M^A=\sum_p(\deg p)\sum_{i,j} \min\{\lambda_{p,i}, \lambda_{p,j}\},
    $$
    where the first sum is over all irreducible polynomials $p$ that divides the characteristic polynomial of $A$, and the indices $i, j$ of second double sum is from the partition $\lambda_p=\sum_i \lambda_{p,i}$ that indicates the powers of $p$ in $p$-primary part of $M^A$.
Thus, if minimal polynomial does not coincide with characteristic polynomial, then the dimension of $C_A$ is greater than $n$.