Symmetric matrices represent real self-adjoint maps, i.e. linear maps that have the following property: $$\langle\vec{v},f(\vec{w})\rangle=\langle f(\vec{v}),\vec{w}\rangle$$ where $\langle,\rangle$ donates the scalar (dot) product.

Using this logic:

$$\langle\vec{v},AB\vec{v}\rangle=\langle A\vec{v},B\vec{v}\rangle=\langle BA\vec{v},\vec{v}\rangle$$

Where $A$ and $B$ are symmetric matrices. Using the fact that the real scalar dot product is commutative:

$$\langle BA\vec{v},\vec{v}\rangle=\langle\vec{v},BA\vec{v}\rangle$$

We therefore have the result:


This holds true for any real vector $\vec{v}$ so therefore $AB=BA$.

However, symmetric matrices do not always commute so something is wrong with this proof.

Eric M. Schmidt
  • 3,533
  • 2
  • 18
  • 31
  • 759
  • 4
  • 11
  • 1
    Aren't you assuming $BA$ is symmetric when you move it back over? – Randall Jun 03 '19 at 16:46
  • Apologies, I'll make that step clearer. – Pancake_Senpai Jun 03 '19 at 16:46
  • 2
    `\langle` gets a good vector bracket $\langle$ on the left. – Randall Jun 03 '19 at 16:49
  • 1
    i dont understand what happened in the last step of the equalities – Milan Jun 03 '19 at 16:52
  • The real dot product is commutative. – Pancake_Senpai Jun 03 '19 at 16:54
  • I've edited the proof to make it clearer. – Pancake_Senpai Jun 03 '19 at 16:57
  • 1
    @Pancake_Senpai by the way, I don't think commutative is the right word in this context. You're making use of the symmetry of the real inner product: for all $\xi, \eta \in V$, where $V$ is the vector space we are working on, $\langle \xi, \eta\rangle = \langle \eta, \xi \rangle$ – peek-a-boo Jun 03 '19 at 16:59
  • 7
    You would not have this problem if you tried to prove that $\langle v,ABw\rangle=\langle v,BAw\rangle$ for two *different* vectors $v,w$. (You can't, because it's not true. But if it was, you would then be justified in concluding that $AB=BA$.) –  Jun 04 '19 at 05:56

6 Answers6


You have proved that $v\mapsto v^TABv$ and $v\mapsto v^TBAv$ are the same quadratic form. However, since $AB$ and $BA$ are not necessarily symmetric, that doesn't mean they are the same matrix.

You can check this by plugging in some matrices where you know commutativity fails, for example $$ A =\begin{pmatrix} 1 & 0 \\ 0 & 2 \end{pmatrix} \quad B = \begin{pmatrix}0 & 1 \\ 1 & 0 \end{pmatrix} $$ We then get $$ AB = \begin{pmatrix}0 & 1 \\ 2 & 0 \end{pmatrix} \qquad BA = \begin{pmatrix}0 & 2 \\ 1 & 0 \end{pmatrix} $$ and indeed these define the same quadratic form: $$ (x\;\;y)\begin{pmatrix}0 & 1 \\ 2 & 0 \end{pmatrix}\begin{pmatrix}x\\ y\end{pmatrix} = 3xy = (x\;\;y)\begin{pmatrix}0 & 2 \\ 1 & 0 \end{pmatrix} \begin{pmatrix}x\\ y\end{pmatrix} $$ for all $x,y$, but the matrices are different.

hmakholm left over Monica
  • 276,945
  • 22
  • 401
  • 655
  • 27
    In particular, the exact logical fallacy is not in the computation, but in the words "so therefore $=$". – Greg Martin Jun 03 '19 at 16:57
  • Does that in effect mean that the two matrices $AB$ and $BA$ represent the same linear map but are not the same matrix? – Pancake_Senpai Jun 03 '19 at 17:03
  • 7
    @Pancake_Senpai: They implement different _linear maps_, but the same _quadratic form_. (It is more difficult for linear maps to be identical, because they give you an entire vector for each input, whereas a _form_ just gives you a single number). – hmakholm left over Monica Jun 03 '19 at 17:05
  • Thank you for updating your answer. – Pancake_Senpai Jun 03 '19 at 17:09
  • 14
    @Pancake_Senpai: More concretely, $AB\vec v$ and $BA\vec v$ are generally different, but it so happens that their _difference_ is always orthogonal to $\vec v$, such that the difference disappears when you take the inner product with $\vec v$. – hmakholm left over Monica Jun 03 '19 at 17:09
  • 3
    ^THAT is an amazing explanation. – Randall Jun 03 '19 at 17:11
  • 4
    I'm not sure why, but this seems like a good moment to mention that Henning's answers almost always inspire me to try to improve my own; I learn something new every time I read one, even if it's on a topic that I supposedly know well. :) Advice to new readers: read Henning's answers, even to questions that don't seem important to you right now. – John Hughes Jun 03 '19 at 17:25
  • Thanks for the praise, @JohnHughes! – hmakholm left over Monica Jun 03 '19 at 18:29
  • Lol same here. ${}$ – Randall Jun 03 '19 at 18:34
  • 1
    @Pancake_Senpai: I really want to emphasize Henning's second paragraph: "You can check this by..." If you know a result is wrong but can't find a mistake in the proof, you can almost always see the issue more clearly with a concrete example. More generally, any time you prove anything (or think you prove anything), you should test out both the conclusions and the steps of your proof on a list of varied examples. – Jason DeVito Jun 04 '19 at 11:59
  • It is worth mentioning that if $v^*[A,B]v=0$ for all *complex* $v$, then indeed $[A,B]=0$. What's happening is that $[A,B]$ is anti-Hermitian (it is the anti-Hermitian part of $AB$) for Hermitian $A$ and $B$, so it transforms real $v$ to a vector orthogonal to it -- but for complex $v$, matrix-vector multiplication is different, and the transformation has a non-zero "symplectic" structure. – Abhimanyu Pallavi Sudhir Jun 04 '19 at 17:24

With the same reasoning you can prove that for any square matrix $A$ it holds that $$\langle Ax,x\rangle =\langle A^T x,x\rangle.$$ You can't conclude that $A=A^T$ from here (you could if you would have $x$ and $y$ but that does not work).

So the thing is that the quadratic form $x\mapsto \langle Ax,x\rangle$ only determines the symmetric part of the matrix, but not the full matrix.

  • 11,270
  • 34
  • 57
  • Another way to state this: The map $\psi \colon \mathbb{R}^{n \times n} \to \mathbb{R} \to \mathbb{R}$ given by $\psi(A) := x \mapsto \langle Ax, x \rangle$ is **not injective**. Namely, we have $\psi(A) = \psi(A^T)$, and certainly if we just pick any non-symmetric $A$, we have a counterexample. The error in the OP precisely attempted to make use of injectivity to conclude the wrong equality. – ComFreek Jun 04 '19 at 14:28

The fallacy in your proof is, as others have observed, in the last step, in which you go from the (correct) equation

$\langle \vec{v}, AB\vec{v} \rangle = \langle \vec{v}, BA\vec{v} \rangle$

to the incorrect conclusion

This holds true for any real vector $\vec{v}$ so therefore $AB = BA$

To see why this is wrong, let's rephrase the underlying assumption here as a question:

Suppose $M, N$ are two matrices such that for all vectors $\vec{v}$, $\langle \vec{v}, M\vec{v} \rangle = \langle \vec{v}, N\vec{v} \rangle$. What can you conclude?

You would like to conclude that $M = N$. Is that true?

Because the inner product is bilinear, the assumption that $\langle \vec{v}, M\vec{v} \rangle = \langle \vec{v}, N\vec{v} \rangle$ is equivalent to $\langle \vec{v}, (M-N)\vec{v} \rangle = 0$. If we introduce a new matrix $K = M-N$, then our question is equivalent to the following:

Suppose $K$ is a matrix such that for all vectors $\vec{v}$, $\langle \vec{v}, K\vec{v} \rangle = 0$. What can you conclude about $K$?

Again, you would like to conclude that $K = 0$. Is that necessarily true?

Stated in this form it is perhaps easier to see where you have made your mistake. It is true that $\langle \vec{v}, \vec{v} \rangle = 0 \Longrightarrow \vec{v} = 0$ (this is one of the properties of any inner product), and the property you wish to assert looks sort of like this, if you don't look too closely. But it is not true in general that if $\langle \vec{v}, K\vec{v} \rangle = 0$ for all $\vec{v}$, then $K = 0$. Indeed, $\langle \vec{v}, K\vec{v} \rangle = 0$ holds for any antisymmetric matrix $K$. In the example of the original question $K = AB - BA$, the commutator of the two given symmetric matrices, which is always antisymmetric.

  • 21,723
  • 3
  • 44
  • 83
  • 1
    It might be worth summarising that $\langle \vec{v}, M\vec{v} \rangle = \langle \vec{v}, N\vec{v} \rangle$ for all $\vec v$ means precisely that $M$ and $N$ have the same _symmetric_ parts, but says nothing about their anti-symmetric parts (in their symmetric+anti-symmetric decompositions). – Marc van Leeuwen Jun 05 '19 at 10:03
  • This is a brilliant answer - thank you. – Pancake_Senpai Jun 05 '19 at 11:10
  • the commutator of any two matrices is always antisymmetric or only the commutator of two symmetric matrices is antisymmetric ? – Widawensen Jun 05 '19 at 12:19
  • For products AB and BA of symmetric matrices we have, it seems, interesting property - they have equal their symmetric parts and their skew-symmetric parts are opposite to each other. – Widawensen Jun 05 '19 at 12:33
  • @Widawensen Indeed I should have been more careful to emphasize that the given matrices $A$ and $B$ were symmetric, which is why their commutator $[A, B]$ is antisymmetric. Thanks for pointing that out -- I have edited accordingly. – mweiss Jun 05 '19 at 20:19

You have not made explicit why you think you can deduce from what you proved that $AB = BA$ but let me state the following things which are true:

  1. If you have two linear maps $T, S \colon V \rightarrow V$ on an inner product space (real or complex) and if $\left< Tv, u \right> = \left< Sv, u \right>$ for all pairs $u, v \in V$ then $T = S$.
  2. If you have two linear maps $T, S \colon V \rightarrow V$ on a complex inner vector space and if $\left< Tv, v \right> = \left< Sv, v \right>$ then $T = S$. This follows from a polarization identity. Note that this is weaker than the previous item because you require identity only for all vectors and not all pairs. Note also that this fails if $V$ is a real inner vector space (you can take for counterexample $V = \mathbb{R}^2, T = 0$ and $S$ a rotation by $90^{\circ}$s).

Now, let's see what goes wrong with your reasoning. Let's start with two symmetric real matrices $A,B \in M_n(\mathbb{R})$. You can do two things:

  1. Think of $A,B$ as maps from $\mathbb{R}^n$ to $\mathbb{R}^n$. More formally, set $T = L_A$ (the linear map which acts by multiplication by $A$) and $S = L_B$. Then you indeed have shown that $\left< TSv, v \right> = \left< STv, v \right>$ for all $v \in \mathbb{R}^n$. However, by the above, you see that this is not enough to deduce that $TS = ST$ (or $AB = BA$).
  2. Think of $A,B$ as maps from $\mathbb{C}^n$ to $\mathbb{C}^n$. Again, set $T = L_A$ and $S = L_B$. But then you have proved that $\left< TSv, v \right> = \left< STv, v \right>$ only for all $v \in \mathbb{R}^n$ and not for all $v \in \mathbb{C}^n$ (this is where you use "any real vector"). Hence, even though you work on a complex vector space, again you can't deduce that $TS = ST$ (or $AB = BA$).
  • 62,085
  • 5
  • 69
  • 107

Your error lies with these two lines


This holds true for any real vector $\vec{v}$ so therefore $AB=BA$.

The second line is a non sequitur. You seem to have an implicit step in here $(\forall \vec v: \langle\vec{v},M_1\vec{v}\rangle=\langle\vec{v},M_2\vec{v}\rangle) \rightarrow (M_1=M_2) $, however, that is not true. For instance, if $M_1$ rotates $\vec{v}$ ninety degrees clockwise, while $M_2$ rotates ninety degrees counterclockwise, $ \langle\vec{v},M_1\vec{v}\rangle=\langle\vec{v},M_2\vec{v}\rangle=0$.

Your underlying error seems to be affirming the consequent: if the matrices are equal, then the dot product are equal, the dot products are equal, therefore the matrices are equal.

You also may be confused by that fact that $(\forall \vec v: M_1 \vec v = M_2 \vec v ) \rightarrow (M_1=M_2) $ is valid logic. If two matrices define the same map, then they are the same matrix (with the appropriate caveats, such as both being over the same basis, etc.). But here, we aren't defining a map $\vec v \rightarrow M \vec v$, we're defining a map $\vec v \rightarrow \langle\vec{v},M \vec{v}\rangle$. The map involves $M$, but it isn't just $M$.

  • 11,145
  • 3
  • 13
  • 26

Dot product is a relative relationship which summarizes two vectors. A similar relationship is angle. The last statement in your proof amounts to, "because the angle between two vectors is the same, they must be the same vectors," which is wrong.