# Proving that $x^TAx = tr(xx^TA)$? [closed]

How to prove that for any square symmetric matrix $A$ and a vector $x$
$x^TAx = tr(xx^TA)$?

• Please add the self-study tag, read its tag-wiki and modify your question to clearly identify what you've done to solve the problem yourself, and indicate the specific help you need at the point you struck difficulty. Oct 10 '16 at 7:20

A well-known property of traces (see Matrix Cookbook, 1.1 (16)) is that for any $A, B, C$, $\mbox{tr}(ABC) = \mbox{tr}(BCA)$.

Applying this to your case gives $\mbox{tr}(x x^T A) = \mbox{tr}(x^T A x)$. Note that the expression in the trace of the right hand side is a scalar. The trace of a scalar is the scalar itself.

• Please read the help center in relation to homework. Specifically, (among other things) it says "The community will try to provide guidance, hints, and useful links."... similarly see the opening like of the self-study tag wiki: "This community's policy is to 'provide helpful hints' for self-study questions". Complete solutions (doing people's homework for them) rob students of the benefits of doing their homework (which is why it is set for them in the first place) -- guiding them to a solution of their own is generally more valuable Oct 10 '16 at 9:28
• @Glen_b Sorry, will try to follow them better in the future. The community guidelines here are very different than at StackOverflow, which probably threw me off. Oct 10 '16 at 10:03
• The self-study guidelines are actually based on guidelines in a post at meta.StackOverflow which were subsequently slightly modified for meta.math.SE. If StackOverflow doesn't follow its own guidelines, that's a concern. Oct 10 '16 at 10:09

Some guidance in the form of an outline of the steps

1. Note that $x^TAx$ is a scalar.

2. Use what you know about the trace and scalars to convert it to a trace.

3. Use properties of the trace to convert it to what you need.

Given $\mathrm a, \mathrm b \in \mathbb R^n$,

$$\mbox{tr} ( \, \mathrm a \mathrm b^\top ) = a_1 b_1 + a_2 b_2 + \cdots + a_n b_n = \mathrm a^\top \mathrm b$$

Thus,

$$\mbox{tr} (\mathrm x \mathrm x^\top \mathrm A) = \mbox{tr} (\mathrm x (\mathrm A^\top \mathrm x)^\top ) = \mathrm x^\top \mathrm A^\top \mathrm x = \mathrm x^\top \mathrm A \, \mathrm x$$