# Kronecker Delta manipulation

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

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


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] ==
KroneckerDelta[i,k]


(or any other permutation of indices).

• 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? – Lukas Lang Mar 8 '19 at 11:36
• 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. – hal Mar 8 '19 at 12:58
• 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 – Lukas Lang Mar 8 '19 at 18:30

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):

SimplifyKronecker={
KroneckerDelta[i_,Match_]KroneckerDelta[Match_,j_]:>KroneckerDelta[i,j],
KroneckerDelta[i_,Match_]KroneckerDelta[j_,Match_]:>KroneckerDelta[i,j],
KroneckerDelta[Match_,i_]KroneckerDelta[Match_,j_]:>KroneckerDelta[i,j],
KroneckerDelta[Match_,i_]KroneckerDelta[j_,Match_]:>KroneckerDelta[i,j]
}


Then it is a simple check to try:

KroneckerDelta[i,j]KroneckerDelta[j,k]/.SimplifyKronecker
(*KroneckerDelta[i, k]*)


Is this what you wanted?

• Note that a single one of those rules is already enough, since both Times and KroneckerDelta have the Orderless attribute – Lukas Lang Mar 8 '19 at 18:23
• 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. – Brad Mar 8 '19 at 18:39