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.

Enter your values, then select Calculate.

Solves ax² + bx + c = 0 for real coefficients, including complex roots and the linear case a = 0. Roots use a cancellation-reducing formula. Results are limited by floating-point precision, especially near a repeated root.

Quadratic formula

D = b² − 4ac and x = (−b ± √D)/(2a). The vertex is xᵥ = −b/(2a), yᵥ = c − b²/(4a).

DiscriminantRoots
D > 0Two distinct real roots
D = 0One repeated real root
D < 0Two 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.