MATH · QUADRATIC EQUATION
Quadratic Equation Calculator
Solve ax² + bx + c = 0 with a numerically-stable algorithm. Handles two real roots, one repeated root, and complex roots (no real solutions).
About This Calculator
The quadratic formula finds the values of x that satisfy ax² + bx + c = 0. This calculator uses a numerically stable alternate form to avoid catastrophic cancellation — a floating-point rounding problem that affects the naive formula when coefficients differ greatly in magnitude.
How It Works
Enter the three coefficients a, b, and c. The calculator computes the discriminant (b² − 4ac) to determine the case, then applies the stable root formula. When a = 0 the equation is linear (bx + c = 0). When the discriminant is negative the roots are complex (no real solutions).
The Formula
x = (−b ± √(b²−4ac)) / 2a
- a, b, c
- coefficients; a ≠ 0 (otherwise linear)
- D
- discriminant b²−4ac; D>0 two real, D=0 one real, D<0 complex
Frequently Asked Questions
- What does it mean when there are no real solutions?
- When the discriminant is negative, the parabola y = ax² + bx + c does not cross the x-axis. The roots exist as complex conjugate numbers (p ± qi), which are reported in the result.
- What is the numerically stable form?
- The naive formula x = (−b ± √D)/2a suffers catastrophic cancellation when b is much larger than √D — the subtraction loses significant digits. The stable form x₁ = (−b − sign(b)√D)/2a avoids this, then computes x₂ = c/(a·x₁) without subtraction.
- What happens when a = 0?
- The equation is no longer quadratic — it simplifies to a linear equation bx + c = 0, which has the solution x = −c/b. The calculator handles this automatically.