The quadratic formula is usually handed over as something to memorise, which is a shame twice over. It is four lines of algebra anyone can reproduce, and those four lines also explain a failure the memorised version hides.
The failure is specific. The formula computes one root by adding a square root and the other by subtracting it, and subtraction of two nearly equal numbers destroys digits. Asked for x² + 1,000,000,000x + 1 = 0, the solver behind this page returned a root of 0 — and 0 is not a root of that equation. It was corrected while this guide was being written.
Before going further: you cannot reproduce that on the calculator above, because its coefficient fields stop at a million. The defect lived in the shared solver rather than in anything the form would accept, which is the reason deriving these figures found it and using the page never would.
The formula is a derivation, and it takes four lines
Start with ax² + bx + c = 0 and divide through by a, which is allowed because a quadratic with a = 0 is not a quadratic.
The left side is now x² + (b/a)x, and that is a square with a corner missing. A square of side (x + b/2a) expands to x² + (b/a)x + (b/2a)², so the corner that is absent has area (b/2a)². Add it to both sides.
| Step | Left side | Right side |
|---|---|---|
| Divide by a | x² + (b/a)x + c/a | 0 |
| Move the constant | x² + (b/a)x | −c/a |
| Add the corner | (x + b/2a)² | b²/4a² − c/a |
| Take the root | x + b/2a | ±√(b² − 4ac) / 2a |
Subtract b/2a from both sides and the formula is written. Nothing was assumed about the coefficients, which is why it holds for every quadratic rather than for the ones in the exercise set.
The discriminant arrives in that last line rather than as a separate rule to remember. It is simply what ended up underneath the square root, so its sign decides whether a real square root exists at all.
Take 3x² + 5x − 2 = 0. Dividing gives x² + (5/3)x − 2/3 = 0; half of 5/3 is 5/6 and its square is 25/36; adding that to 2/3 gives 49/36, whose square root is exactly 7/6. So x = −5/6 ± 7/6, which is 1/3 and −2. The discriminant 49 is 36 times that 49/36, and the arithmetic is the same either way.
The two roots are not computed the same way
Look at the two branches as arithmetic rather than as a symmetric pair. One evaluates −b + √D and the other −b − √D. When b is positive, the first of those is a subtraction of two positive quantities, and when b is negative it is the second one.
Now ask how close those quantities are. The discriminant is b² − 4ac, so its square root is close to |b| exactly when 4ac is small beside b². Take x² + 100,000,000x + 1 = 0: b² is 10¹⁶ and 4ac is 4, a ratio of 4 x 10⁻¹⁶.
A double-precision number carries about sixteen significant digits — the standard step between neighbouring values is 2.22 x 10⁻¹⁶. So b and √(b² − 4ac) agree in every digit the computer is holding, and their difference is built entirely from digits that were never stored.
What that costs, row by row
Solve x² + bx + 1 = 0 for growing b and compare the textbook smaller root against the true one.
| b | Textbook smaller root | True smaller root | Relative error |
|---|---|---|---|
| 10⁴ | −0.00010000000111 | −0.00010000000100 | 0.0000% |
| 10⁶ | −0.00000100000761 | −0.00000100000000 | 0.0008% |
| 10⁸ | −7.4505805969e−9 | −1.0000000000e−8 | 25.5% |
| 10⁹ | 0 | −1.0000000000e−9 | 100% |
The larger root is correct in every row. It was computed by adding, and adding two numbers of the same sign cannot cancel anything.
The test that settles it
A root is not a number a formula produced. It is a number that makes the equation zero, and that is one substitution away.
At b = 10⁹ the textbook answer is 0. Substitute it: 0² + 1,000,000,000 x 0 + 1 = 1. The true root −10⁻⁹ substitutes to 0, exactly.
The largest coefficient the form accepts is a million, and that case is instructive in a quieter way. For x² + 1,000,000x + 1 = 0 the textbook smaller root is −0.00000100000761 against a true −0.00000100000000, an error of 0.0008% — and the results panel rounds to four decimal places, so both print as −0.0000. A wrong digit and a right one look identical there.
There is a second check that needs no substitution at all, and it was already on the calculator's own results panel. Vieta's formulas say the two roots must multiply to c/a, which here is 1. The textbook pair multiplied to zero. The page was printing a product of 1 above a pair of roots that could not produce it.
The fix is Vieta, again
The repair is one line and it uses the same relationship the check does. Evaluate whichever branch adds, which is the one carrying the sign of b, and then recover the second root by division rather than by a second subtraction.
| Compute | q = −½(b + sign(b)√(b² − 4ac)) |
| First root | q / a |
| Second root | c / q |
Both roots now come out of operations that cannot cancel. The site's solver was changed to this form while this guide was being written, and the accompanying test does not compare against expected decimals — it substitutes every root back into its own equation and requires the residual to be within a couple of steps of zero, across five thousand randomly generated equations.
Measured over two hundred thousand random equations, the worst relative residual under the new form is 4.9 x 10⁻¹⁶, which is about two of those steps.
A tiny leading coefficient is the same disease
The condition that breaks the subtraction is 4ac being small beside b², and there are two ways to arrange that. A large b is the obvious one. A small a is the other, and it turns up far more often in practice, because it is what a quadratic looks like when it is a small correction to a linear problem.
Solve ax² + x − 1 = 0 and shrink a. The root near 1 is the one people want, and it is the one that cancels.
| a | Textbook root near 1 | True value | Relative error |
|---|---|---|---|
| 10⁻⁴ | 0.9999000199945041 | 0.9999000199950013 | 0.00000000005% |
| 10⁻⁸ | 0.999999993922529 | 0.9999999900000002 | 0.0000004% |
| 10⁻¹⁰ | 1.000000082740371 | 0.9999999999000000 | 0.000008% |
| 10⁻¹² | 0.9999778782798785 | 0.9999999999989999 | 0.002% |
Notice the third row: the textbook answer is greater than 1 when the true root is below it. The error is not just size, it is direction, and no amount of rounding the display hides a value on the wrong side of a boundary.
Why dividing by q gives the same root
The recovery step looks like a different formula, and it is the same one rearranged. Multiply the numerator and denominator of the textbook branch by its own conjugate:
| Start with | (−b + √D) / 2a |
| Multiply above and below by (−b − √D) | (b² − D) / 2a(−b − √D) |
| And b² − D is exactly 4ac | 4ac / 2a(−b − √D) |
| Cancel the a | 2c / (−b − √D) |
So every root has two equivalent expressions, one with the square root in the numerator and one with it in the denominator, and the two forms cancel in opposite cases. Whichever branch would subtract in the first form adds in the second.
On 3x² + 5x − 2 = 0 both routes give 0.333333333333 for the root at 1/3, as they must. The difference only appears when the digits are under pressure, and then the choice of route is the whole answer.
The threshold moves with your precision
The table above was computed in double precision, which carries about sixteen significant digits. Someone working on paper with an eight-digit calculator meets the same wall much earlier, and the rule that locates it is short.
Cancellation is total once 4ac is smaller than b² by more than the digits you are carrying — that is, once 4ac / b² falls below 10⁻͐ for d digits. With a and c both 1 that puts the wall at b ≈ 10⁽ᶜ²: about 10⁴ on an eight-digit calculator, and about 10⁸ in double precision.
Work x² + 1,000,000x + 1 = 0 by hand at eight digits and see it happen. The discriminant is 999,999,999,996, whose square root is 999,999.999998 — and rounded to eight significant digits that is 1,000,000.0, identical to b. Subtracting gives zero and the smaller root vanishes, while the same equation in double precision is still accurate to four decimal places.
So the row that looks safe in the table is not a property of the equation. It is a property of the equation and the machine, and moving to a shorter register moves the failure to smaller coefficients. Nothing about the algebra changed; the algebra was never the problem.
What the discriminant cannot tell you
The discriminant answers one question: are there two real roots, one, or none. It is silent about whether the two it promises will arrive with their digits intact.
In fact the relationship runs the wrong way. A large discriminant relative to 4ac is precisely the condition under which the subtracting branch cancels, so the case that looks safest by the usual test is the one that fails. All four rows in the table above have a positive discriminant, and the last two are wrong.
That is worth stating plainly because a positive discriminant reads like a clean bill of health, and it is only a statement about the existence of roots, not about their accuracy. The same distinction runs through how many decimals to keep when converting units: an exact rule can hand you an answer whose digits are not exact.
Common mistakes
- Memorising the formula without the derivation. Completing the square takes four lines and makes the discriminant obvious rather than arbitrary.
- Trusting a printed root without substituting it. One multiplication and two additions settle it, and the check costs less than re-deriving the arithmetic.
- Reading a positive discriminant as a guarantee. It promises two real roots exist. It says nothing about the digits of either.
- Assuming both roots are equally reliable. They come from different operations; only the branch that opposes the sign of b can cancel.
- Dividing by a before checking it. With a = 0 there is no parabola and no pair of roots, only the linear root −c/b, and the calculator reports that case separately.
- Discarding the negative-discriminant case as "no solution". There are two solutions; they are complex, and the formula produces them from the same line.
Related guide
Find the Radius From the Area: Running a Formula Backwards
The other half of the same idea. A formula is printed in the direction you need least, and the inverse is a root, which is where both the interesting answers and the failures live.
Read the guide