Solve ax² + bx + c = 0 for real or complex roots, and see the discriminant and parabola vertex. Enter zero for a to solve a linear equation.
Quadratic formula
D = b² − 4ac and x = (−b ± √D)/(2a). The vertex is xᵥ = −b/(2a), yᵥ = c − b²/(4a).
| Discriminant | Roots |
|---|---|
| D > 0 | Two distinct real roots |
| D = 0 | One repeated real root |
| D < 0 | Two complex conjugate roots |
Example
For x² − 5x + 6 = 0, D = 25 − 24 = 1. The roots are (5 ± 1)/2, giving 2 and 3. The vertex is (2.5, −0.25).
Frequently asked questions
What happens when a is zero?
The equation becomes bx + c = 0. If b also equals zero, either every x is a solution when c = 0, or there is no solution.
How are complex roots shown?
The result uses real part ± imaginary part × i, where i² = −1.
Why can a nearly repeated root be sensitive?
When b² and 4ac are nearly equal, small coefficient changes can change the discriminant’s sign. Scaling and a cancellation-reducing root formula improve numerical behavior but cannot recover precision absent from the input.
Reference: Goldberg’s discussion of floating-point cancellation in the quadratic formula.
