# simplifying indefinite sums containing Kronecker Deltas

I want to simplify indefinite sums containing KroneckerDeltas, e.g:

$$\sum_{k,k1,q} \beta(q) \beta(k+k1+q) \delta(k1+q)= \sum_{k,q} \beta(k)\beta(q)$$ where $$k,k1,q \;\epsilon \; \mathrm{R}$$

Sum[ β[q] β[k + q + k1] KroneckerDelta[k1 + q], k, k1,q]


however

Sum[ β[q] β[k + q + k1] KroneckerDelta[k1 + q], k, k1, q] // FullSimplify


doesn't work, i.e I don't get

Sum[β[q] β[k ], k, q]


I also tried

c = FullSimplify[KroneckerDelta[q + k1] β[q] β[k + q + k1]]
Assuming[c != 0, FullSimplify[Sum[c, k, k1, q]]]


but it just returns the input sum.

I have found here a custom MyDiscreteDelta function which also doesn't work. Is there a way to achieve such simplifications?

• There is no way to achieve this because the result you are after is in general not correct: in order to get it you need to rewrite and reorder the summations, which is only possible under special convergence conditions. You can simplify expressions using a custom KroneckerDelta and TagSetDelayed, e.g. \[Delta] /: f_[x_ + y_] \[Delta][x_ + z_] := f[y - z], but you'll need to keep track of summation indices and make sure your operations are actually mathematically correct... Dec 22, 2020 at 8:45
• @FidelI.Schaposnik thanks for the reply. Your custom  [Delta] is a good idea but it does not take away the sum over k1 in  Sum[β[q] β[k + q + k1] δ[k1 + q], k, k1, q]. I can only manually erase it?
– geom
Dec 22, 2020 at 9:03
– geom
Dec 22, 2020 at 11:00

Posting as an answer at the request of the OP

There is probably no built-in way to achieve what you want because the result you are after is in general not correct: in order to get it you need to rewrite and reorder the summations, which is only possible under special convergence conditions.

That being said, if you are sure beforehand that all your manipulations will be legal you can automatically simplify expressions like the ones you present using custom symbols and TagSetDelayed. For example

MyDelta /: f_[x_ + y_] MyDelta[x_ + z_] := f[y - z]


will make an expression like f[q]f[k+k1+q]MyDelta[k1+q] transform to f[q]f[k], and something like

MySum /: MySum[expr_ KroneckerDelta[x_ + y_], left___, x_, right___] := MySum[expr /. x -> -y, left, right]


will take expressions like MySum[f[i + j] KroneckerDelta[j + k], i, j, k] into MySum[f[i - k], i, k].

Depending on your intended application, you may want to add stuff (e.g. make MySum linear, regularize MyDelta under the summation sign, etc.), or make some of these replacements manually instead of automatically... but you should always keep in mind that this symbolic transformations can go wildly wrong if you are not very careful about how you implement things, and to which problems you apply them...