# How to tell Mathematica a function is invariant under argument permutation

I want Mathematica to simplify my expression using MySymmetricFunction[x,y] = MySymmetricFunction[y,x], so that

expr = MySymmetricFunction[x,y]-MySymmetricFunction[y,x];
Simplify[expr]


yields 0.

I tried

MySymmetricFunction[x_, y_] = MySymmetricFunction[y,x]


but here Mathematica assumes recursion.

Please note, that I don't want to implement an explicit version of MySymmetricFunction[x,y] as of yet.

edit:
Why does this give zero

SetAttributes[MySymmetricFunction, Orderless]
MySymmetricFunction[x,y]-MySymmetricFunction[y,x]


But this does not:

<<FeynCalc
SetAttributes[MySymmetricFunction, Orderless]
Simplify[MySymmetricFunction[pResonance, pRho]*FV[NucleonOut, m] - MySymmetricFunction[pRho, pResonance]*FV[pNucleonOut, m]]


edit2 Thanks to @QuantomDot for pointing out my silly spelling mistake.

• Could you give MySymmetricFunction the Orderless attribute? Mar 23, 2018 at 0:17
• Set[MySymmetricFunction, Orderless] is a complete solution. Mar 23, 2018 at 0:18
• @evanb you mean SetAttributes. Mar 23, 2018 at 0:20
• Orderless has interesting effects on pattern matching. Mar 23, 2018 at 0:21
• NucleonOut is not the same as pNucleonOut. Mar 23, 2018 at 0:33

SetAttributes[msf, Orderless]
`