# Differentiation of summation of summation

According to http://www.atmos.washington.edu/~dennis/MatrixCalculus.pdf, (45) and (46) (p. 6),

differention of $$\alpha = \sum_{j=1}^n\sum_{i=1}^n a_{ij} x_i x_j$$

with respect to the k-th element of x yields:

$$\frac{\partial\alpha}{\partial x_k} = \sum_{j=1}^n a_{kj} x_j + \sum_{i=1}^n a_{ik} x_i$$

Note that a does not depend on x.

How is this result obtained?

From differentiation with summation symbol, I understood how to derive one summation. The function above seems to be of form f(g(x)) to me, so I would apply the chain rule. But how can the result contain a + then, indicating some form of the product rule was used?

-

Much simpler: $$\frac{\partial}{\partial x_k} \sum_{i, j} a_{i j} x_i x_j = \sum_{i, j} a_{i j} \left( \frac{\partial x_i}{\partial x_k} x_j + x_i \frac{\partial x_j}{\partial x_k} \right) = \sum_j a_{k j} x_j + \sum_i a_{i k} x_i$$
Note that all the terms $a_{ij}x_i x_j$ will vanish when neither $i$ nor $j$ is equal to $k$. So all the remaining terms are of the form $a_{ik}x_i x_k$ and $a_{kj}x_k x_j$, which when differentiated with respect to $x_k$ will yield respectively $a_{ik}x_i$ and $a_{kj} x_j$, as in the announced formula.
What about when $j=k$? – gt6989b Mar 28 '13 at 21:09
$j=k$ corresponds to the case $a_{ik}x_i x_k$ – Glougloubarbaki Mar 28 '13 at 21:11
I mean $i=j$ -- then differentiation will have a different outcome since you are differentiating $a_{kk}x_k^2$. – gt6989b Mar 28 '13 at 21:15
then just put $i=k$ in the first kind of terms, or $j=k$ in the second. the factor 2 will appear because you'll get one term of each kind – Glougloubarbaki Mar 28 '13 at 22:16