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?

  • $\begingroup$ Why should it simplify to your from? Put $i=k=4$. $\endgroup$
    – Andrew
    Commented Jan 12, 2019 at 12:24
  • $\begingroup$ 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. $\endgroup$ Commented Jan 12, 2019 at 12:40
  • $\begingroup$ Sum[KroneckerDelta[i, j] KroneckerDelta[j, k], j] // Simplify; does not provide the desired result. $\endgroup$ Commented Jan 12, 2019 at 12:41
  • $\begingroup$ 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] $\endgroup$
    – jose
    Commented Jan 16, 2019 at 1:52
  • $\begingroup$ This is relevant mathematica.stackexchange.com/questions/202373/… $\endgroup$
    – yarchik
    Commented Feb 27, 2020 at 12:14

4 Answers 4


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]
  • $\begingroup$ Thanks a lot!. Do you know packages for Wolfram that do the simplifications of kronecker delta expression faster than DiscreteDelta? $\endgroup$ Commented Jan 13, 2019 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}$

  • $\begingroup$ Thanks a lot!. Do you know packages for Wolfram that do the simplifications of kronecker delta expressions? $\endgroup$ Commented Jan 14, 2019 at 10:23
  • $\begingroup$ @IlyaBryukhanov no. $\endgroup$
    – Andrew
    Commented Jan 14, 2019 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.