Mathematics & Statistics

Quadratic Equation Solver

Roots of ax² + bx + c = 0 (real or complex), discriminant, vertex, axis and factored form.

Inputs

Upward parabola crossing the x-axis at two roots x1 and x2, with its lowest point, the vertex, on a dashed axis of symmetry.xx = −b ÷ 2ax₁x₂vertex
The real roots x₁ and x₂ are where the parabola crosses the x-axis. The vertex lies on the axis of symmetry x = −b ÷ 2a, halfway between the roots. If D < 0 the parabola does not reach the axis and the roots are complex. Diagram not to scale.

Result

Roots
x₁ = -2, x₂ = 5
Root x₁
-2
Root x₂
5
Discriminant D = b² − 4ac
49
Type of roots
Two different real roots (D > 0)
Vertex x (axis of symmetry)
1.5
Vertex y (minimum or maximum value)
-12.25
Factored / vertex form
(x + 2)(x − 5)
Working
1x² − 3x − 10 = 0 D = (-3)² − 4 × 1 × -10 = 49 q = −(b + sign(b)√D) ÷ 2 = 5 x = q ÷ a = 5 and x = c ÷ q = -2 Vertex = (−b ÷ 2a, c − b² ÷ 4a) = (1.5, -12.25)

Two different real roots (D > 0): x₁ = -2, x₂ = 5. The parabola has its minimum at (1.5, -12.25).

Educational estimate — check the assumptions below.

About this calculator

A quadratic equation ax² + bx + c = 0 has two roots, which may be real and different, one repeated real root, or a pair of complex roots. The discriminant D = b² − 4ac tells which. The graph of y = ax² + bx + c is a parabola: the real roots are where it crosses the x-axis and the vertex is its lowest (a > 0) or highest (a < 0) point.

Formula

x = (−b ± √D) ÷ 2a,   D = b² − 4ac

To avoid losing digits when b² is much larger than 4ac, the calculator uses the equivalent stable form q = −(b + sign(b)√D) ÷ 2, x₁ = q ÷ a, x₂ = c ÷ q.

D < 0: x = −b/2a ± i √(−D)/2|a|    Vertex: (−b/2a, c − b²/4a)

Worked example

x² − 3x − 10 = 0 (a = 1, b = −3, c = −10):

  • D = 9 + 40 = 49, √D = 7
  • x = (3 ± 7) ÷ 2 → x₁ = −2, x₂ = 5; factored: (x + 2)(x − 5)
  • Vertex (1.5, −12.25)

x² + 2x + 5 = 0 gives D = −16 → x = −1 ± 2i.

Assumptions and limitations

  • Real coefficients a, b and c; a must not be zero.
  • A discriminant within 10⁻¹⁴ of zero, relative to the size of b² and 4ac, is treated as zero (a double root), because rounding cannot tell such values apart.
  • D itself is computed as b² − 4ac in double precision; for nearly equal roots of very large coefficients the last digits can be uncertain.

References

  • Press, W. H. et al. Numerical Recipes, 3rd ed., §5.6 — quadratic and cubic equations (stable formula).
  • Higham, N. J. Accuracy and Stability of Numerical Algorithms — cancellation in the quadratic formula.