TITLE: Does $e^{AB}=e^{BA}$ imply $AB=BA$?
QUESTION [11 upvotes]: Let $A \in \mathbb{R}^{n \times n}$ and $B \in \mathbb{R}^{n \times n}$. Is it true that $e^{AB}=e^{BA}$ implies $AB=BA$? If not, can you provide a counter example?

REPLY [7 votes]: Not necessarily. You can find $A$, $B$, $2\times 2$ matrices with real entries such that 
$$AB - BA = \left(\begin{matrix} 0 & - 2 \pi \\
2\pi & 0 \end{matrix} \right)$$
Then 
$$e^{AB-BA} = \left(\begin{matrix} \cos 2\pi & - \sin 2 \pi \\
\sin 2\pi & \cos 2 \pi \end{matrix} \right)= I_2$$ and so $e^{AB} = e^{BA}$ ( cheating a bit here, since we need $AB$, $BA$ commuting, but see details below).
$\bf{Added:}$ Here are details:
Take $$A= \left(\begin{matrix} 1  & 0 \\
0 & -1 \end{matrix} \right)\\
B= \left(\begin{matrix} 0  & -\pi \\
-\pi & 0 \end{matrix} \right)\\
$$
Then 
$$AB = \left(\begin{matrix} 0  & -\pi \\
\pi & 0 \end{matrix} \right)\\
BA= \left(\begin{matrix} 0  & \pi \\
-\pi & 0 \end{matrix} \right)\\
$$
We have $e^{AB} = e^{BA}= -I_2$.