Equation Solver
Solve equations in one unknown with exact answers, numerical approximations, and step-by-step explanations.
Equation
The interval is used for trigonometric equations, to list the solutions that lie in it, and for equations that can only be solved numerically, to say where to search. It may be written with pi, as in -2*pi. Angles are in radians.
Keypad
Solution
Enter an equation and choose Solve Equation, or press Enter.
Verify solutions
Show solution steps
Help
The solver works over the real numbers, with exact arithmetic wherever it can, and says how far each answer can be trusted.
Entering an equation
- Type the two sides with one equals sign between them:
x^2 - 5*x + 6 = 0. Use+ - * /,^for powers and parentheses. The multiplication sign may be left out where the meaning is plain:2x,3(x+1),(x+1)(x-2). - Functions need parentheses:
sqrt(x),abs(x)or|x|,exp(x)ore^x,ln(x)(natural logarithm),log(x)(base 10),sin(x),cos(x),tan(x), in radians. The constants arepiande. - Numbers are read exactly:
0.125is 1/8. Scientific notation takes a capital E,1.5E-3, because a smalleis always the constant:2e-3means 2e − 3. - Implicit multiplication has the same precedence as
*and/, so1/2xis (1/2)x; write1/(2x)for the other meaning. The line Reads as under the box always shows how the equation was understood, before anything is solved. - The unknown is one letter, x unless you choose another. Enter solves. An equation with two different letters is refused, and so is anything the solver cannot read; nothing typed is ever run as code.
What can be solved exactly
- Linear and quadratic equations, with fractions as coefficients. A quadratic is solved from its discriminant, and square roots are simplified: x² − 2 = 0 gives x = ±√2.
- Polynomial equations up to degree 40. Rational roots are found with the Rational Root Theorem and divided out; a quadratic that is left is solved by the formula, and so is a factor of the form xᵏ = c. Any other factor has its real roots counted exactly and then located as decimals.
- Rational equations (quotients of polynomials), with the values that make a denominator zero excluded.
- One square root or one absolute value with the rest polynomial, such as √(x+1) = x − 1 or |2x − 1| = x + 4.
- Equations that undo one operation at a time: 2e^(3x) + 1 = 7, ln(x² − 3) = 0, 2ˣ = 8; and equations in one repeated expression, such as e^(2x) − 3eˣ + 2 = 0.
- sin, cos and tan of a linear expression, such as cos(2x + 1) = 1/2: the general solution, and its members in the interval.
Everything else, for example cos x = x, two square roots, or a sum of logarithms, is solved numerically on the interval. The solver is not a general computer algebra system, and says so rather than guess.
Exact answers and approximations
An exact answer is written with =: a fraction, a root, a logarithm, a multiple of π. A decimal that had to be rounded is written with ≈ and is never presented as exact. Precision sets the number of significant digits of the decimals only; it never changes an exact answer.
Decimals of fractions, square roots and other roots of polynomials are expanded with whole-number arithmetic, to as many as 16 digits. Values that pass through ln, eˣ or the trigonometric functions come from ordinary double-precision arithmetic and are shown to at most 15.
The solution domain, and excluded values
Solutions are looked for among the real numbers. So x² + 1 = 0 has no real solutions, although it has two complex ones; that is different from 2x + 1 = 2x + 3, which nothing solves at all.
An equation only makes sense where both sides are defined. A denominator cannot be zero, because division by zero has no value; a square root needs a number that is not negative; a logarithm needs a positive number. The values ruled out are listed as domain restrictions. They stay ruled out even when a factor cancels:
In the same way x/x = 1 holds for every real number except 0.
Extraneous roots
Some steps are not reversible. Squaring both sides is the usual one: a = b implies a² = b², but a² = b² also holds when a = −b. So the squared equation can have solutions that the original does not: extraneous roots.
For √(x+1) = x − 1, squaring gives x² − 3x = 0, with roots 0 and 3. A square root is never negative, so the right-hand side must not be either: at x = 0 it is −1, and 0 is rejected; at x = 3 it is 2, and 3 is the solution. Rejected candidates are listed with the result, and Verify solutions substitutes every answer into the equation as it was entered.
Repeated roots
A root can count more than once: (x − 1)²(x + 2) = 0 has the roots 1 and −2, and 1 has multiplicity 2 because its factor appears twice. The solver lists each solution once, gives the number of distinct solutions, and marks the multiplicity of a repeated root of a polynomial or rational equation.
The interval and numerical solving
Most equations with sin, eˣ or ln mixed with powers of x have no solution that can be written with a formula, so decimals are the best there is. The solver then examines f(x) = left − right on the interval from Minimum to Maximum: it evaluates f at 4001 evenly spaced points, and wherever the sign changes it closes in on the root with Brent’s method, which never leaves the enclosing interval. A candidate is kept only if it lies in the domain and the two sides agree there to about nine digits; this is what removes the jumps of tan and the like.
Two limits are worth knowing. Roots closer together than one four-thousandth of the interval can be missed, so a narrower interval looks more closely. And a root where the two sides touch without crossing, like (x − 1)² = 0 would be, is recognised only to about half the digits.
For a trigonometric equation that is solved exactly, the interval only selects which of the infinitely many solutions are listed; the general solution is given as well.
When are all solutions found?
Every result says which of these holds:
- All real solutions were found. This is said for the equations solved exactly. For polynomials it rests on a Sturm sequence, which counts the real roots with exact arithmetic, so even roots given as decimals are known to be all there are.
- The general solution describes every solution, for trigonometric equations, with the list complete inside the interval.
- Numerical solutions found in the interval. Other solutions may exist, in the interval or outside it.
- No solution found in the interval. This is not a proof that there is none.