PossibleZeroQ[expr]
gives True if basic symbolic and numerical methods suggest that expr has value zero, and gives False otherwise.
PossibleZeroQ
PossibleZeroQ[expr]
gives True if basic symbolic and numerical methods suggest that expr has value zero, and gives False otherwise.
Details and Options
- The general problem of determining whether an expression has value zero is undecidable; PossibleZeroQ provides a quick but not always accurate test.
- With the setting Method->"ExactAlgebraics", PossibleZeroQ will use exact guaranteed methods in the case of explicit algebraic numbers.
- PossibleZeroQ takes the following options:
-
Assumptions $Assumptions assumptions on parameters Method Automatic method to use
Examples
open all close allBasic Examples (1)
Scope (4)
Show that a numeric expression is zero:
PossibleZeroQ[(E + Pi) ^ 2 - E ^ 2 - Pi ^ 2 - 2 E Pi]Show that a numeric expression is nonzero:
PossibleZeroQ[E ^ Pi - Pi ^ E]Decide that a numeric expression is zero based on approximate computations:
PossibleZeroQ[2 ^ (2 I) - 2 ^ (-2I) - 2I Sin[Log[4]]]Test whether symbolic expressions are likely to be identically zero:
PossibleZeroQ[1 / x + 1 / y - (x + y) / (x y)]PossibleZeroQ[Sqrt[x ^ 2] - x]Options (2)
Assumptions (1)
For arbitrary complex x, f is not identically zero:
f = Sqrt[x ^ 2] - x;PossibleZeroQ[f]When Re[x]>0, f is identically zero:
PossibleZeroQ[f, Assumptions -> Re[x] > 0]Method (1)
By default, numeric approximations may be used to decide that an algebraic number is zero:
zero = Sqrt[2] + Sqrt[3] - RootReduce[Sqrt[2] + Sqrt[3]]PossibleZeroQ[zero]Approximate methods may give incorrect positive answers:
PossibleZeroQ[zero + 10 ^ -20000]
With Method->"ExactAlgebraics" exact methods are used for explicit algebraic numbers:
PossibleZeroQ[zero, Method -> "ExactAlgebraics"]For explicit algebraic numbers the answer is provably correct:
PossibleZeroQ[zero + 10 ^ -10000, Method -> "ExactAlgebraics"]Applications (1)
Solving polynomial equations requires deciding whether coefficients are zero:
QuadraticRoots[eq_, x_] :=
Module[{a, b, c, Δ},
{c, b, a} = CoefficientList[Subtract@@eq, x];
If[!PossibleZeroQ[a],
Δ = b ^ 2 - 4a c;
x == (-b - Sqrt[Δ]) / (2a) || x == (-b + Sqrt[Δ]) / (2a),
If[!PossibleZeroQ[b], x == -c / b, PossibleZeroQ[c]]]]QuadraticRoots[2Log[2]x ^ 2 - Log[4]x ^ 2 + x - 1 == 0, x]Wolfram Language equation solvers use zero testing automatically:
Reduce[2Log[2]x ^ 2 - Log[4]x ^ 2 + x - 1 == 0, x]Properties & Relations (1)
SameQ[e,0] returns True only if e is explicitly identical to zero:
e = (E + Pi) ^ 2 - E ^ 2 - Pi ^ 2 - 2 E Pi;e === 0Equal[e,0] uses simple tests to decide whether e is zero:
e == 0When Equal cannot decide whether an expression is zero it returns unchanged:
ee = Erf[Log[4] + 2Log[Sin[Pi / 8]]] - Erf[Log[2 - Sqrt[2]]];ee == 0PossibleZeroQ uses numeric methods to test whether ee is zero:
PossibleZeroQ[ee]FullSimplify proves symbolically that ee is zero:
FullSimplify[ee]Possible Issues (1)
PossibleZeroQ may return True for nonzero numeric expressions that are close to zero:
e = Pi - RootApproximant[N[Pi, 10000], 20]PossibleZeroQ[e]N[N[e, 20000], 20]//QuietRelated Guides
History
Text
Wolfram Research (2007), PossibleZeroQ, Wolfram Language function, https://reference.wolfram.com/language/ref/PossibleZeroQ.html.
CMS
Wolfram Language. 2007. "PossibleZeroQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/PossibleZeroQ.html.
APA
Wolfram Language. (2007). PossibleZeroQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PossibleZeroQ.html
BibTeX
@misc{reference.wolfram_2026_possiblezeroq, author="Wolfram Research", title="{PossibleZeroQ}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/PossibleZeroQ.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_possiblezeroq, organization={Wolfram Research}, title={PossibleZeroQ}, year={2007}, url={https://reference.wolfram.com/language/ref/PossibleZeroQ.html}, note=[Accessed: 13-June-2026]}