# Simplify multiple summations involving Kronecker deltas

Sorry if this has been asked before, but I couldn't find a specific answer to it.

These work, i.e. they simplify:

Sum[KroneckerDelta[a, 5] f[a], {a, Infinity}] f[5] 

Sum[DiscreteDelta[a - 5] f[a], {a, Infinity}] f[5] 

And:

Sum[KroneckerDelta[a, n] f[a], {a, Infinity}]

Sum[DiscreteDelta[a - n] f[a], {a, Infinity}]

also simplify when explicitly indicated, i.e. when invoking Simplify / FullSimplify.

But simplifications over multiple summations don't work, even for the simplest of cases: Sum[KroneckerDelta[a, 5] f[a], {a, Infinity}, {b, Infinity}]

Sum[DiscreteDelta[a - 5] f[a], {a, Infinity}, {b, Infinity}]

Edit: As mentioned, this specific example is not good. Here is the original case that motivates my question:

$$\sum_{a=0}^\infty \sum_{b=0}^\infty f(a) f(b)\ \delta_{a, b}$$

that is,

Sum[f[a] f[b] KroneckerDelta[a, b], {a, 0, Infinity}, {b, 0, Infinity}]

which can be simplified to a single sum:

$$\sum_{a=0}^\infty f(a)^2$$

Can Mathematica be instructed to simplify expressions like these?

Thanks.

• Your double sums are infinite, there's no way Mathematica can give you a result for them. – Roman Jun 7 '19 at 10:15
• You can sometimes simplify multiple infinite sums involving Kronecker deltas into a single infinite sum. I hope it's clearer now with the new example. – Mauro Lacy Jun 7 '19 at 19:01

## 1 Answer

use assumptions with PositiveIntegers instead of NonNegativeIntegers:

Assuming[Element[n, PositiveIntegers],
Sum[KroneckerDelta[a, n] f[a], {a, Infinity}]]
(*    f[n]    *)

Assuming[Element[n, PositiveIntegers],
Sum[DiscreteDelta[a - n] f[a], {a, Infinity}]]
(*    f[n]    *)

• Thanks, those work, yes. It seems I had some already defined values that were messing with the simplification rules. I'll edit the question. – Mauro Lacy Jun 7 '19 at 10:12
• In fact these work without assumptions, that is, just by invoking Simplify on them. – Mauro Lacy Jun 7 '19 at 10:38
• On my system, without assumptions the command Sum[KroneckerDelta[a, n] f[a], {a, Infinity}] // Simplify returns f[n] UnitStep[-1 + n], as it should. Please always try your code in a fresh kernel. – Roman Jun 7 '19 at 10:45
• My result matches yours... it's already a simplification, so, that's OK. Please take a look at the multiple sum at the end of my (edited) question. I'm in fact asking about that case. – Mauro Lacy Jun 7 '19 at 19:03