# Why can't matrix commute?

Sorry if this question sounds silly, and it probably is. I can prove easily that matrix multiplication is noncommutative; however, look at this 'fake' proof:

$$AB=e^{\ln(A)}e^{\ln(B)}=e^{\ln(A)+\ln(B)}$$

$$\ln(A)$$ and $$\ln(B)$$ are also matrices, and matrix addition is comutative. So:

$$e^{\ln(A)+\ln(B)}=e^{\ln(B)+\ln(A)}=e^{\ln(B)}e^{\ln(A)}=BA$$

What's the problem?

• $e^{x+y}=e^{x}e^{y}$ is only true for commutative multiplication. Otherwise you need the Baker-Campbell-Hausdorff formula: en.wikipedia.org/wiki/… Commented Jul 12, 2022 at 17:44
• Your second equality is true iff ln(A) and ln(B) commute iff A and B commute Commented Jul 12, 2022 at 17:46
• Sorry if I miss something obvious, but how is $\ln A$ defined? Commented Jul 12, 2022 at 18:05
• @MathematicianByMistake It is not obvious. The Wikipedia article on the matrix exponential covers a meaningful logarithmic series for a matrix Commented Jul 12, 2022 at 18:22
• @MathematicianByMistake you can define complex logarithms for invertible matrices by a power series using their multiplicative dunford decomposition. If you want a real valued log you need a bit more. Commented Jul 12, 2022 at 18:25

The definition of a matrix exponential is: $$e^A = \sum_{k\in\mathbb{N}}\frac{1}{k!}A^k$$ hence on one hand: $$e^{(A+B)} = \sum_{k\in\mathbb{N}}\frac{1}{k!}(A+B)^k$$ and on the other hand: $$e^{A}e^{B} = \left(\sum_{k\in\mathbb{N}}\frac{1}{k!}A^k \right) \left(\sum_{k\in\mathbb{N}}\frac{1}{k!}B^k \right) \\ = \sum_{k\in\mathbb{N}} \sum_{i=0}^k \frac{1}{i!(k-i)!}A^iB^{k-i}$$ If $$A$$ and $$B$$ commute you can verify by the binomial theorem that: $$\frac{1}{k!}(A+B)^k = \sum_{i=0}^k \frac{1}{i!(k-i)!}A^iB^{k-i}$$ hence $$AB=BA \Rightarrow e^{(A+B)} = e^A e^B$$ But the identity you leverage in your fake proof is not true in general ! Martin Argerami provided a counterexample in his response.

Here is a simple example you can try by hand.

Let $$A=\begin{bmatrix} 1&0\\0&0\end{bmatrix},\qquad\qquad B=\begin{bmatrix} 0&1\\0&0\end{bmatrix} .$$ Then $$e^A=\begin{bmatrix} e&0\\0&1\end{bmatrix},\qquad \qquad e^B=\begin{bmatrix} 1&1\\0&1\end{bmatrix},$$

$$\$$

$$e^Ae^B=\begin{bmatrix} e&e\\0&1\end{bmatrix},\qquad\qquad e^Be^A=\begin{bmatrix} e&1\\0&1\end{bmatrix} \qquad\qquad e^{A+B}=\begin{bmatrix} e&e-1\\0&1\end{bmatrix}.$$

First, let's come up with a way to define the exponential and logarithm of a matrix.

Suppose that a matrix $$M$$ is diagonalizable, i.e., there exists a non-singular matrix $$S$$ and a diagonal matrix $$D$$ such that $$M = SDS^{-1}$$. Then for any integer $$n$$, it can be shown that $$M^n = SD^nS^{-1}$$.

This allows us to use the Taylor series to define the matrix exponential:

$$e^M = \sum_{k=0}^\infty \frac{1}{k!} M^k$$ $$= \sum_{k=0}^\infty \frac{1}{k!} SD^kS^{-1}$$ $$= S(\sum_{k=0}^\infty \frac{1}{k!} D^k)S^{-1}$$ $$= Se^DS^{-1}$$

where $$e^D$$ denotes a diagonal matrix where the individual diagonal elements are the exponentials of the corresponding elements in $$D$$.

We can similarly define $$\ln{M} = S(\ln D)S^{-1}$$. But note that $$\ln D$$ will be complex if $$D$$ contains any negative values. And $$\ln D$$ will be undefined if $$D$$ has any zeroes on its diagonal (i.e., if $$M$$ is singular).

If two matrices $$A$$ and $$B$$ are simultaneously diagonalizable, with $$A = SDS^{-1}$$ and $$B = SES^{-1}$$, then yes, it is true that $$\ln AB = S(\ln D + \ln E)S^{-1} = S(\ln E + \ln D)S^{-1} = \ln BA$$, and so the two matrices commute. But if they're not simultaneously diagonalizable, then they won't necessarily commute.

Commutative means : $$\forall A , B (AB=BA)$$
Non-Commutative means : It is not true that $$\forall A , B (AB=BA)$$ ; In other words $$\exists A , B (AB \ne BA)$$

Even in Non-Commutative Case, there may be some Examples of $$\exists A , B (AB = BA)$$
Eg : set $$B=I$$, and you will get Equality.

Issue(s) in your "fake" Proof is :
(1) There may be some $$A$$ & $$B$$ where it is Equal, but not for all $$A$$ & $$B$$, in general.
(2) Assuming that $$e^A$$ & $$log(A)$$ of Matrix A are Well-Defined for all A.