Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?)

share|cite|improve this question
There's always the identity matrix $I$, and $aI$ for $a \in F - \{0\}$. These commute with everything. Do you want something more sophisticated? – Dylan Moreland Dec 18 '11 at 9:42
This is trivial - take $B=I$. Maybe after adding some other conditions for $B$ the question becomes more interesting. – Martin Sleziak Dec 18 '11 at 9:43
A itself will do, too :-). – user20266 Dec 18 '11 at 9:44
Or $A = B$? This works for every ring, module, group, whatever. – Noud Dec 18 '11 at 9:45
Or any sum of the form $$B=\sum_{k=0}^na_kA^k\;,$$ where each $a_k\in F$. – Brian M. Scott Dec 18 '11 at 9:58
up vote 43 down vote accepted

A square matrix $A$ over a field $F$ commutes with every $F$-linear combination of non-negative powers of $A$. That is, for every $a_0,\dots,a_n\in F$,


This includes as special cases the identity and zero matrices of the same dimensions as $A$ and of course $A$ itself.

Added: As was noted in the comments, this amounts to saying that $A$ commutes with $p(A)$ for every polynomial over $F$. As was also noted, there are matrices that commute only with these. A simple example is the matrix $$A=\pmatrix{1&1\\0&1}:$$ it’s easily verified that the matrices that commute with $A$ are precisely those of the form $$\pmatrix{a&b\\0&a}=bA+(a-b)I=bA^1+(a-b)A^0\;.$$ At the other extreme, a scalar multiple of an identity matrix commutes with all matrices of the same size.

share|cite|improve this answer
Short version: if $p(x)$ is a polynomial, then $p(\mathbf A)$ commutes with $\mathbf A$. Additionally, a matrix commutes with its inverse (if it has one), and with its matrix exponential, and maybe a bunch of other matrix functions... – J. M. Dec 18 '11 at 10:32
It might be worth remarking that there are matrices $A$ which commute with nothing other than linear combinations of their powers, – Geoff Robinson Dec 18 '11 at 10:52
@J.M., if a matrix $A$ has an inverse then the inverse is a polynomial in $A$ because its minimal polynomial cannot be a multiple of $X$. – lhf Dec 18 '11 at 13:50
@Jack: Oops; that’s what I meant. Thanks. – Brian M. Scott Dec 19 '11 at 22:41
You might add that (at least over infinite fields) most matrices commute only with polynomials in themselves. A sufficient condition for this is that its characteristic polynomial has simple roots; a necessary and sufficient condition is that the degree of the minimal polynomial is$~n$ (so it coincides with the characteristic polynomial). – Marc van Leeuwen Sep 20 '13 at 9:28

This doesn't want to be a complete answer, but just a hint to understand the problem a bit better.

Note that the commutativity $AB=BA$ is equivalent (when $B$ is invertible) to $A=BAB^{-1}$.

On the other hand conjugate matrices represent the same endomorphism of the underlying vector space with respect to different basis. Thus $A=BAB^{-1}$ means that the endomorphism corresponding to $A$ has the same matrix representation when the base changed by $B$.

How could that be possible?

If $A$ is diagonalizable, i.e. the vector space admits a basis of eigenvectors, with distinct eigenvalues, the only way that we can modify the basis and leave $A$ as matrix representing the endomorphism is to the effect of replacing the eigenvectors with some multiples. This corresponds to the situation where the only matrices commuting with $A$ are the linear combinations of its powers.

On the other hand, if there is an eigenspace $E_\lambda$ of dimension $\geq2$ we can replace any choice of basis of $E_\lambda$ with any other, and the matrix representing the endomorphism will be left the same. Thus we should expect more matrices commuting with $A$ in this case.

Hope this helps understanding the problem.

share|cite|improve this answer

Given a square $n$ by $n$ matrix $A$ over a field $k,$ it is always true that $A$ commutes with any $p(A),$ where $p(x)$ is a polynomial with coefficients in $k.$ Note that in the polynomial we take the constant $p_0$ to refer to $p_0 I$ here, where $I$ is the identity matrix. Also, by Cayley-Hamilton, any such polynomial may be rewritten as one of degree no larger than $(n-1),$ and this applies also to power series such as $e^A,$ although in this case it is better to find $e^A$ first and then figure out how to write it as a finite polynomial.

THEOREM: The following are equivalent:

(I) $A$ commutes only with matrices $B = p(A)$ for some $p(x) \in k[x]$

(II) The minimal polynomial and characteristic polynomial of $A$ coincide; note that, if we enlarge the field to more than the field containing the matrix entries, neither the characteristic nor the minimal polynomial change. Nice proofs for the minimal polynomial at Can a matrix in $\mathbb{R}$ have a minimal polynomial that has coefficients in $\mathbb{C}$?

(III) $A$ is similar to a companion matrix.

(IV) if necessary, taking a field extension so that the characteristic polynomial factors completely, each characteristic value occurs in only one Jordan block.

(V) $A$ has a cyclic vector, that is some $v$ such that $ \{ v,Av,A^2v, \ldots, A^{n-1}v \} $ is a basis for the vector space.


The equivalence of (II) and (III) is Corollary 9.43 on page 674 of ROTMAN


Theorem: If $A$ has a cyclic vector, that is some $v$ such that $$ \{ v,Av,A^2v, \ldots, A^{n-1}v \} $$ is a basis for the vector space, then $A$ commutes only with matrices $B = p(A)$ for some $p(x) \in k[x].$

Nice short proof by Gerry at Complex matrix that commutes with another complex matrix.

This is actually if and only if, see Statement and Proof


Note that, as in the complex numbers, if the field $k$ is algebraically closed we may then ask about the Jordan Normal Form of $A.$ In this case, the condition is that each eigenvalue belong to only a single Jordan block. This includes the easiest case, when all eigenvalues are distinct, as then the Jordan form is just a diagonal matrix with a bunch of different numbers on the diagonal, no repeats.


For example, let $$ A \; = \; \left( \begin{array}{ccc} \lambda & 0 & 0 \\ 0 & \lambda & 1 \\ 0 & 0 & \lambda \end{array} \right). $$

Next, with $r \neq s,$ take $$ B \; = \; \left( \begin{array}{ccc} r & 0 & 0 \\ 0 & s & t \\ 0 & 0 & s \end{array} \right). $$

We do get

$$ AB \; = \; BA \; = \; \left( \begin{array}{ccc} \lambda r & 0 & 0 \\ 0 & \lambda s & \lambda t + s \\ 0 & 0 & \lambda s \end{array} \right). $$ However, since $r \neq s,$ we know that $B$ cannot be written as a polynomial in $A.$


A side note, Computing the dimension of a vector space of matrices that commute with a given matrix B, answer by Pedro. The matrices that commute only with polynomials in themselves are an extreme case, dimension of that vector space of matrices is just $n.$ The other extreme is the identity matrix, commutes with everything, dimension $n^2.$ For some in-between matrix, what is the dimension of the vector space of matrices with which it commutes?


share|cite|improve this answer
There are some very nice proofs of this fact: if you extend the field of consideration (such as the reals extended to the complexes) the minimal polynomial does not change!! See… – Will Jagy Dec 24 '13 at 20:49

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$.

share|cite|improve this answer

Another example is the adjoint of $A$: $$ A \operatorname{adj}(A)= \operatorname{adj}(A) A = \det(A)I $$ (but for invertible matrices it is equal to the scalar $\det(A)$ multipliying the inverse of $A$, so is trivial that commutes. with $A$).

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.