# Simplify Kronecker Delta expression

How to obtain Kronecker delta summation rule using Wolfram Mathematica: $$\delta_{ij}\delta_{jk}=\delta_{ik}$$

The following code does not produce the result.

Sum[KroneckerDelta[i, j] KroneckerDelta[j, k], {j, 1, 3}]


It gives the following output instead. $$\delta_{i1}\delta_{1k}+\delta_{i2}\delta_{2k}+\delta_{i3}\delta_{3k}$$

May be this can be done by using xAct package?

• Why should it simplify to your from? Put $i=k=4$. – Andrew Jan 12 '19 at 12:24
• You're right. I didn't mean that 3D space in general. But I need to simplify such summations without additional assumptions of the dimension of the space. – Ilya Bryukhanov Jan 12 '19 at 12:40
• Sum[KroneckerDelta[i, j] KroneckerDelta[j, k], j] // Simplify; does not provide the desired result. – Ilya Bryukhanov Jan 12 '19 at 12:41
• xAct can do this. It would be something like declaring DefManifold[M, 3, {i, j, k, l}] and then using (note the need to match up/down indices): In[]:= delta[-i, j] delta[-j, k] Out[]= delta[-i, k] – jose Jan 16 '19 at 1:52
• This is relevant mathematica.stackexchange.com/questions/202373/… – yarchik Feb 27 at 12:14

You might consider using DiscreteDelta[i-j] instead of KroneckerDelta[i,j]. With this substitution, the desired simplification occurs automatically:

Sum[DiscreteDelta[i - j] DiscreteDelta[j - k], {j, -\[Infinity], \[Infinity]}]
DiscreteDelta[i - k]

• Thanks a lot!. Do you know packages for Wolfram that do the simplifications of kronecker delta expression faster than DiscreteDelta? – Ilya Bryukhanov Jan 13 '19 at 19:55

This work, but doesn't give the answer in the terms of KronekerDelta function:

Simplify[Sum[KroneckerDelta[i, j] KroneckerDelta[j, k], {j, -\[Infinity], \[Infinity]}],
i \[Element] Integers && k \[Element] Integers]


$$\begin{cases} 1 & i=k \\ 0 & \text{True} \end{cases}$$ If parameters $$i$$, $$k$$ etc which should be integer are known, this command changes this piecewise function into KronekerDelta:

       kroneckerReduce[expr_, freeindexes_] :=FullSimplify[expr, freeindexes \[Element] Integers] /.
Piecewise[{{1, freeindex1_ == freeindex2_}}, 0] -> KroneckerDelta[freeindex1, freeindex2]


as in

kroneckerReduce[Sum[KroneckerDelta[i, j] KroneckerDelta[j, k], {j, -\[Infinity], \[Infinity]}], {i, k}]


$$\delta _{i,k}$$

• Thanks a lot!. Do you know packages for Wolfram that do the simplifications of kronecker delta expressions? – Ilya Bryukhanov Jan 14 '19 at 10:23
• @IlyaBryukhanov no. – Andrew Jan 14 '19 at 11:15

Not very satisfactory, but it works for specific values of $$i$$ or $$k$$

Table[Sum[KroneckerDelta[i, j] KroneckerDelta[j, k], {j, 1, 3}], {i, 3}]

(*{KroneckerDelta[1, k], KroneckerDelta[2, k], KroneckerDelta[3, k]}*}


See here:

    Subscript[δ, i_, j_] := KroneckerDelta[i, j];
ruleDelta =
KroneckerDelta[1, i_] KroneckerDelta[1, k_] +
KroneckerDelta[2, i_] KroneckerDelta[2, k_] +
KroneckerDelta[3, i_] KroneckerDelta[3,
k_] -> Subscript[δ, i, k]
Sum[Subscript[δ, i, j]*Subscript[δ, j, k], {j, 1,3}] /. ruleDelta