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

How can I prove the following easily?(If it is true of course.)

\begin{align} \nabla_{\mathbf{x}_k} \left( \sum_{i=1}^{n}\sum_{j=1}^{n} \mathbf{x}^{T}_i \mathbf{W}_{ij} \mathbf{x}_j \right)=\sum_{j=1}^{n}(\mathbf{W}_{kj}\mathbf{x}_{j}+\mathbf{W}_{jk}^{T}\mathbf{x}_j) \end{align}

Here each $\mathbf{x}_i \in \mathbb{R}^{N}$ is a different vector, and each $\mathbf{W}_{ij} \in \mathbb{R}^{N\times N}$ is a different matrix of real numbers for $i,j = 1,2,...,n$.

share|cite|improve this question
possible duplicate of The del operator – Giuseppe Negro Jan 15 '13 at 11:46
@GiuseppeNegro If you believe they are duplicate, please tell me how can I apply the answer to that question to this one. Then I will know the answer. In that question vectors to the right and left of the matrix are same, in this one they are not. – Sunny88 Jan 15 '13 at 13:24
Well, the fact is that $$x^TWx$$is just a condensed notation to say $$\sum_{i,j} x_i W_{ij}x_j.$$ That's why I say that those questions are really the same: the difference is only apparent. Don't you agree? – Giuseppe Negro Jan 15 '13 at 16:33
@GiuseppeNegro Yes, but in this case these are vectors and matrices, while in the other question these were real numbers. Can you show me how can I solve this question using the result from the linked question? – Sunny88 Jan 15 '13 at 17:01
@GiuseppeNegro And the answer is also different.. In this question the two matrices in the answer are different, while in the linked question they were same. – Sunny88 Jan 15 '13 at 17:02
up vote 0 down vote accepted

I think I solved: \begin{align} \nabla_{x_k} \left( \sum_{i=1}^{n}\sum_{j=1}^{n} x^{T}_i W_{ij} x_j \right) &= \sum_{i=1,i\neq k}^{n}W_{kj}x_j + \sum_{j=1, j\neq k}^{n}(x^T_jW_{jk})^T + x^T_k W_{kk} x_k\\ \text{using the linked question:}\\ &= \sum_{i=1,i\neq k}^{n}\left( W_{ki}x_i + W^T_{ik}x_i \right)+ W_{kk} x_k + W^T_{kk}x_k\\ &= \sum_{i=1}^{n}\left( W_{ki}x_i + W^T_{ik}x_i \right) \end{align}

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.