2

A proof I'm looking at shows $\triangledown_x x^TA^TAx = 2A^TAx$.

I did Matlab symbolic calculation to verify this, but I found the converse. It should be $2x^TA^TA$.

$\frac{d}{dx}x^TA^TAx = \\ [ 2x_1A_{1,1}^2 + 2A_{1,2}x_2A_{1,1} + 2x_1A_{2,1}^2 + 2A_{2,2}x_2A_{2,1},\\ 2x_2A_{1,2}^2 + 2A_{1,1}x_1A_{1,2} + 2x_2A_{2,2}^2 + 2A_{2,1}x_1A_{2,2}]$

I ran jacobian(x'*A'Ax, x) for this one.

$2x^TA^TA=\\ [ 2x_1A_{1,1}^2 + 2A_{1,2}x_2A_{1,1} + 2x_1A_{2,1}^2 + 2A_{2,2}x_2A_{2,1}, \\2x_2A_{1,2}^2 + 2A_{1,1}x_1A_{1,2} + 2x_2A_{2,2}^2 + 2A_{2,1}x_1A_{2,2}]$

$2A^TAx = \\ [ 2x_1A_{1,1}^2 + 2A_{1,2}x_2A_{1,1} + 2x_1A_{2,1}^2 + 2A_{2,2}x_2A_{2,1};\\ 2x_2A_{1,2}^2 + 2A_{1,1}x_1A_{1,2} + 2x_2A_{2,2}^2 + 2A_{2,1}x_1A_{2,2}$

Am I missing something here?

drerD
  • 589
  • Note that $x^\top A^\top Ax=|Ax|^2_2$ and https://math.stackexchange.com/q/883016/154545 – Surb Oct 16 '18 at 00:20

2 Answers2

4

The only difference between the two answers is whether you want your gradient to be a row vector or a column vector.

angryavian
  • 89,882
1

If I do graident(x'*A'Ax, x), then I get $2A^TAx$, so the original proof is correct.

drerD
  • 589