# A puzzling result of “FullSimplify”

When I input:

FullSimplify[(1 - a^2)/b^2, a^2 + b^2 == 1]


the result is the ideal answer 1；

However，if I input:

FullSimplify[(1 - b^2)/a^2, a^2 + b^2 == 1]


the result is (1 - b^2)/a^2， instead of the ideal answer 1. How to get the correct answer 1?

• Since you are using an equality, how about using ReplaceAll; FullSimplify[((1 - a^2)/b^2) /. a -> Sqrt[1 - b^2]] ? – Sumit Nov 7 '16 at 12:57
• It seems like that we should need manual deduction to get the specific variable expressions in advance... – dabuyang Nov 7 '16 at 14:41
• Somewhat related (notice those links in the comments): mathematica.stackexchange.com/q/25182/1871 – xzczd Nov 8 '16 at 8:22
• In the Possible Issues item of the Documentation for FullSimplify, it is explicitly stated that Results of simplification may depend on the names of symbols. – Αλέξανδρος Ζεγγ Nov 11 '16 at 2:41
• @AlexanderZeng Side note: this "possible issue" seems to be added recently, it's not included in the document of v9.0.1…… – xzczd Dec 3 '16 at 7:45

## 1 Answer

Simplify[(1 - a^2)/b^2, a^2 + b^2 == 1]

(*  1  *)

Simplify[(1 - b^2)/a^2, a^2 + b^2 == 1]

(*  (1 - b^2)/a^2  *)


The result returned from some of Mathematica's internal algorithm's can sometimes be affected by the canonical order of the variables involved. Your problem is an example.

To reverse the canonical order

switchOrder = {a -> d, b -> c};

soln = Simplify @@ ({(1 - b^2)/a^2, a^2 + b^2 == 1} /. switchOrder)

(*  1  *)


Although in this case it is not necessary to return to the original variables, this would generally be required. To return to the original variables

soln /. (Reverse /@ switchOrder)

(*  1  *)


EDIT: See here for another example

• Is there any experience about when the canonical order seems to be important? Of course, in this case it is easy to spot, but it seems that one would "always" need to switch orders and compare results of Simplify if it doesn't return what one wants...? – Lukas Nov 8 '16 at 7:59
• @Lukas - undoubtedly, this is not done automatically since there would be a performance cost and would generally not help or not change the form of the result enough to be worth the cost--likewise for manual application. Consequently, it should only be investigated if there is reason to believe that a more preferred form should exist or one is building a component that needs to be highly optimized & it is worth the effort to ensure that you have discovered the highest performance form. Note that the problem compounds with the number of variables--we were only dealing with two variables here. – Bob Hanlon Nov 8 '16 at 15:06