2 Answers
2

Both expressions are correct, up to some missing parentheses, in the following sense: For each $i$, we have $\frac{\partial}{\partial x_i}(x^TAx) = 2(Ax)_i$ and $\frac{\partial}{\partial x_i}(x^TBx) = 2(Bx)_i$, so the quotient rule tells us that

Since $(x^TAx)$ and $(x^TBx)$ are just numbers, if left inside their parentheses they can multiply a vector or matrix from either side. Hence the first expression is also correct if you are sure to leave in the parentheses: