Equation Solver

A free equation solver: enter the coefficients to get the roots of a quadratic or cubic equation, or the solution of a system of linear equations.

Equation type

Quadratic ax² + bx + c = 0

x² +x += 0

Equation

x² − 5x + 6 = 0

Solution

x₁ = 2x₂ = 3

Two distinct real roots

  • Discriminant D = b² − 4ac = 1
  • Vertex (2.5, −0.25)

How to use

  • Choose Quadratic, Cubic, System (x, y) or System (x, y, z) at the top.
  • Rearrange the equation so that the right-hand side is 0, then enter the coefficients in order. For x² − 5x + 6 = 0, enter a = 1, b = −5 and c = 6.
  • For a system, enter the coefficients of x, y (and z) and the constant on the right-hand side of each equation. For 2x + y = 5, enter 2, 1 and 5.
  • The solution updates as you type, and the equation is rewritten from your coefficients so you can spot a typo straight away.
  • Quadratics also show the type of roots, the discriminant and the vertex; cubics show the type of roots and the discriminant.

The quadratic formula and the discriminant

The roots of ax² + bx + c = 0 (with a ≠ 0) come from the quadratic formula x = (−b ± √D) / 2a. The number under the square root, D = b² − 4ac, is the discriminant, and its sign tells you what kind of roots to expect.

  • D > 0: two distinct real roots
  • D = 0: one double root, x = −b / 2a
  • D < 0: no real roots, but two complex conjugate roots p ± qi
  • Vertex (−b / 2a, c − b² / 4a): the lowest point of the parabola y = ax² + bx + c when a > 0, or its highest point when a < 0.
  • If a = 0, the equation is no longer quadratic, so it is solved as the linear equation bx + c = 0, giving x = −c / b.

How cubic equations and systems are solved

For ax³ + bx² + cx + d = 0, the discriminant Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d² is checked first. Δ > 0 means three distinct real roots, Δ = 0 a double or triple root, and Δ < 0 one real root and two complex conjugate roots. Real roots are found with the trigonometric method or Cardano’s formula and then polished with Newton’s method.

Systems of linear equations are solved by Gaussian elimination: a multiple of one equation is subtracted from the others to remove one unknown at a time, and the values are then found by back substitution. At each step the equation with the relatively largest coefficient is used as the pivot (partial pivoting) to keep rounding errors small.

If there is no single solution, the rank of the coefficient matrix is compared with the rank of the matrix that also includes the right-hand sides. Different ranks mean the equations contradict each other and there is no solution; equal ranks mean there are infinitely many solutions.

Worked examples, step by step

Example 1: 2x² − 3x − 2 = 0. Here a = 2, b = −3 and c = −2, so D = (−3)² − 4 × 2 × (−2) = 9 + 16 = 25. Since √D = 5, x = (3 ± 5) / 4, which gives x₁ = −0.5 and x₂ = 2. The vertex is at x = 3 / 4 = 0.75 and y = −2 − 9 / 8 = −3.125, that is (0.75, −3.125).

Example 2: 3x + 2y = 12 and x − y = −1. Multiply the second equation by 2 to get 2x − 2y = −2, then add it to the first: 5x = 10, so x = 2. Substituting into x − y = −1 gives y = 3.

  • x² − 5x + 6 = 0: D = 1, x₁ = 2, x₂ = 3, vertex (2.5, −0.25)
  • x² + 2x + 5 = 0: D = −16, x = −1 ± 2i
  • x³ − 6x² + 11x − 6 = 0: Δ = 4, x = 1, 2 and 3
  • x³ − 3x + 2 = 0: Δ = 0, a double root x = 1 and a single root x = −2
  • x³ − 1 = 0: Δ = −27, the real root x = 1 and the complex roots x = −0.5 ± 0.866025403784i
  • 2x + y = 5 and x − y = 1: x = 2, y = 1
  • x + y + z = 6, 2y + 5z = −4 and 2x + 5y − z = 27: x = 5, y = 3, z = −2

Common mistakes and good to know

  • Enter negative coefficients with their sign: in x² − 5x + 6 = 0, b is −5, not 5.
  • Type 0 for a missing term instead of leaving the box empty: x² − 9 = 0 is a = 1, b = 0, c = −9, and x³ − 1 = 0 is a = 1, b = 0, c = 0, d = −1.
  • Move every term to one side first. x² = 3x + 4 becomes x² − 3x − 4 = 0, so enter a = 1, b = −3 and c = −4.
  • Fractions and scientific notation such as 1e3 are not accepted. Convert fractions to decimals, or multiply the whole equation by the denominators: x²/2 + x/3 − 1 = 0 times 6 is 3x² + 2x − 6 = 0, which has the same roots.
  • Results are rounded to 12 significant digits, so an irrational root such as √2 appears as 1.41421356237.
  • Two roots that differ by roughly 10⁻⁶ or less may be merged and shown as one double root, because tiny rounding differences are treated as zero.

Frequently asked questions

What happens if the leading coefficient a is 0?

The equation is solved at a lower degree. A quadratic with a = 0 becomes the linear equation bx + c = 0, and a cubic with a = 0 is solved as a quadratic. If both a and b of a quadratic are 0, there is no solution when c ≠ 0, and every number is a solution when c = 0.

Does a negative discriminant mean there is no solution?

There is no real solution, but there are two complex conjugate roots. For example, x² + 2x + 5 = 0 has D = −16, so x = −1 ± 2i, where i is the imaginary unit whose square is −1.

What does “No unique solution” mean for a system?

It means the equations are not independent, so they do not pin down a single solution. x + y = 2 and 2x + 2y = 4 are the same line, giving infinitely many solutions, while x + y = 2 and 2x + 2y = 5 are parallel lines with no solution. The solver also tells you which of the two cases applies.

Can I enter fractions or decimals?

Decimals can be typed directly, but fractions cannot. Enter 1/2 as 0.5, or multiply the whole equation by the denominator so that every coefficient is a whole number.

How can I tell how many real roots an equation has?

Look at the sign of the discriminant. A quadratic has two real roots if D > 0, one double root if D = 0 and none if D < 0. A cubic has three distinct real roots if Δ > 0, one real root if Δ < 0, and a double or triple root if Δ = 0.

How do I find the vertex of a parabola?

The vertex is at (−b / 2a, c − b² / 4a), the lowest point of y = ax² + bx + c when a > 0 or its highest point when a < 0. For x² − 5x + 6 it is (2.5, −0.25), and the solver shows the vertex whenever you solve a quadratic.

Can it solve quartic or nonlinear equations?

No. It solves only quadratic and cubic equations and systems of linear equations with 2 or 3 unknowns; quartic and higher-degree equations and nonlinear systems are not supported.