DOC

How calculators work

Why the Quadratic Formula Works: Completing the Square Without a Shortcut

The quadratic formula is a completed square in disguise. Follow its derivation, read the discriminant, check dimensions, and see where numerical calculators need extra care.

The quadratic formula often arrives as a password: write it down, substitute three coefficients, hope the signs survive. That works for routine homework, but it hides the useful part. The formula is what remains after every quadratic has been reshaped into one square. Once that move is visible, the denominator, the discriminant, and the unavoidable plus-or-minus all stop looking arbitrary.

A mathematician completing a square within a large navy parabola, with a teal square-root tile
The formula is not a separate trick. It is the general equation after its variable terms have been made into a square.
For ax² + bx + c = 0, with a ≠ 0x = (−b ± √(b² − 4ac)) / 2a

The two possible signs are two possible square roots. They are not optional decoration.

The equation and its moving parts

Put the equation in standard form before assigning coefficients:

xunknown

The value being solved for. It may carry a physical unit U.

aquadratic coefficient

Must not be zero. If every term has dimension F, then [a] = F/U².

blinear coefficient

Its dimension is [b] = F/U; it is not automatically unitless.

cconstant term

Its dimension is [c] = F.

Δdiscriminant

Δ = b² − 4ac. Its sign classifies the roots when coefficients are real.

The dimension check is compact and useful. Both and 4ac have dimension F²/U², so √Δ has the same dimension as b. The numerator has dimension F/U; dividing it by a, which has dimension F/U², returns U, the dimension of x. A physical quadratic is legitimate only if ax², bx, and c were expressed in compatible units.

Deriving it: one square, then two roots

The derivation begins with ax² + bx + c = 0 and divides by the nonzero leading coefficient. Move the constant term first:

1. Normalizex² + (b/a)x = −c/a
2. Add the missing squarex² + (b/a)x + b²/(4a²) = −c/a + b²/(4a²)
3. Factor and combine(x + b/(2a))² = (b² − 4ac)/(4a²)
4. Take both square roots2ax + b = ±√(b² − 4ac)
5. Isolate xx = (−b ± √(b² − 4ac)) / 2a

The key choice in step 2 is not magic. Half the coefficient of x is b/(2a); its square is exactly the term that turns the left side into (x + b/(2a))². The final ± follows because a nonzero square has two square roots. Writing only the positive root quietly deletes a solution.

For a full textbook derivation, see OpenStax’s quadratic-formula section and its companion explanation of completing the square.

The discriminant is a geometry report

Δ > 0two distinct real roots

The parabola crosses the horizontal axis twice.

Δ = 0one repeated real root

The parabola touches the axis at its vertex.

Δ < 0two complex-conjugate roots

The real graph has no axis crossing, but the equation still has solutions over the complex numbers.

Three parabolic wire shapes crossing, touching, and missing a horizontal line
For real coefficients, the discriminant tracks how a parabola meets the axis: twice, once, or not at all.

This classification is exact algebra, not an uncertainty analysis. If fitted or measured coefficients make Δ very close to zero, rounding may hide whether the model predicts a crossing or a tangency. More digits are not automatically more trustworthy; the coefficient uncertainty matters too. OpenStax gives the standard real-root classification in its quadratic-equations reference.

Two complete calculations

Example 1: two real roots

Solve 2x² − 7x + 3 = 0. Here a = 2, b = −7, and c = 3.

DiscriminantΔ = (−7)² − 4(2)(3) = 49 − 24 = 25
Substitutex = [−(−7) ± √25] / [2(2)] = (7 ± 5)/4
Rootsx₁ = 12/4 = 3; x₂ = 2/4 = 1/2
Direct check2(3)² − 7(3) + 3 = 0; 2(1/2)² − 7(1/2) + 3 = 0

There is a second check that catches a different family of transcription errors. If the roots are r₁ and r₂, then r₁ + r₂ = −b/a and r₁r₂ = c/a. Here 3 + 1/2 = 7/2 and 3 × 1/2 = 3/2, matching −b/a and c/a respectively.

Example 2: complex roots are still roots

Solve x² + 4x + 13 = 0. This time a = 1, b = 4, and c = 13.

DiscriminantΔ = 4² − 4(1)(13) = 16 − 52 = −36
Square root√Δ = √(−36) = 6i
Rootsx = (−4 ± 6i)/2 = −2 ± 3i
Check one root(−2 + 3i)² + 4(−2 + 3i) + 13 = 0

The other root is the conjugate −2 − 3i. Their sum is −4 and their product is 13, again matching −b/a and c/a. A negative discriminant means “no real roots,” not “no roots.”

When you need the coefficients instead

The formula normally solves for x, but its factor form also runs the other way. Given roots r₁ and r₂ and a chosen nonzero scale a, write a(x − r₁)(x − r₂). Expanding gives:

b = −a(r₁ + r₂)c = ar₁r₂

If a required value r is known to be a root, then c = −ar² − br. For a double root, use b = −2ar and c = ar².

This is useful in design and fitting work: it distinguishes the roots you want from the overall scaling you are free to choose. It also explains why multiplying all three coefficients by the same nonzero number does not change the roots.

The formula can be right while a numerical answer is poor

A mathematician opening a coordinate plane to reveal two symmetric teal points off the real line
Complex roots are not a failed calculation; they are points beyond the real-axis picture that a real graph alone cannot show.

In exact algebra, the textbook form is complete. In binary floating-point arithmetic, it can lose the small root when −b and ±√Δ are almost equal and opposite. This is cancellation: two large, nearly equal quantities subtract and leave a result with few reliable digits.

For real Δ ≥ 0, a common stable route isq = −½(b + copysign(√Δ, b))x₁ = q/a; x₂ = c/q

One root uses the non-cancelling numerator; the other comes from x₁x₂ = c/a. Handle c = 0 and q = 0 explicitly.

William Kahan’s paper on the cost of floating-point quadratic computation and David Goldberg’s floating-point guide explain why rearranging mathematically identical expressions can matter in software. Robust implementations also scale extreme coefficients, avoid overflow in b² − 4ac, use a complex routine when needed, and check both a residual and Vieta’s relations.

Mistakes and boundaries worth keeping in view

Tempting moveWhy it failsRepair
Read coefficients before moving everything to zeroThe formula assumes ax² + bx + c = 0.Expand, collect, and put zero on one side first.
Use −7 for −b when b = −7Two minus signs are visually easy to skip.Write −(−7) before simplifying.
Divide only the square root by 2aUnparenthesized notation is misleading.Keep the whole numerator in brackets.
Discard ± or negative ΔReal-number habits are applied too soon.Keep both signs; use i when complex roots are in scope.
Apply it when a = 0The expression resembles a quadratic.Solve the linear case bx + c = 0 separately.
Accept an algebraic root as a physical answerThe computation has no domain knowledge.Reject impossible time, concentration, or design-range values after solving.

The quadratic formula solves a genuine second-degree polynomial exactly over the complex numbers when a ≠ 0. It does not solve cubics, transcendental equations, or a physical model whose coefficients were extrapolated beyond their evidence. Near a repeated root, small coefficient errors can make large changes to the separate roots; report uncertainty rather than pretending a long display is a measurement.