Mathematics

How the Quadratic Formula Solves Real and Complex Roots

Walks through the quadratic formula on three equations to show how the sign of the discriminant decides whether you get two real roots, one repeated root, or a pair of complex conjugates.

A worked example: x² − 5x + 6 = 0

Take x² − 5x + 6 = 0, so a = 1, b = -5, and c = 6. The Quadratic Formula Calculator first works out the discriminant, b² − 4ac, which comes to (-5)² − 4(1)(6) = 25 − 24 = 1. Because that discriminant is positive, the equation has two distinct real roots. The calculator returns root1 = 3 and root2 = 2, and indeed 3² − 5(3) + 6 = 0 and 2² − 5(2) + 6 = 0.

The formula: applying x = (−b ± √(b² − 4ac)) ÷ 2a

The quadratic formula itself is x = (−b ± √(b² − 4ac)) ÷ 2a. For 2x² − 7x + 3 = 0 (a = 2, b = -7, c = 3), the discriminant is (-7)² − 4(2)(3) = 49 − 24 = 25, and √25 = 5. Substituting gives x = (7 ± 5) ÷ 4, which the calculator reports as root1 = 3 and root2 = 0.5 — the plus sign gives (7 + 5) ÷ 4 = 3, and the minus sign gives (7 − 5) ÷ 4 = 0.5.

Two more examples: a repeated root and a complex pair

When the discriminant is exactly zero, the ± term vanishes and both roots collapse to the same value. For 4x² − 12x + 9 = 0 (a = 4, b = -12, c = 9), the discriminant is (-12)² − 4(4)(9) = 144 − 144 = 0, and the calculator reports "One repeated real root" with root1 = root2 = 1.5.

When the discriminant is negative, there is no real square root, so the calculator switches to complex output instead of failing. For x² + 2x + 5 = 0 (a = 1, b = 2, c = 5), the discriminant is 2² − 4(1)(5) = 4 − 20 = -16. The real part of each root is −b ÷ 2a = -2 ÷ 2 = -1, and the imaginary part is √16 ÷ 2 = 2, so the calculator returns "Two complex conjugate roots": root1 = "-1 + 2i" and root2 = "-1 - 2i".

Why the discriminant's sign matters

The discriminant alone tells you what kind of answer to expect before you even finish the arithmetic — positive means the parabola crosses the x-axis twice, zero means it just touches the axis at a single point, and negative means it never touches the axis at all, so the roots only exist in the complex plane. Checking that sign first is a quick sanity check on whichever root values a calculator or a hand computation produces.