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

Given: $E(\mathbf{x})=\mathbf {x^tWx}$
Where x is vector and W is matrix, can anybody explain me how can I easily derive the following equation (If it is correct. If not, what should it be?)?
$\nabla E(\mathbf{x}) = \mathbf{Wx} + \mathbf{W^tx}$

share|cite|improve this question
up vote 2 down vote accepted

Explicitly, using indices, the expression is (where $i$ ranges as appropriate)

$$\nabla(x^TAx)=\frac{\partial}{\partial x_i}\sum_{\ell, m}x_\ell A_{\ell m}x_m.$$

Compute $\displaystyle\frac{\partial x_\ell x_m}{\partial x_i}=\delta_{i\ell}x_m+x_\ell\delta_{im}$ with the product rule (see Kronecker delta). Plugging in,

$$\sum_{\ell,m}A_{\ell m}(\delta_{i\ell}x_m+x_\ell\delta_{im})=\left(\sum_{m}A_{im}x_m\right)+\left(\sum_{\ell}x_\ell A_{\ell i}\right)=Ax+A^Tx. $$

share|cite|improve this answer
Can't I do it without using indices? – Sunny88 Dec 5 '12 at 11:59
@Sunny88 Whatever you do, it will be a condensed version of this. Of course, in order to establish various short-and-sweet rules for this stuff, one would need to chug through with indices anyway. The question of if you can do it without indices sounds to me analogous to asking to send an email without doing anything with circuitry. You can of course do it without personally touching any circuitry, but you're using the circuitry anywho, and someone somewhere had to devise the circuitry in the first place... – anon Dec 5 '12 at 12:27

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.