How do you solve an equation?
Type an equation such as x^2 - 3x - 5 = 0. The page lists every real solution, exactly where it can (with fractions and square roots), and as a checked decimal otherwise.
- Solutions
- x = 3/2 - sqrt(29)/2, x = sqrt(29)/2 + 3/2
Solving x^2 - 3x - 5 = 0 gives x = 3/2 - sqrt(29)/2, x = sqrt(29)/2 + 3/2.
- As decimals
- x ≈ -1.192582404, x ≈ 4.192582404
- Number of real solutions
- 2
Solutions: x = 3/2 - sqrt(29)/2, x = sqrt(29)/2 + 3/2. Solving x^2 - 3x - 5 = 0 gives x = 3/2 - sqrt(29)/2, x = sqrt(29)/2 + 3/2.
How to calculate
Lists every real solution of an equation, exact where possible, each checked.
Example with the default inputs (Equation x^2 - 3x - 5 = 0): Solving x^2 - 3x - 5 = 0 gives x = 3/2 - sqrt(29)/2, x = sqrt(29)/2 + 3/2.
Method: A computer algebra system; each root is checked, and a numeric scan finds any missed.
- Only real solutions; no answer for sin, cos or tan of the variable.
Worked examples
Each example is checked against the calculator on every build.
- Equation x^2 - 3x - 5 = 0 gives Solutions x = 3/2 - sqrt(29)/2, x = sqrt(29)/2 + 3/2, As decimals x ≈ -1.192582404, x ≈ 4.192582404, Number of real solutions 2.Source: OpenStax College Algebra 2e, 2.5, Ex. 8. https://openstax.org/books/college-algebra-2e/pages/2-5-quadratic-equations
- Equation 4x^2 + 15x + 9 = 0 gives Solutions x = -3, x = -3/4, Number of real solutions 2.
How it works
The equation solver finds every real number that makes the two sides of your equation equal. It works in three steps, and shows an answer only when all three agree.
- Algebra. Everything is moved to one side, left − right = 0, and every fraction with the letter in its denominator is multiplied out, so the algebra sees one expression with no such fractions. A computer algebra system (nerdamer, open source) solves that. The algebra runs after you start typing, in the background. If it finds no formula (eˣ = x + 3), the page goes on with the scan alone; if a root it gives fails its own check, the page says "No verified answer".
- Check each root in the equation as typed. A root from the algebra counts only if both sides are real numbers there and either differ by exactly 0 (for an exact root) or change sign across it: left − right has opposite signs at r − h and r + h, with h = 10⁻⁷ × max(1, |r|), and differs by at most 10⁻⁸ × max(1, s) at r, where s is the sum of the sizes of the terms of left − right. A root where a side is not a real number (a denominator of 0, the square root or logarithm of a negative number) is excluded. A root that fails the check is dropped: x = 0 for x² = 2 × 10⁻²⁰ (left − right is −2 × 10⁻²⁰ there, and positive on both sides), and the rounded roots next to 0 for eˣ = x + 1.
- Scan for solutions the algebra missed. The page evaluates left − right at every 0.005 from −10 to 10, then at 120 points per power of ten out to −10¹² and 10¹², and, next to any place where the sides stop being real numbers, at points halving the distance to that edge down to the last digit a computer number holds.
- A sign change is narrowed down by halving 1,100 times; if both sides agree there, that is a solution.
- A point where left − right is exactly 0, next to a nonzero value, is a solution (√(x − 1/3) = 0 at x = 1/3, the edge of its domain).
- Where |left − right| has a local minimum without a sign change (its two neighbouring values both above 10⁻¹⁰⁰ in size, so a function that only fades towards 0, such as e^(2x) far to the left, does not count), the page searches for the lowest point. If left − right crosses 0 there by more than 10⁻¹² × s, there are two solutions, found by halving on each side (x² = 2 × 10⁻²⁰ gives ±1.414213562 × 10⁻¹⁰). If it only reaches within 10⁻¹² × max(1, s) of 0 and the algebra gave no solution there, the page cannot tell a double root from a near miss and says "No verified answer".
- If left − right is 0 to within 10⁻¹⁴ × s at two scan points in a row, the solutions fill an interval (|x| = x for every x ≥ 0), or the equation is an identity (x + 1 = x + 1); the page says "The solutions fill an interval." and lists none.
- If left − right is infinite just past the edge of the domain with the other sign from its value at the edge, a solution lies closer to that edge than a computer number can hold (ln(x) = −1000 at x = e^(−1000)); the page says "No verified answer: a possible solution could not be confirmed."
- A solution the scan finds and the algebra did not give is added as a decimal. A scan solution counts as one the algebra gave when an algebra root lies in the interval where the scan found it.
- One entry per solution. A decimal root (a rounded root from the algebra, or a root from the scan) gives way to an exact root within 10⁻⁷ × max(1, |x|) of it: e^(2x) − 3eˣ + 2 = 0 gives x = 0 and x ≈ 0.6931471806, not the rounded 1.19 × 10⁻¹⁷ the algebra also returns. Two roots within 10⁻¹² × max(1, |x|) of each other count as one. A rounded root from the algebra that passes step 2 is written from its own value: x = 1.0000000005 gives x ≈ 1.000000001.
The same solve model runs the algebra calculator and the solve for x calculator.
What you can type
- An equation with one = sign, such as 2x + 7 = 19. With no = sign, the page solves expression = 0.
- One variable. Use one lowercase letter as the unknown: x, t, y, and so on. The page solves for whichever letter you use. Two different letters (such as x and y) give no answer. The letter e is Euler’s number, and pi (or π) is π.
- Numbers can have decimals (2.5) and powers of ten (1e-3).
- Operations: + − * / and ^ for powers. Brackets group. A number or bracket next to a letter multiplies: 2x, 3(x + 1).
- Functions: sqrt, cbrt, ln (and log, the same natural logarithm), log10, exp, abs (or |x|), the inverse trig functions asin, acos, atan (arcsin, arccos, arctan also work), sinh, cosh and tanh.
- Not allowed: sin, cos, tan, sec, csc or cot of the unknown. Such equations usually have infinitely many solutions, so the page gives no answer. The same functions of a number, such as sin(1), are fine.
- Only real numbers count. A fractional power with an odd denominator is the real root: x^(1/3) at x = −8 is −2.
How answers are written
- Solutions lists each different real solution once (a double root once), in increasing order, separated by commas:
x = -3, x = -3/4. The letter is the one you used. - A solution the algebra gives exactly is written with =, in the syntax you type: fractions a/b, sqrt(u), powers with ^, with the terms of each solution in the order the algebra gives them:
x = 3/2 - sqrt(29)/2,x = sqrt(29)/2 + 3/2. - A solution with no exact form found is written with ≈ and 10 significant figures:
x ≈ 1.167303978. The page also uses the decimal when the algebra returns a rounded number (a fraction whose denominator, after removing factors 2 and 5, is over 1,000,000, or whose numerator times that denominator is over 10¹²), because such a fraction is not exact. - As decimals repeats every solution with ≈ and 10 significant figures. It appears when at least one exact solution is not a plain whole or decimal number.
- Number of real solutions counts the different real solutions.
- When there is none, Solutions reads no real solution and the count is 0: x + 1 = x + 2 and x² + x + 2 = 0 have none.
What gets no answer
- Equations with sin, cos, tan, sec, csc or cot of the unknown.
- An equation whose solutions fill an interval, or an identity.
- An equation that takes over 3 seconds.
- A root from the algebra that the check rejects is dropped, not shown. A possible solution that the scan finds but cannot confirm (a dip of left − right towards 0 with no sign change, where the algebra gave nothing), or one too close to the edge of the domain to compute, gives "No verified answer".
- Solutions beyond −10¹² or 10¹² are listed only when the algebra finds them.
Assumptions
- Only real solutions; complex solutions are left out.
- Angles are in radians and log is the natural logarithm.
Worked examples by hand
x² − 3x − 5 = 0 (OpenStax College Algebra 2e, section 2.5, Example 8). This does not factor over whole numbers, so use the quadratic formula with a = 1, b = −3, c = −5: x = (3 ± √(9 + 20))/2 = (3 ± √29)/2. So x = 3/2 − √29/2 ≈ −1.192582404 and x = 3/2 + √29/2 ≈ 4.192582404. Check: the two roots add to 3 = −b/a and multiply to (9 − 29)/4 = −5 = c/a.
4x² + 15x + 9 = 0 (OpenStax College Algebra 2e, section 2.5, Example 4). Factor: 4x² + 15x + 9 = (4x + 3)(x + 3). A product is 0 only when a factor is 0, so x = −3 or x = −3/4.
x² + x + 2 = 0 (OpenStax College Algebra 2e, section 2.5, Example 10). The discriminant is 1² − 4 × 1 × 2 = −7, which is negative, so the solutions (−1 ± i√7)/2 are complex. There is no real solution.
Other questions people ask
What kinds of equations can it solve?
Equations in one letter: linear (2x + 7 = 19), quadratic (x² − 3x − 5 = 0), higher-degree polynomials (x³ − 6x² + 11x − 6 = 0), rational equations with the letter in a denominator (3/(x − 6) = 5/x), equations with square roots (√(x + 1) = x − 1), absolute values (|2x − 3| = 5), exponentials (3^(x + 1) = 27) and logarithms (ln(x) + ln(x − 2) = ln(3)). Equations with sin, cos or tan of the letter get no answer, because they usually have infinitely many solutions.
Why is a solution shown with ≈?
Some equations have solutions with no exact formula the algebra can find, such as x⁵ − x − 1 = 0, or a formula it does not find, such as the three solutions of x³ − 3x + 1 = 0. Such a solution is shown as a decimal to 10 significant figures with ≈ in front. It was still checked: both sides of the equation agree there, and the two sides change sign across it.
What does "no real solution" mean?
No real number makes the two sides equal. x² + x + 2 = 0 has only complex solutions, (−1 ± i√7)/2, because its discriminant 1 − 8 is negative. This page lists real solutions only. For complex roots of a quadratic, use the quadratic formula calculator.
Why is a value I found by hand not listed?
It may make a denominator 0 or put a negative number under a square root or a logarithm. Multiplying out fractions or squaring both sides can create such false solutions. In x/(x − 3) = 5/(x − 3) − 1/2, the value 3 makes both denominators 0, so it is excluded; the only solution is 13/3.
How do I type the equation?
Use one = sign between the two sides, ^ for powers, and brackets where they help: 4(x − 3) + 12 = 15 − 5(x + 6). A number next to a letter multiplies (2x). If you leave out the = sign, the page solves expression = 0. You may use any one lowercase letter as the unknown, such as t or y; e is Euler’s number.
What does "No verified answer" mean?
Every solution is checked before it is shown. If a solution the algebra gives does not satisfy the equation, if the scan for missed solutions finds a place it cannot confirm, or if the work takes over 3 seconds, the page says "No verified answer" instead of showing a list it could not check.