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

  • 7
    $\begingroup$ There's always the identity matrix $I$, and $aI$ for $a \in F - \{0\}$. These commute with everything. Do you want something more sophisticated? $\endgroup$ Dec 18, 2011 at 9:42
  • 3
    $\begingroup$ This is trivial - take $B=I$. Maybe after adding some other conditions for $B$ the question becomes more interesting. $\endgroup$ Dec 18, 2011 at 9:43
  • 23
    $\begingroup$ A itself will do, too :-). $\endgroup$
    – user20266
    Dec 18, 2011 at 9:44
  • 3
    $\begingroup$ Or $A = B$? This works for every ring, module, group, whatever. $\endgroup$
    – Noud
    Dec 18, 2011 at 9:45
  • 21
    $\begingroup$ Or any sum of the form $$B=\sum_{k=0}^na_kA^k\;,$$ where each $a_k\in F$. $\endgroup$ Dec 18, 2011 at 9:58

5 Answers 5


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.

  • 4
    $\begingroup$ 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... $\endgroup$ Dec 18, 2011 at 10:32
  • 9
    $\begingroup$ It might be worth remarking that there are matrices $A$ which commute with nothing other than linear combinations of their powers, $\endgroup$ Dec 18, 2011 at 10:52
  • 1
    $\begingroup$ @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$. $\endgroup$
    – lhf
    Dec 18, 2011 at 13:50
  • $\begingroup$ @Jack: Oops; that’s what I meant. Thanks. $\endgroup$ Dec 19, 2011 at 22:41
  • 5
    $\begingroup$ 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). $\endgroup$ Sep 20, 2013 at 9:28

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?


Showing what must be the form of a square block if it commutes with a Jordan block. There is no loss in taking the eigenvalue for the Jordan block as zero, and makes it all cleaner:

parisize = 4000000, primelimit = 500000
? jordan = [ 0,1;0,0]
%1 = 
[0 1]

[0 0]

? symbols = [a,b;c,d]
%2 = 
[a b]

[c d]

? jordan * symbols - symbols * jordan
%3 = 
[c -a + d]

[0     -c]

? symbols = [ a,b,c;d,e,f;g,h,i]
%4 = 
[a b c]

[d e f]

[g h i]

? jordan = [ 0,1,0; 0,0,1; 0,0,0]
%5 = 
[0 1 0]

[0 0 1]

[0 0 0]

? jordan * symbols - symbols * jordan
%6 = 
[d -a + e -b + f]

[g -d + h -e + i]

[0     -g     -h]

? jordan = [ 0,1,0,0; 0,0,1,0; 0,0,0,1;0,0,0,0]
%7 = 
[0 1 0 0]

[0 0 1 0]

[0 0 0 1]

[0 0 0 0]

? symbols = [ a,b,c,d; e,f,g,h; i,j,k,l; m,n,o,p]
%8 = 
[a b c d]

[e f g h]

[i j k l]

[m n o p]

? jordan * symbols - symbols * jordan
%9 = 
[e -a + f -b + g -c + h]

[i -e + j -f + k -g + l]

[m -i + n -j + o -k + p]

[0     -m     -n     -o]


  • $\begingroup$ 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 math.stackexchange.com/questions/136804/… $\endgroup$
    – Will Jagy
    Dec 24, 2013 at 20:49
  • $\begingroup$ Apologies if this is too trivial, but is there a direct proof for the equivalence: $(1)\iff (2) ?$ $\endgroup$
    – dezdichado
    Dec 26, 2018 at 22:01
  • $\begingroup$ @dezdichado I put in an illustration of the final bit, what happens if a square block commutes with a single Jordan block, for sizes 2,3,4. Suggest you copy these out by hand, as it is a bit hard to make out where the elements of the matrices "jordan * symbols - symbols * jordan" start and stop. Everything must become zero in one of those, which leads to a very precise pattern in the original matrix "symbols." $\endgroup$
    – Will Jagy
    Dec 26, 2018 at 23:37
  • $\begingroup$ thanks a lot! I will work through it. $\endgroup$
    – dezdichado
    Dec 27, 2018 at 18:37

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.


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

  • $\begingroup$ Would you mind providing some references? $\endgroup$
    – Bach
    Jul 25, 2019 at 6:35
  • 1
    $\begingroup$ You can search Cecioni Frobenious theorem. $\endgroup$ Jul 25, 2019 at 23:29

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

  • 2
    $\begingroup$ The adjoint is always a polynomial expression of the original matrix, and is $0$ if its rank is smaller than $n-1$. $\endgroup$
    – Jose Brox
    Nov 27, 2020 at 17:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .