Einstein summation convention differential I'm just learning this convention, and at times I'm a little lost, like now.
I have to calculate the following, knowing that $a_{ij}$ are constants such that $a_{ij}=a_{ji}$:
$$ \frac{\partial}{\partial x_{k}} \left[a_{ij}x_{i}\left(x_{j}\right)^{2}\right] $$
The answer I'm given I end up with:
$$ a_{ik}\left[\left(x_{i}\right)^{2}+2x_{i}x_{k}\right]$$
And this I don't understand. Why do I change to index $k$, and substitute $j$ with $i$ ? In my opinion, if I just use the product rule, I end up with:
$$ \frac{\partial}{\partial x_{k}} \left[a_{ij}x_{i}\left(x_{j}\right)^{2}\right] = a_{ij}\left[x_{i} \frac{\partial \left(x_{j}\right)^{2}}{\partial x_{k}}+ \frac{\partial x_{i}}{\partial x_{k}}\left(x_{j}\right)^{2}\right] = a_{ij}\left[\left(x_{j}\right)^{2}+2x_{i}x_{j}\right]$$
But maybe that is just as correct, or am I missing something?
 A: I think this is because after differentiation your bracket gives
\begin{equation}
a_{ij} \left( \delta_{ki}(x_{j})^{2}+2x_{i} \delta_{kj} x_{j}\right)
\end{equation}
Allowing $k \rightarrow j$
\begin{equation}
a_{ik} \left( \delta_{ki}(x_{k})^{2}+2x_{i} x_{k}\right) = 
a_{ik} \left( (x_{i})^{2}+2x_{i} x_{k}\right)
\end{equation}
A: When using this convention, the key is the switching of indices when the Kronecker Delta, $\delta$, gets involved. Use the following solution as a guide: 
First, we can take out the constant $a_{ij}$, leaving us with 
$$a_{ij}\frac{\partial}{\partial x_k}\left[x_i(x_j)^2\right]$$
Now, applying the chain rule
$$a_{ij}\left[x_i\frac{\partial(x_j)^2}{\partial x_k} +(x_j)^2\frac{\partial x_i}{\partial x_k}\right]$$
yielding
$$a_{ij}\left[2x_ix_j\frac{\partial x_j}{\partial x_k} +(x_j)^2\frac{\partial x_i}{\partial x_k}\right]$$
Here's a crucial step. We introduce the Kronecker Delta function as follows, letting $\frac{\partial x_i}{\partial x_k}= \delta_{ik}$ and $\frac{\partial x_j}{\partial x_k}= \delta_{jk}$, by definition, the value of which is given by 
$$\delta_{ij}=
\begin{cases} 
      0 & i\neq j  
      \\
      1 & i=j
   \end{cases}$$
Now, upon substitution, we have
$$a_{ij}\left[2x_ix_j\delta_{jk} + (x_j)^2\delta_{ik}\right]$$
Multiplying through by $a_{ij}$
$$2a_{ij}x_ix_j\delta_{jk} + a_{ij}(x_j)^2\delta_{ik}$$
Let's take a look at the first term
$$2a_{ij}x_ix_j\delta_{jk}$$
According to the definition of Kronecker Delta, in order for $\delta_{jk}$ to be nonzero (ie. 1), $\,$ $j$ must equal $k$. As a result, the subscript j in the first term must be replaced with k. We denote this by $\,$ $j \to k$. (Do not forget $\delta_{jk} = 1$ because of this).
Doing so, we get 
$$2a_{ik}x_ix_k$$
Similarly, for the second term, we let $i \to k $, yielding 
$$a_{jk}(x_j)^2 $$ (Note that $a_{jk} = a_{kj}$)  
Altogether, we have 
$$2a_{ik}x_ix_k + a_{jk}(x_j)^2$$
Now, a dummy index can be replaced by whatever you wish, as long as it not already present in the term. This means that I can replace the dummy index $j$ in the second term by an $i$, which then allows me to factor out the constant. Doing so, we finally get the desired answer 
$$a_{ik}\left[2x_ix_k + (x_i)^2\right]$$
