# Double sum of two delta functions

I am working on a problem in statistical mechanics involving a double sum of two dirac-delta functions. I am not sure how to $$\text{relate} \quad \sum_{i=1}^{N} \sum_{j=1}^{N} \delta (r - r_{i}) \delta (r' - r_{j}) \quad \text{to} \quad \sum_{i=1}^{N} \sum_{\substack{j=1 \\ j \neq i}}^{N} \delta (r - r_{i}) \delta (r' - r_{j})$$ My attempt is to take out an $$i$$ term from the inner sum: $$\sum_{i=1}^{N} \sum_{j=1}^{N} \delta (r - r_{i}) \delta (r' - r_{j}) \to \sum_{i=1}^{N} \sum_{\substack{j=1 \\ j \neq i}}^{N} \delta (r - r_{i}) \delta (r' - r_{j}) + \sum_{i=1}^{N} \delta (r - r_{i}) \delta (r' - r_{i})$$ However, the given answer is $$\sum_{i=1}^{N} \sum_{j=1}^{N} \delta (r - r_{i}) \delta (r' - r_{j}) = \sum_{i=1}^{N} \sum_{\substack{j=1 \\ j \neq i}}^{N} \delta (r - r_{i}) \delta (r' - r_{j}) + \delta (r' - r) \sum_{i=1}^{N} \delta (r - r_{i})$$ How did the second delta function change from $$\delta(r'-r_{j})$$ into $$\delta(r' - r)$$?

• @MishaLavrov It is Dirac delta. The particle density is given by $\rho (r) = \sum_{i=1}^{N} \delta (r - r_{i})$. – ferris Apr 25 at 3:01

Since $$\delta(x-y)f(x)=\delta(x-y)f(y)$$, $$\delta(r-r_i)\delta(r'-r_i)=\delta(r-r_i)\delta(r'-r)$$. Therefore, $$\sum_{i=1}^N \delta (r-r_i)\delta (r'-r_i) = \sum_{i=1}^N \delta (r-r_i)\delta (r'-r) = \delta(r'-r)\sum_{i=1}^N \delta(r-r_i)$$