A proof of $x^TAx=\mathrm{tr}(Axx^T)$

2.6k Views Asked by At

In this post here my answer was downvoted. Unfortunately, I cannot find the mistake and the downvoter did not comment. The question was to prove that $x^TAx=\mathrm{tr}(Axx^T)$.

The argument I gave was to note that trace is linear hence if trace agrees with $x^TAx$ on the basis vectors then the two must be equal (linear transforms are uniquely determined by what they map the basis vectors to). But it's clear that for the standard basis the equality $x^TAx=\mathrm{tr}(Axx^T)$ holds (I mean, really clear, in the sense that the necessary computation is simple enough so you can do it in your head).

Apparently this is incorrect and I would like to know why. Thank you in advance.

A thought: Of course the maps involved are really bi linear (not just linear) but I believe the argument stays the same.

3

There are 3 best solutions below

0
On

$A = \pmatrix{0 & 1\cr 0 & 0\cr}$ satisfies $x^T A x = 0$ for the standard basis vectors, but not in general.

As for the identity $x^TAx = \text{tr}(Axx^T)$, it's linear in $A$. Is it true for a matrix with one nonzero entry?

1
On

The key flaw in your argument is that (bi)linearity isn't preserved under duplication of arguments; if $f(x,y)$ is a bilinear function of $x$ and $y$ then that doesn't imply that $g(x)=f(x,x)$ is a linear function of $x$. The easiest way to see this is to specialize to the one-dimensional case and look at $f(x,y)=xy$; this is obviously bilinear in $x$ and $y$, but $g(x)=f(x,x)=x^2$ certainly isn't a linear function of $x$.

5
On

Both expressions are quadratic on $x$, not linear. So if $x=\sum x_je_j$ where $e_j$ are the canonical basis vectors, you have $$ x^TAx=\sum_j\sum_kx_jx_k\,e_j^TAe_k. $$ Similarly, $$ \text{Tr}(Axx^T)=\sum_j\sum_kx_jx_k\,\text{Tr}(Ae_ke_j^T). $$ Now you could verify that $e_j^TAe_k=\text{Tr}(Ae_ke_j^T)$ to finish the proof. This is certainly easy, but I wouldn't say it deserves to be claimed as true without justification.

Now the main point is that the original proof can be achieved with way less effort. If you think of $x$ as the first element in an orthonormal basis (as both expressions are quadratic on $x$ we can assume that $x^Tx=1$), then $x^TAx$ is $A_{11}$ when $A$ is represented in such a basis. And using that $xx^T$ is the rank-one projection onto the span of $x$, $\text{Tr}(Axx^T)=\text{Tr}(xx^TAxx^T)$, which is again the $1,1$ entry of $A$ in an orthonormal basis whose first element is $x$.