Solve ax² + bx + c = 0 with the quadratic formula, including repeated roots and complex conjugate pairs.
Example
For x² − 5x + 6 = 0, entering a = 1, b = −5 and c = 6 gives the roots 3 and 2 with a discriminant of 1. For 2x² − 4x − 6 = 0 the roots are 3 and −1, and x² + 2x + 5 = 0 gives x = −1 ± 2i.
Calculation method
The discriminant b² − 4ac is calculated first. When it is positive there are two real roots, (−b ± √discriminant) ÷ (2a); when it is 0 both branches give the same repeated root; and when it is negative the tool returns a complex conjugate pair as a real part plus or minus an imaginary part. The coefficient a cannot be 0, because the equation would then be linear.
Important notes
Rewrite the equation in standard form before entering the values, moving every term to one side and keeping the signs. A missing term has a coefficient of 0, as in x² − 2 = 0 where b = 0. Irrational roots are displayed rounded to eight decimal places, so x² − 2 = 0 shows ±1.41421356.
Enter the coefficients from standard form
Rewrite the equation as ax² + bx + c = 0 before entering values, moving every term to one side and keeping the signs. For x² − 5x + 6 = 0, enter a = 1, b = −5 and c = 6; the roots are 3 and 2. For 2x² = 4x + 6, subtract to get 2x² − 4x − 6 = 0, so a = 2, b = −4 and c = −6, and the roots are 3 and −1. A missing term has a coefficient of 0, as in x² − 2 = 0 where b = 0.
What the discriminant tells you
The discriminant b² − 4ac decides the kind of answer before any square root is taken. A positive value gives two different real roots: x² − 2 = 0 has a discriminant of 8 and roots of about ±1.41421356. Zero gives one repeated root: x² + 2x + 1 = 0 has a discriminant of 0 and x = −1 twice. A negative value gives a pair of complex conjugate roots: x² + 2x + 5 = 0 has a discriminant of −16 and x = −1 ± 2i.
Checking and using the roots
Substitute a root back into the equation to verify it: with x = 3 in 2x² − 4x − 6, the terms are 18 − 12 − 6 = 0. The roots also give the factored form a(x − r₁)(x − r₂), so 2x² − 4x − 6 = 2(x − 3)(x + 1). A negative leading coefficient only flips the parabola, as in −x² + 4 = 0 with roots −2 and 2. The value of a cannot be 0, because the equation would then be linear with at most one solution. Irrational roots are displayed rounded to eight decimal places.
Worked examples| Input | Result |
|---|
1, -5, 6 | x = 3, 2 · Δ 1 |
2, -4, -6 | x = 3, -1 · Δ 64 |
1, 0, -2 | x = 1.41421356, -1.41421356 · Δ 8 |
1, 2, 1 | x = -1, -1 · Δ 0 |
1, 2, 5 | x = -1 ± 2i · Δ -16 |
-1, 0, 4 | x = -2, 2 · Δ 16 |