Is there a way to force mma expressions that have symbolic terms like


to simplify to KroneckerDelta[i,k]?

Note that i,j are symbolic. Additionally I would like to be able also have the symmetry in the indices as a property, i.e.

KroneckerDelta[i,j]*KroneckerDelta[j,k] == 
  KroneckerDelta[i,j]*KroneckerDelta[k,j] ==

(or any other permutation of indices).

  • 2
    $\begingroup$ How is the transformation you're asking for simplifying anything? For $i=j\neq k$, $0=\delta_{ij}\delta_{jk}\neq\delta_{ij}=1$. Also, the second property looks more like a symmetry than associativity. Do you have any constraints on $i,j,k$ that you did not mention which would make these transformations valid? $\endgroup$
    – Lukas Lang
    Commented Mar 8, 2019 at 11:36
  • $\begingroup$ It does because it eliminates the k index that it is repeated and I end up with one delta function. I don't care in setting the last delta to a number. No, no constraints. $\endgroup$
    – hal
    Commented Mar 8, 2019 at 12:58
  • 1
    $\begingroup$ I've edited the question to fix typos ($\delta_{i,k}$ instead of $\delta_{i,j}$) and mistakes in the terminology (symmetry instead of associativity) - feel free to revert if I misunderstood you, but since you accepted Brad's answer, it should be what you meant $\endgroup$
    – Lukas Lang
    Commented Mar 8, 2019 at 18:30

1 Answer 1


I agree with Lukas in the sense that this really doesn't do much for simplification. But if you're really keen, then you can do this using pattern matching. You can define the set of replacement rules with all of your relevant permutations as (written for readability):


Then it is a simple check to try:

(*KroneckerDelta[i, k]*)

Is this what you wanted?

  • 1
    $\begingroup$ Note that a single one of those rules is already enough, since both Times and KroneckerDelta have the Orderless attribute $\endgroup$
    – Lukas Lang
    Commented Mar 8, 2019 at 18:23
  • $\begingroup$ I thought it seemed a bit like overkill, but I figured OP had used a case where he required some special considerations. Thank you for your comments and for tidying up his original post, albeit still unclear what the general purpose is used for. $\endgroup$
    – Brad
    Commented Mar 8, 2019 at 18:39

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.