# Compare algebraic equivalence (regardless of term order) without having to simplify? [closed]

I know that in order to find the equivalence of say $$a+b$$ and $$b+a$$, then:

FullSimplify[a + b == b + a]


is sufficient. However, suppose I want to compare without simplifying, and simply determine the equivalence of two algebraic statements regardless of the ordering of terms? For example, $$a+b = b+a$$, but $$\frac{(a+b)^2}{a+b} \neq a+b$$.

Edit:

I want Mathematica to tell me commutative equivalence ONLY between two expressions. Consider another example:

$$s_1 = 3 - \sqrt{2}$$ $$s_2 = - \sqrt{2} + 3$$ $$s_3 = 3 - \sqrt{\sqrt{2}}^2$$

I want some function or procedure to tell me that $$s_1 = s_2$$ but $$s_1 \neq s_3$$.

## closed as unclear what you're asking by Daniel Lichtblau, m_goldberg, Henrik Schumacher, Michael E2, José Antonio Díaz NavasJan 8 at 21:57

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• I don't know what you mean. a + b == b + a evaluates to True because Plus has Attribute Orderless. – Henrik Schumacher Jan 5 at 9:43
• In addition to what Henrik said: (a+b)^2/(a+b) also automatically evaluates to a+b, so it's not really possible to do what you are asking for. One trick to work around it is Reduce[{x/(a + b) == a + b, x == (a + b)^2}] or Reduce[{x/(a + b) == a + b, x == (a + b)^2}, x]. Reduce will try to generate complete conditions. In this case it will say that this is true only if a+b != 0. – Szabolcs Jan 5 at 10:36
• In order to asnwer this question, you have to tell us exactly what yuo mean by "algebraic expression" and your exactt definition of "equivalence". – Somos Jan 5 at 15:15
• I have added further details to (hopefully) better explain my question – akkp Jan 5 at 21:42
• Re your second, the simplification of the LHS is automatic -- Related: mathematica.stackexchange.com/questions/57489/… – Michael E2 Jan 6 at 2:49

s1 = Hold[3 - Sqrt]; s2 = Hold[-Sqrt + 3]; s3 = Hold[3 - Sqrt[Sqrt^2]];

returns {True, False}. You need the Hold[] because Plus[] is Orderless.