How might i go about finding the derivative the following double sum
$$\frac{\partial }{\partial x_i}\left(\sum _{k=1}^n\:\sum _{j=1}^n\:a_{kj}x_kx_j\right)\:$$
My inital idea was to end put the summation terms and $a_{kj}$ outside of the derivative, and then look for special cases where i=j i=k and i=j=k. However i'm quite stuck in the way of expressing it. Basically this is as far as i got.
$$\frac{\partial }{\partial x_i}\left(\sum _{k=1}^n\:\sum _{j=1}^n\:a_{kj}x_kx_j\right)\: = \sum _{k=1}^n\:\sum _{j=1}^n\:a_{kj}\frac{\partial \:}{\partial \:x_i}\left(x_kx_j\right)\:$$
Depending on the index $k$ we have to treat $x_k$ as constant if $k\ne i$ and as variable if $k=i$. The same holds for the index $l$. Consequently we partition the index range conveniently.
Comment:
In (1) we partition the double sum according to the factors $x_i$ in each summand.
In (2) we use the linearity of the partial derivative.
In (3) we do the partial differentiation.
In (4) we do some final simplifications.