I have to work with the following sum: $\sum_{ijk}\omega u_iu_j \delta_{ik}\delta_{kj}$ where $\omega$ is a constant in $\mathbb{C}$.
Is the answer: $$\omega \sum_k \sum_i u_i \delta_{ik}\sum_j u_j\delta_{kj}=\omega\sum_k u_k^2$$ or: $$\sum_{ij}u_iu_j \left(\sum_k \omega\delta_{ik}\delta_{kj}\right)=\sum_{ij}u_iu_j \left(2\omega-\omega\delta{ij}\right)=2\omega\sum_{ij}u_iu_j-\omega\sum_iu_i^2$$.
This is a pretty basic question, but I don't see where my logic is wrong here... If it is too obvious I can delete the question once my slow mind gets it... Anyway, thanks for your help!
Edit:
For the second line of calculation here was my reasoning:
In the $\sum_k \omega\delta_{ik}\delta_{kj}$ there are only two non-zero terms, namely when $k=i$ and when $k=j$ therefore $\sum_k \omega\delta_{ik}\delta_{kj}=2\omega$. However if $i=j$ then there is only one non-zero term. Therefore to consider this case I have to add $-\omega\delta_{ij}$.
Which yields: $\sum_k \omega\delta_{ik}\delta_{kj}=2\omega-\omega\delta_{ij}$.
When you manipulate this expression:
$$\sum_{i, j} u_i u_j \left( \sum_k \omega \delta_{ik} \delta_{kj} \right),$$
you first (rightfully) consider the sum over $k$:
$$\sum_k \omega \delta_{ik} \delta_{kj}.$$
A product of real numbers is non-zero if and only if each of the terms is non-zero. Here, if $\delta_{ik}=0$ or $\delta_{kj} = 0$, then $\omega \delta_{ik} \delta_{kj} = 0$; if $\delta_{ik}=\delta_{kj} = 1$, then $\omega \delta_{ik} \delta_{kj} = \omega$. Said otherwise:
If $i \neq k$ or $j \neq k$, then $\omega \delta_{ik} \delta_{kj} = 0$;
If $i=j=k$, then $\omega \delta_{ik} \delta_{kj} = \omega$.
If $i \neq j$, the second condition is never satisfied, so all of the terms are zero. If $i=j$, then there is only one non-zero term, corresponding to $k=i(=j)$. Hence:
$$\sum_k \omega \delta_{ik} \delta_{kj} = \omega \delta_{ij}.$$
Finally,
$$\sum_{i, j} u_i u_j \left( \sum_k \omega \delta_{ik} \delta_{kj} \right) = \sum_{i, j} u_i u_j \omega \delta_{ij} = \omega \sum_i u_i^2,$$
which is the same answer as with the first method.