I've got a silly question, but I don't see, where I'm wrong.
Given $x,y \in \mathbb{R}^D$ and $A$ is a symmetric matrix. $$ f(A) = (x-y)^T A (x-y)\\ \frac{\partial{f}}{\partial{A}} = (x-y)(x-y)^T $$ But if I expand brackets in $f(A)=x^T A x - 2x^T A y + y^T A y$, because A is symmetric. Then it's derivative $$ \frac{\partial{f}}{\partial{A}} = xx^T - 2xy^T + yy^T $$ which is not equal to the derivative in the first case in general. Why is that?
How I've calculated the derivative in the first case. $$ df = d((x-y)^T A (x-y)) = d(tr((x-y)^T A (x-y))) = tr(d((x-y)^T A (x-y))) =\\ tr((x-y)^T(dA) (x-y)) = tr((x-y)(x-y)^T(dA)) = \langle (x-y)(x-y)^T, dA \rangle $$ The derivative is $(x-y)(x-y)^T$.