What equations can it solve?

  • One equation in one variable that is linear, quadratic or cubic once both sides are multiplied out, like 2x + 4 = 10, 2x^2 - 3x - 2 = 0 or x^3 - 6x^2 + 11x - 6 = 0. Brackets and products such as (x - 1)(x + 2) = 4 are multiplied out for you.
  • A system of 2 or 3 linear equations in as many variables, like 2x + 3y = 12 and x - y = 1.

The variable may also sit in a denominator, as in 1/x = 2. The solver then leaves out any value that would divide by zero, so (x^2 - 1)/(x - 1) = 0 has the single solution x = -1.

Writing equations

  • Write powers with ^, as in x^2. A number right before a variable multiplies it, so 2x is 2 times x; * works too.
  • Use brackets, decimals with a point and fractions with /. The constants pi and e are known.
  • Any single letter can be the variable: 3t + 2 = 11 is solved for t.
  • An expression without an equals sign is set equal to 0, so x^2 - 9 solves x^2 - 9 = 0.
  • In a system, write each equation on its own line, or separate them with semicolons. The terms can be on either side of the equals sign, in any order.

Reading the results

  • Roots are named x₁, x₂ and x₃, real roots first from smallest to largest, then complex ones.
  • A quadratic or cubic can have complex roots, written as a + bi, where i is the square root of -1. They come in pairs like -1 - 2i and -1 + 2i.
  • A root that counts twice, like the root of x^2 - 2x + 1 = 0, shows once as x₁ = x₂.
  • Results are rounded to 12 significant digits, which hides the tiny rounding errors of computer arithmetic, and each has a copy button.
  • When the variable cancels out, the solver tells you whether every value solves the equation (x + 1 = x + 1) or none does (x + 1 = x).
  • A system gets the value of each variable in alphabetical order. When its equations contradict each other or say the same thing twice, it has no single solution, and the solver says so.

How it works

The solver uses the math.js library. For one equation it subtracts the right side from the left, multiplies the result out into a polynomial and finds its roots with the closed formulas for linear, quadratic and cubic equations. For a system it reads the number in front of each variable in every equation and solves the equations together by LU decomposition.

Examples

  • 2x + 4 = 10: x = 3
  • 2x^2 - 3x - 2 = 0: x₁ = -0.5, x₂ = 2
  • x^2 - 2x + 1 = 0: x₁ = x₂ = 1
  • x^2 + 2x + 5 = 0: x₁ = -1 - 2i, x₂ = -1 + 2i
  • x^3 = 8: x₁ = 2, and the complex roots -1 - 1.73205080757i and -1 + 1.73205080757i
  • 2x + 3y = 12 and x - y = 1: x = 3, y = 2
  • x + y + z = 6, 2y + 5z = -4 and 2x + 5y - z = 27: x = 5, y = 3, z = -2

Features

  • Linear, quadratic and cubic equations
  • Real and complex roots, with double and triple roots marked
  • Systems of 2 or 3 linear equations
  • Any letter as the variable, brackets and fractions
  • Copy any result
  • Runs in your browser