Seemingly an easy question, but I'm trying to avoid using a straight replacement rule.

As an example, I could take a term like


where this dot product is symmetric, and so should evaluate to zero.

I'm trying to avoid using a replacement rule, since I'm trying to generalise. I have tried using Signature and Sort to try and automatically swap the latter term by canonical sorting, but to no avail.

Any suggestions would be welcome!

EDIT: I think I will extend my question to get the exact answer I am searching for. I'm using a recursion relation to generate a load of terms, which involve these dot products.

I am looking to basically express any dot product which is has a signature of -1 from canonical order as the reversed order, to lead to some nice cancellations:

For any choice of i,j, I'm looking to get something like:

If[Signature[p[i_].p[j_]]==-1, Return[p[j].p[i]]]

Can this be easily achieved?

EDIT2: I think the answer lies in ConditionalReplace. Let me try muddling.


2 Answers 2


You could use TensorReduce:

    p[i].p[j] - p[j].p[i],
    Assumptions -> (p[i] | p[j]) ∈ Vectors[d]


  • $\begingroup$ I like the look of that. Could you explain why it works? Could I not assume vectors in the original dot product somehow? $\endgroup$
    – Brad
    Commented Nov 28, 2018 at 18:01

I guess I threw a few people off by saying that I didn't want a replacement rule, but what I was really trying to avoid was a simplistic version, i.e

//.{p[b_].p[a_]:> p[a].[b]}

I managed to avert this by using a conditional rule, so that it only replaces the terms which are out of canonical order. I am satisfied with:


somewhere in a replacement rule sequence. Thank you to Carl for his suggestion; it put me on the right track of assumptions!


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.