# What is the proper way to verify that two expressions are equivalent?

First of all, it appears to me that

$$\left|\frac{1}{x} + x^2\right| = \frac{|1 + x^3|}{|x|}$$

is true.

I don't know why, but my attempt to verify it in Mathematica failed.

In:= Abs[1/x + x^2] === Abs[1 + x^3]/Abs[x]
Out= False


It's weird because Mathematica is unable to find a counterexample.

In:= FindInstance[Abs[1/x + x^2] != Abs[1 + x^3]/Abs[x], x, Complexes]
Out= {}


You are using SameQ which does a direct structural comparison rather than a mathematical one. Since the expressions are not exactly the same it returns False. Try Equal:

FullSimplify[Abs[1/x + x^2] == Abs[1 + x^3]/Abs[x]]

True


FullSimplify is needed for nontrivial comparisons; without it Mathematica will return the equality as given if it is not trivially equivalent.

You can also use ForAll and Resolve which I think is sometimes faster (no example at hand):

ForAll[x, x != 0, Abs[1/x + x^2] == Abs[1 + x^3]/Abs[x]] // Resolve

True

• Sorry, but no ForAll[x, Abs[1/x + x^2] == Abs[1 + x^3]/Abs[x]] // Resolve send False – mlpo Dec 15 '13 at 1:40
• @mlpo Strange, it returns True in version 7. What version are you using? – Mr.Wizard Dec 15 '13 at 1:43
• @Mr.Wizard Windows 8 Mathematica 9.01 False – Alex Dec 15 '13 at 1:46
• @mlpo Okay, I think I have an explanation for that behavior. If x is zero we have an indeterminate expression; I think later versions may recognize this while v7 does not? In that sense your equivalence is actually false, yet that is not the result you wanted. – Mr.Wizard Dec 15 '13 at 1:46
• 9.0.1, but I found the problem, when x = 0. Try with ForAll[x, x != 0, Abs[1/x + x^2] == Abs[1 + x^3]/Abs[x]] // Resolve – mlpo Dec 15 '13 at 1:47