Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What's the derivative of $f(w)$ with respect to the vector $w$?

$$f(w)=\mathrm{tr}(ww'A) + x^{\prime}ww'x$$


$x,w$ are vectors and $A$ is a square matrix.

${}'$ indicates transpose


share|cite|improve this question

It is usually good to write it out explicitly in coordinates. As far as I understand your notation, you have $$f(w) = \sum_{ij} w_i w_j A_{ji} + \sum_{ij} x_i w_i w_j x_j.$$

Taking the derivative with respect to $w_k$, we have $$\frac{\partial f(w)}{\partial w_k} = \sum_j[ w_j (A_{jk} + A_{kj}) + 2 x_k w_j x_j] .$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.