A garden against a wall
Students at a secondary school in Kisumu are fencing a vegetable garden against the long wall of their classroom block. They have metres of fencing for the other three sides. If the two sides that stick out from the wall are metres long, the side parallel to the wall is metres, and the garden's area is
Two questions come up at once. The agriculture teacher wants exactly : what should be? And what is the largest garden the fencing can enclose?
The first question is an equation, , in which the unknown appears squared: a quadratic equation. The second is about the highest point of the graph of , which turns out to be a parabola. By the end of this lesson you will be able to answer both, and to prove that your answers are right.
Completing the square: a picture from Baghdad
Around 820 CE, the scholar Muḥammad ibn Mūsā al-Khwārizmī, working in Baghdad, explained how to solve "a square and ten roots equal thirty-nine": in our notation, . His explanation was a picture.
Split the into two strips of and lay them along two sides of the square . The L-shape has area , and it is a large square with a corner missing. Add that corner to both sides:
Every quadratic equation can be solved this way. Doing it once and for all, with letters instead of numbers, produces the quadratic formula.
Definitions
Definition— quadratic equation and function
A quadratic equation is an equation where are real numbers and . The function is a quadratic function, and its graph is called a parabola. A solution of the equation is a root of (or a zero).
Definition— discriminant
The discriminant of is the number .
Definition— vertex and axis of symmetry
The vertex of a parabola is its lowest point (if ) or highest point (if ). The axis of symmetry is the vertical line through the vertex: the parabola is its own mirror image in this line.
We will use one property of the real numbers again and again.
Theorem— Zero-product property
For real numbers and : if , then or .
Proof
Suppose and . Multiplying both sides by gives .
∎
Worked examples
Example— By factorising: the garden
The garden needs . Rearranging and dividing by : . We look for two numbers with product and sum : and . So
and by the zero-product property or . Both work: a garden or a garden. Factorising is quick when the roots are whole numbers, but most quadratics do not factorise so nicely.
Example— By completing the square
Solve . Half of is , and , so
So or . Do not forget the : both and are .
Example— By the formula
Solve . Here , , and , so there are two real roots:
Example— What the discriminant says
- : . One root, , because . The parabola just touches the -axis.
- : . No real roots: the parabola stays above the axis. In the complex numbers there are two roots, .
Example— A quadratic with given roots
Find a quadratic with roots and . Their sum is and their product is . By Vieta's formulas (proved below), works. Check with the formula: .
Example— The largest garden
has , so its vertex is a highest point, at . The largest garden is m by m, with area . Completing the square shows it directly: , and .
Example— A ball kicked upwards
A footballer kicks a ball straight up from a height of m at m/s. Ignoring air resistance (a modelling assumption), its height after seconds is about metres. The vertex is at s, and the maximum height is
The ball lands when : s. The other root, about s, is a valid solution of the equation but means nothing for the ball. Always ask which roots make sense in the situation.
Proofs: the formula, the discriminant and the vertex
Theorem— Completing the square
If , then for every :
Proof
Expand the right-hand side: .
∎
Multiplying by clears every fraction and gives an identity that holds even when :
Theorem— Quadratic formula
Let and . Then if and only if
Proof
By , and because , the equation is equivalent to . Since , it has the square root , and means . By the zero-product property, or , that is, . Every step is reversible, so these two numbers are roots, and there are no others.
∎
Theorem— The discriminant decides
For , the equation has
- two different real roots if ;
- exactly one real root, , if ;
- no real roots if .
Proof
If then , and the two roots given by the formula differ by . If the formula gives twice. If , a root would satisfy by . But the square of a real number is never negative.
∎
Theorem— Vieta's formulas
If and are the roots of (with allowed when ), then
Proof
From the formula: and .
Without the formula, for two different roots: subtracting from gives . Since , . Then .
∎
Equivalently, . This is the factor theorem of the polynomials lesson at work: each root gives a factor.
Theorem— Vertex and axis of symmetry
Let with and put . Then:
- for every : the line is an axis of symmetry;
- ;
- if then for all (the vertex is the lowest point); if then (it is the highest point).
Proof
By completing the square, with . Then , which proves 1. For 3, has the sign of , because .
∎
Note
There is a pleasant shortcut, popularised by Po-Shen Loh in 2019 (and, as he points out, rooted in very old ideas). Divide by to get . By Vieta, the roots have average , so write them as . Their product is , so — the quadratic formula again.
The proofs, checked by Lean
In Lean the real numbers are ℝ and Real.sqrt is the square root. The tactic field_simp clears denominators (it needs to know ), and ring checks polynomial identities. Completing the square, and the fraction-free identity :
/-- **Completing the square:** for `a ≠ 0`,
`ax² + bx + c = a(x + b/(2a))² − (b² − 4ac)/(4a)`.
`field_simp` clears the denominators `2a` and `4a`, and `ring` checks the resulting identity. -/
theorem complete_square {a b c : ℝ} (ha : a ≠ 0) (x : ℝ) :
a * x ^ 2 + b * x + c = a * (x + b / (2 * a)) ^ 2 - (b ^ 2 - 4 * a * c) / (4 * a) := by
field_simp
ring/-- **The identity behind every case:** `4a(ax² + bx + c) = (2ax + b)² − (b² − 4ac)`.
This is completing the square with the fractions cleared, and it holds even when `a = 0`. -/
theorem times_four_a (a b c x : ℝ) :
4 * a * (a * x ^ 2 + b * x + c) = (2 * a * x + b) ^ 2 - (b ^ 2 - 4 * a * c) := by
ringThe quadratic formula is an "if and only if": the two numbers are roots, and they are the only roots. The proof factorises the quadratic as and uses the zero-product property mul_eq_zero:
/-- **The quadratic formula.** If `a ≠ 0` and `Δ = b² − 4ac ≥ 0`, then
`ax² + bx + c = 0` exactly when `x = (−b + √Δ)/(2a)` or `x = (−b − √Δ)/(2a)`.
Proof: with `s = √Δ` (so `s² = Δ`), the quadratic factorises as `a(x − r₁)(x − r₂)` with
`r₁, r₂ = (−b ± s)/(2a)`; then use the zero-product property and `a ≠ 0`. Both directions are
proved: these numbers are roots, and there are no other roots. -/
theorem quadratic_formula {a b c : ℝ} (ha : a ≠ 0) (hΔ : 0 ≤ b ^ 2 - 4 * a * c) (x : ℝ) :
a * x ^ 2 + b * x + c = 0 ↔
x = (-b + Real.sqrt (b ^ 2 - 4 * a * c)) / (2 * a) ∨
x = (-b - Real.sqrt (b ^ 2 - 4 * a * c)) / (2 * a) := by
set s := Real.sqrt (b ^ 2 - 4 * a * c) with hs
have hs2 : s ^ 2 = b ^ 2 - 4 * a * c := Real.sq_sqrt hΔ
-- the factorisation `a(x − r₁)(x − r₂)`
have expand : a * (x - (-b + s) / (2 * a)) * (x - (-b - s) / (2 * a)) =
a * x ^ 2 + b * x + (b ^ 2 - s ^ 2) / (4 * a) := by
field_simp
ring
have key : a * x ^ 2 + b * x + c = a * (x - (-b + s) / (2 * a)) * (x - (-b - s) / (2 * a)) := by
rw [expand, hs2]
field_simp
ring
rw [key]
constructor
· intro h
rcases mul_eq_zero.mp h with h1 | h2
· rcases mul_eq_zero.mp h1 with h3 | h4
· exact absurd h3 ha
· exact Or.inl (sub_eq_zero.mp h4)
· exact Or.inr (sub_eq_zero.mp h2)
· rintro (h | h) <;> rw [h] <;> ringMathlib proves the formula over any field in which , assuming only that the discriminant has some square root . That is why the same theorem covers the complex numbers, where every number has a square root:
/-- **The quadratic formula, Mathlib's form,** over any field in which `2 ≠ 0` (the rationals,
the reals, the complex numbers, the integers modulo an odd prime, …): if `s * s = b² − 4ac`
then the roots are `(−b ± s)/(2a)`. This applies `quadratic_eq_zero_iff`. Over the complex
numbers a square root `s` always exists, so every quadratic has roots there. -/
theorem quadratic_formula_library {K : Type*} [Field K] [NeZero (2 : K)] {a b c s : K}
(ha : a ≠ 0) (h : discrim a b c = s * s) (x : K) :
a * (x * x) + b * x + c = 0 ↔ x = (-b + s) / (2 * a) ∨ x = (-b - s) / (2 * a) :=
quadratic_eq_zero_iff ha h xThe three cases of the discriminant:
/-- **`Δ < 0`: no real roots.** If `ax² + bx + c = 0` then the identity `times_four_a` gives
`(2ax + b)² − Δ = 4a · 0 = 0` (`linear_combination` checks this), so `(2ax + b)² = Δ`. A square of
a real number is never negative, so `Δ ≥ 0`. (No assumption `a ≠ 0` is needed.) -/
theorem no_real_roots {a b c : ℝ} (hΔ : b ^ 2 - 4 * a * c < 0) (x : ℝ) :
a * x ^ 2 + b * x + c ≠ 0 := by
intro h
have hsq : (2 * a * x + b) ^ 2 = b ^ 2 - 4 * a * c := by
linear_combination 4 * a * h
nlinarith [sq_nonneg (2 * a * x + b)]/-- **`Δ = 0`: exactly one real root,** `x = −b/(2a)` (a "double root").
By `times_four_a`, `4a(ax² + bx + c) = (2ax + b)²`, which is zero exactly when `2ax + b = 0`. -/
theorem one_root {a b c : ℝ} (ha : a ≠ 0) (hΔ : b ^ 2 - 4 * a * c = 0) (x : ℝ) :
a * x ^ 2 + b * x + c = 0 ↔ x = -b / (2 * a) := by
have h4 : 4 * a * (a * x ^ 2 + b * x + c) = (2 * a * x + b) ^ 2 := by
rw [times_four_a, hΔ, sub_zero]
constructor
· intro h
have hsq : (2 * a * x + b) ^ 2 = 0 := by rw [← h4, h, mul_zero]
have hlin : 2 * a * x + b = 0 := pow_eq_zero_iff (n := 2) (by norm_num) |>.mp hsq
field_simp
linarith
· intro hx
have hlin : 2 * a * x + b = 0 := by rw [hx]; field_simp; ring
have h4a : (4 * a) * (a * x ^ 2 + b * x + c) = 0 := by rw [h4, hlin]; ring
rcases mul_eq_zero.mp h4a with h | h
· exact absurd (by linarith : a = 0) ha
· exact h/-- **`Δ > 0`: the two roots are different.** They differ by `2√Δ/(2a)`, and `√Δ > 0`. -/
theorem two_roots_distinct {a b c : ℝ} (ha : a ≠ 0) (hΔ : 0 < b ^ 2 - 4 * a * c) :
(-b + Real.sqrt (b ^ 2 - 4 * a * c)) / (2 * a) ≠
(-b - Real.sqrt (b ^ 2 - 4 * a * c)) / (2 * a) := by
have hs : 0 < Real.sqrt (b ^ 2 - 4 * a * c) := Real.sqrt_pos.mpr hΔ
intro h
have h2a : (2 * a) ≠ 0 := mul_ne_zero two_ne_zero ha
rw [div_left_inj' h2a] at h
linarith/-- **The converse view:** if `ax² + bx + c ≥ 0` for every `x`, then `Δ ≤ 0`.
(A parabola that never dips below the axis cannot cross it twice.) This applies Mathlib's
`discrim_le_zero`. -/
theorem discrim_le_zero_library {a b c : ℝ} (h : ∀ x : ℝ, 0 ≤ a * (x * x) + b * x + c) :
discrim a b c ≤ 0 :=
discrim_le_zero hVieta's formulas, proved the second way (without the formula):
/-- **Vieta's formulas.** If `r ≠ s` are both roots of `ax² + bx + c` with `a ≠ 0`, then
`r + s = −b/a` and `rs = c/a`.
Subtracting the two equations gives `(r − s)(a(r + s) + b) = 0`, and `r − s ≠ 0`; then
`c = −ar² − br = ar(r + s) − ar² = ars`. -/
theorem vieta {a b c r s : ℝ} (ha : a ≠ 0) (hrs : r ≠ s)
(hr : a * r ^ 2 + b * r + c = 0) (hs : a * s ^ 2 + b * s + c = 0) :
r + s = -b / a ∧ r * s = c / a := by
have hdiff : (r - s) * (a * (r + s) + b) = 0 := by linear_combination hr - hs
have hsum : a * (r + s) + b = 0 :=
(mul_eq_zero.mp hdiff).resolve_left (sub_ne_zero.mpr hrs)
constructor
· field_simp
linarith
· have hc : c = a * (r * s) := by linear_combination hr - r * hsum
rw [hc]
field_simpThe vertex, the axis of symmetry and the optimisation problem. The garden's area is , which is twice with , so rectangle_max shows that it is largest at :
/-- **The vertex is the lowest point** when `a > 0`. With `h = −b/(2a)`,
`f(x) − f(h) = a(x − h)² ≥ 0` for every `x`. -/
theorem vertex_min {a b c : ℝ} (ha : 0 < a) (x : ℝ) :
a * (-b / (2 * a)) ^ 2 + b * (-b / (2 * a)) + c ≤ a * x ^ 2 + b * x + c := by
have hdiff : a * x ^ 2 + b * x + c - (a * (-b / (2 * a)) ^ 2 + b * (-b / (2 * a)) + c) =
a * (x + b / (2 * a)) ^ 2 := by
field_simp
ring
have hnonneg : 0 ≤ a * (x + b / (2 * a)) ^ 2 := by positivity
linarith/-- **The height of the vertex** is `f(−b/(2a)) = c − b²/(4a) = −Δ/(4a)`. -/
theorem vertex_value {a b c : ℝ} (ha : a ≠ 0) :
a * (-b / (2 * a)) ^ 2 + b * (-b / (2 * a)) + c = -(b ^ 2 - 4 * a * c) / (4 * a) := by
field_simp
ring/-- **Axis of symmetry:** the parabola is symmetric about the vertical line `x = −b/(2a)`:
going a distance `t` to the right or to the left of it gives the same height. -/
theorem axis_of_symmetry {a b c : ℝ} (ha : a ≠ 0) (t : ℝ) :
a * (-b / (2 * a) + t) ^ 2 + b * (-b / (2 * a) + t) + c =
a * (-b / (2 * a) - t) ^ 2 + b * (-b / (2 * a) - t) + c := by
field_simp
ring/-- **Optimisation:** among rectangles with perimeter `P`, the square has the largest area.
A rectangle with one side `x` has other side `P/2 − x`, and
`P²/16 − x(P/2 − x) = (x − P/4)² ≥ 0`, with equality exactly when `x = P/4`. -/
theorem rectangle_max (P x : ℝ) :
x * (P / 2 - x) ≤ P ^ 2 / 16 ∧ (x * (P / 2 - x) = P ^ 2 / 16 ↔ x = P / 4) := by
have key : P ^ 2 / 16 - x * (P / 2 - x) = (x - P / 4) ^ 2 := by ring
refine ⟨by nlinarith [sq_nonneg (x - P / 4)], ?_⟩
constructor
· intro h
have h0 : (x - P / 4) ^ 2 = 0 := by linarith
have := pow_eq_zero_iff (n := 2) (by norm_num) |>.mp h0
linarith
· rintro rfl
ringCounting quadratics, and a formula that fails on a computer
"""How often does a quadratic have real roots? The discriminant decides.
Part 1 classifies every quadratic ax^2 + bx + c with whole-number
coefficients from -5 to 5 (a != 0) by the sign of b^2 - 4ac, and checks with
exact fractions that the quadratic formula really gives roots whenever the
discriminant is a perfect square. Part 2 picks coefficients at random from the
interval [-1, 1] and compares the proportion with real roots against the
known exact value (41 + 6 ln 2)/72.
"""
import math
import random
from fractions import Fraction
def discriminant(a, b, c):
"""b^2 - 4ac."""
return b * b - 4 * a * c
def classify(a, b, c):
"""'two', 'one' or 'none': the number of distinct real roots (a != 0)."""
if a == 0:
raise ValueError("not a quadratic: a = 0")
d = discriminant(a, b, c)
return "two" if d > 0 else ("one" if d == 0 else "none")
def rational_roots(a, b, c):
"""Exact roots by the formula when b^2 - 4ac is a perfect square, else None."""
d = discriminant(a, b, c)
if d < 0 or math.isqrt(d) ** 2 != d:
return None
s = math.isqrt(d)
return sorted({Fraction(-b + s, 2 * a), Fraction(-b - s, 2 * a)})
def census(limit=5):
"""Counts of each case over all integer a, b, c in [-limit, limit], a != 0,
plus how many have rational roots and how many formula checks failed."""
counts = {"two": 0, "one": 0, "none": 0, "rational": 0, "failures": 0}
values = range(-limit, limit + 1)
for a in values:
if a == 0:
continue
for b in values:
for c in values:
counts[classify(a, b, c)] += 1
roots = rational_roots(a, b, c)
if roots is not None:
counts["rational"] += 1
counts["failures"] += any(
a * x * x + b * x + c != 0 for x in roots)
return counts
def simulate(trials, seed=2024):
"""Proportion of random quadratics (a, b, c uniform in [-1, 1]) with
b^2 - 4ac >= 0."""
rng = random.Random(seed)
hits = 0
for _ in range(trials):
a, b, c = (rng.uniform(-1, 1) for _ in range(3))
hits += discriminant(a, b, c) >= 0
return hits / trials
EXACT_PROBABILITY = (41 + 6 * math.log(2)) / 72
def main():
counts = census()
total = counts["two"] + counts["one"] + counts["none"]
print(f"all {total} quadratics with a, b, c in -5..5 and a != 0:")
print(f" discriminant > 0 (two real roots): {counts['two']:4d}")
print(f" discriminant = 0 (one real root): {counts['one']:4d}")
print(f" discriminant < 0 (no real roots): {counts['none']:4d}")
print(f" perfect-square discriminant (rational roots): {counts['rational']}")
print(f" exact checks of the formula's roots that failed: "
f"{counts['failures']}")
print()
trials = 20000
p = simulate(trials)
se = math.sqrt(p * (1 - p) / trials)
print(f"random a, b, c in [-1, 1], {trials} trials:")
print(f" proportion with real roots {p:.4f} (standard error {se:.4f})")
print(f" exact value (41 + 6 ln 2)/72 = {EXACT_PROBABILITY:.4f}")
print(" Half the time a and c have opposite signs, so -4ac > 0 and the")
print(" roots are real for sure; that alone gives at least 1/2.")
print()
print("Epistemic status: part 1 is an exhaustive, exact check of 1,210")
print("cases; it illustrates but does not replace the lesson's proof.")
print("Part 2 is statistical evidence: the simulated proportion should lie")
print("within about two standard errors of the exact value, which comes from")
print("an integral we do not compute here.")
if __name__ == "__main__":
main()The census is exact, but it only covers quadratics. The simulation is statistical evidence: it estimates a probability and reports its standard error, so we can judge how far to trust the third decimal place.
The quadratic formula is a theorem, so it cannot be wrong. A computer, though, rounds every number to about significant digits, and that can make the formula give badly wrong answers:
"""When the quadratic formula goes wrong on a computer - and how Vieta saves it.
The roots of x^2 - Bx + 1 = 0 for large B are about B and 1/B. In
floating-point arithmetic the formula (B - sqrt(B^2 - 4))/2 for the small root
subtracts two nearly equal numbers, and most of its digits cancel. Vieta's
formula r1 * r2 = c/a gives the small root as 1/r1 with no cancellation. Exact
reference values come from 60-digit decimal arithmetic.
"""
from decimal import Decimal, localcontext
import math
def naive_small_root(a, b, c):
"""The textbook formula (-b - sqrt(b^2 - 4ac)) / (2a).
For a > 0 and b < 0 this is the root of smaller size; when 4ac is tiny
compared with b^2 it subtracts two nearly equal numbers.
"""
return (-b - math.sqrt(b * b - 4 * a * c)) / (2 * a)
def stable_roots(a, b, c):
"""Both real roots without cancellation (needs b != 0 and D >= 0).
First the root where -b and the square root have the same sign (no
cancellation), then the other one from Vieta: r1 * r2 = c / a.
"""
d = b * b - 4 * a * c
if d < 0:
raise ValueError("no real roots")
big = (-b + math.copysign(math.sqrt(d), -b)) / (2 * a)
return big, c / (a * big)
def reference_small_root(big_b, digits=60):
"""Small root of x^2 - B x + 1 to ``digits`` significant digits."""
with localcontext() as ctx:
ctx.prec = digits
b = Decimal(big_b)
return (b - (b * b - 4).sqrt()) / 2
def relative_error(approx, exact):
"""|approx - exact| / |exact|, with exact a Decimal (60-digit arithmetic)."""
with localcontext() as ctx:
ctx.prec = 60
return abs((Decimal(approx) - exact) / exact)
def main():
print("small root of x^2 - Bx + 1 = 0 (true value is about 1/B)")
print(f"{'B':>6} {'textbook formula':>18} {'rel. error':>10}"
f" {'Vieta':>12} {'rel. error':>10}")
for k in range(2, 9):
big_b = 10 ** k
exact = reference_small_root(big_b)
naive = naive_small_root(1.0, -float(big_b), 1.0)
vieta = stable_roots(1.0, -float(big_b), 1.0)[1]
print(f" 1e{k} {naive:18.12e} {float(relative_error(naive, exact)):10.1e}"
f" {vieta:12.6e} {float(relative_error(vieta, exact)):10.1e}")
print()
print("For B = 1e8, sqrt(B^2 - 4) agrees with B in about 16 digits, so")
print("B - sqrt(B^2 - 4) keeps almost none of them: the textbook answer")
print("is wrong in the first digit. Vieta's 1/r1 keeps full precision.")
print()
print("Epistemic status: numerical evidence about IEEE double-precision")
print("floating point, checked against 60-digit decimal values whose own")
print("error is far below the digits shown. Algebraically both formulas are")
print("exactly equal; the difference is entirely rounding error.")
if __name__ == "__main__":
main()Both formulas are algebraically identical. The difference is numerical. Subtracting two nearly equal rounded numbers destroys their agreeing digits, while Vieta's involves no subtraction at all. Numerical software computes roots the second way.
Explore: the parabola and its coefficients
Move , and . The marked point is the vertex . Watch how the number of -intercepts changes exactly when the vertex crosses the -axis, which is when changes sign. What does alone do? What happens to the vertex when you change only ?
The parabola y = ax² + bx + c
Move the sliders and trace along the curves to read off values.
- y = ax² + bx + c
- y = ax² + bx + c: y = −4
When the roots are complex. Here is a beautiful case. The two roots of , , are two of the three cube roots of , because . In the complex plane they sit with at the corners of an equilateral triangle:
The roots of x² + x + 1 are cube roots of 1
The n-th roots of a number c sit evenly spaced on one circle: the corners of a regular polygon.
Drag the points, or focus one with Tab and use the arrow keys (hold Shift for small steps).
Solutions of wⁿ = c for n = 3:
- w₀ = 1
- w₁ = −0.5 + 0.866i
- w₂ = −0.5 − 0.866i
All roots lie on the circle of radius |c|^(1/n) ≈ 1.
Neighbouring roots are 120° apart: 360° ÷ 3.
w₀ is the principal root, at the angle (arg c)/n; the others follow by equal turns.
Because c = 1, these are the roots of unity of order 3.
The roots add up to 0, so the regular polygon is balanced around the origin.
Exercises
1. Quadratic equations and functions
Warm-upHumanCompute the discriminant of .
2. Quadratic equations and functions
Warm-upHumanSolve . Enter the solutions as a set, for example {1, 2}.
3. Quadratic equations and functions
CoreHumanHow many different real roots does have?
4. Quadratic equations and functions
CoreHumanKofi solves by dividing both sides by and gets . What is wrong?
5. Quadratic equations and functions
CoreHumanA goat pen is built against a straight wall using m of fencing for the other three sides. What is the largest possible area of the pen, in square metres?
6. Quadratic equations and functions
CoreHumanWithout solving, find the sum and the product of the roots of .
7. Quadratic equations and functions
StretchHumanFind the positive number for which has exactly one real root.
8. Quadratic equations and functions
StretchFormalIn Mathlib, Real.sqrt of a negative number is defined to be 0. The theorem Lumenary.Quadratics.quadratic_formula has the hypothesis hΔ : 0 ≤ b ^ 2 - 4 * a * c. What would happen if we deleted it?
9. Quadratic equations and functions
StretchComputationalWrite real_roots(a, b, c) that returns the sorted list of the different real roots of (with ): two roots if , one if , and the empty list if . Use math.sqrt.
Common misconceptions
Misconception
Dividing both sides by . From , dividing by gives and loses the root . Dividing by is only allowed when . Instead, factorise: , so or .
Misconception
Misusing the zero-product property. From it does not follow that or . The property only works with on the right: a product can be in infinitely many ways. Expand and rearrange first: , so , and or .
Misconception
" means there are no solutions at all." There are no real solutions. In the complex numbers there are always two (equal when ): . Whether an equation "has solutions" depends on which numbers you allow; see complex numbers.
Misconception
" means ." It means or . The symbol means only the non-negative root , which is why the formula needs .
Misconception
"The vertex is at ." It is at , the average of the two roots by Vieta. Check with : its roots are and , so the vertex is at .
Many ways of seeing
Geometry— Every parabola has the same shape
A parabola is a conic section: the set of points at equal distance from a point (the focus) and a line (the directrix). The parabola with has focus and directrix . Rays parallel to the axis reflect off it through the focus, which is why satellite dishes and solar cookers are parabolic. Surprisingly, all parabolas are similar. Scaling the plane by a factor sends to , and any parabola can be moved onto some . A "steep" parabola is just a zoomed-out view of a "flat" one (see conic sections).
Number theory— Quadratics in clock arithmetic
Completing the square only needs division by , so the quadratic formula also works modulo an odd prime , provided the discriminant has a square root there. For example, has no real roots, but modulo it has the roots and ( and ). Modulo it has none, since the squares modulo are only . Which numbers are squares modulo is a deep question. A classical theorem, going back to Fermat and Euler, says that is a square modulo an odd prime exactly when leaves remainder on division by (see number theory).
Analysis— The vertex is where the slope is zero
Near its vertex, a parabola is momentarily flat. Calculus makes this precise: the slope of at is , which is zero exactly at . For quadratics, completing the square finds maxima and minima without calculus. For other functions the idea "look where the slope is zero" is the starting point of optimisation (see introductory calculus). The garden problem also hides an inequality between means: for positive and , , because the difference is .
Physics— Why thrown things trace parabolas
Galileo Galilei found experimentally, and published in Two New Sciences (1638), that a falling body covers distances proportional to the square of the time. With constant downward acceleration , the height of a projectile is , a quadratic in . A ball thrown at an angle travels horizontally at constant speed while its height follows this quadratic, so its path is a parabola too. This is a model: it ignores air resistance and assumes is constant, which is excellent for a football and poor for a feather or a rocket (see modelling with functions).
History and global context
- Mesopotamia. Old Babylonian clay tablets from around 1800 BCE, such as the tablet known as BM 13901, pose problems like "I added the area and the side of my square: ", that is, . They solve them by a cut-and-paste procedure equivalent to completing the square.
- Egypt. A Middle Kingdom papyrus now in Berlin contains a problem equivalent to finding two squares whose areas add up to when one side is of the other.
- India. Brahmagupta's Brāhmasphuṭasiddhānta (628 CE) gave an explicit rule for solving quadratic equations. Śrīdhara (whose dates are uncertain, perhaps the 8th or 9th century) gave the method that multiplies by and adds , our identity . It is known from Bhāskara II's quotation of it in the 12th century.
- Baghdad. Al-Khwārizmī (around 820 CE) classified quadratic equations into six types, since he used only positive numbers, and justified each solution by a geometric picture like the one above.
- Europe. Abraham bar Ḥiyya's treatise, translated into Latin in 1145, helped bring these methods to Europe. In his Ars Magna (1545), Gerolamo Cardano met as "solutions" of dividing into two parts with product , an early appearance of complex numbers. René Descartes (1637) called such numbers "imaginary".
Further reading
- I. M. Gelfand and A. Shen, Algebra (1993) — includes a careful treatment of quadratic equations and their graphs.
- Jens Høyrup, Lengths, Widths, Surfaces: A Portrait of Old Babylonian Algebra and Its Kin (2002) — how the Babylonian "cut-and-paste" methods worked.
- Eleanor Robson, Mathematics in Ancient Iraq: A Social History (2008).
- Paul J. Nahin, An Imaginary Tale: The Story of (1998) — how square roots of negative numbers became respectable.