Let $x \in \mathbb{R}^{n}$ a vector, and $A(x) \in \mathbb{R}^{n \times n}$ a symmetric matrix depending on $x$ I need to find a way to differentiate $p(x) = x^t A(x) x \in $ with respect to $x$. This should be a 1 by $n$ vector.
I tried the following \begin{align} \frac{d p(x)}{d x} & = \frac{d x^t A(x) x }{d x} \\ & = \frac{d x^t}{d x} A(x) x + x^t \frac{d A(x) x }{d x} \end{align} But I think this is already incorrect because the first term can't be an 1 by $n$ vector anymore. Does anyone know how to do this?