Sub topic 4
Deriving the quadratic formula
This chapter derives the quadratic formula from scratch by completing the square. It assumes you can solve linear equations, expand and factor simple polynomials, simplify square roots, and read a coordinate graph. By the end you should be able to reproduce the derivation, explain why each step is valid, and spot the places where it breaks down.
Why derive it at all
You can use the quadratic formula without knowing where it comes from. Knowing the derivation still helps in three ways:
- It shows the formula works for every quadratic, not just the ones you tested.
- It explains the structure of the formula. The discriminant, the "±", and the division by 2a each come from a specific step.
- It gives you a method that still works when you forget the formula.
The earlier chapters covered standard form, the meaning of a root, and completing the square on numeric examples. This chapter applies completing the square to the general equation, with letters in place of numbers.
Starting point
The general quadratic in standard form is:
ax² + bx + c = 0, with a ≠ 0.
The condition a ≠ 0 matters. If a were 0, the equation would be linear: bx + c = 0. The derivation divides by a, so it needs a to be nonzero.
We work over the real numbers for the coefficients a, b and c. Square roots of negative numbers will appear at the end, and the later chapter on complex roots handles them.
The idea: make a perfect square
A perfect-square trinomial has the form (x + h)² = x² + 2hx + h². The equation x² = k can be solved by taking square roots. An equation of the form (x + h)² = k can be solved the same way.
Completing the square rewrites x² + (something)x as (x + h)² minus a leftover constant. The goal is to get x to appear exactly once, inside a squared bracket.
Here is a numeric warm-up. Solve x² + 6x + 5 = 0.
- Move the constant: x² + 6x = −5.
- Take half of the x-coefficient: 6 / 2 = 3. Square it: 9.
- Add 9 to both sides: x² + 6x + 9 = 4.
- Factor the left side: (x + 3)² = 4.
- Take square roots: x + 3 = ±2.
- Solve: x = −1 or x = −5.
The derivation repeats these six steps with a, b and c in place of the numbers.
The derivation, step by step
Step 1: Divide by a
Start with ax² + bx + c = 0. Because a ≠ 0, divide every term by a:
x² + (b/a)x + c/a = 0
The coefficient of x² is now 1, which is what the completing-the-square recipe needs.
Step 2: Move the constant term
Subtract c/a from both sides:
x² + (b/a)x = −c/a
Step 3: Add the square of half the x-coefficient
The x-coefficient is b/a. Half of it is b/(2a). Its square is b²/(4a²). Add that to both sides:
x² + (b/a)x + b²/(4a²) = −c/a + b²/(4a²)
The left side is now a perfect square, because (x + b/(2a))² = x² + 2·(b/(2a))·x + b²/(4a²) = x² + (b/a)x + b²/(4a²).
Step 4: Write the left side as a square
(x + b/(2a))² = −c/a + b²/(4a²)
Step 5: Combine the right side over one denominator
The common denominator is 4a². Rewrite −c/a as −4ac/(4a²):
(x + b/(2a))² = (b² − 4ac) / (4a²)
The numerator b² − 4ac is the discriminant. It appears here without being put in by hand. It is simply what is left over after completing the square.
Step 6: Take square roots of both sides
Every positive number has two square roots, one positive and one negative. So:
x + b/(2a) = ± √(b² − 4ac) / (2a)
The denominator is √(4a²) = |2a|. Because the "±" covers both signs, writing 2a instead of |2a| gives the same set of answers. This is why the formula does not need absolute value bars.
Step 7: Isolate x
Subtract b/(2a) from both sides:
x = −b/(2a) ± √(b² − 4ac) / (2a)
Combine over the common denominator:
x = (−b ± √(b² − 4ac)) / (2a)
This is the quadratic formula.
The derivation at a glance
What each part of the formula means
The derivation shows where each piece comes from.
| Piece | Origin |
|---|---|
| −b / (2a) | The shift from completing the square. It is the x-coordinate of the parabola's vertex. |
| √(b² − 4ac) | The square root of the leftover term. The sign of b² − 4ac decides whether it is real. |
| ± | Taking the square root of both sides gives two signs. |
| 2a | Half the x-coefficient was b/(2a), and the root has denominator √(4a²). |
The formula can be read as x = (center) ± (spread). The center −b/(2a) is the midpoint of the two roots. The spread √(b² − 4ac)/(2a) is how far each root sits from that midpoint. This reading explains why the sum of the roots is −b/a, which a later chapter uses.
Checking the derivation with a worked example
Use the formula on 2x² − 4x − 6 = 0. Here a = 2, b = −4, c = −6.
- Discriminant: b² − 4ac = 16 − 4(2)(−6) = 16 + 48 = 64.
- Square root: √64 = 8.
- Substitute: x = (4 ± 8) / 4.
- The two roots: x = 12/4 = 3 and x = −4/4 = −1.
Now run the derivation on the same equation, in order:
- Divide by 2: x² − 2x − 3 = 0.
- Move the constant: x² − 2x = 3.
- Half of −2 is −1, and its square is 1. Add 1: x² − 2x + 1 = 4.
- Factor: (x − 1)² = 4.
- Roots: x − 1 = ±2, so x = 3 or x = −1.
Both routes agree. You can confirm this in code:
import math
def solve_quadratic(a, b, c):
if a == 0:
raise ValueError("a must be nonzero")
d = b * b - 4 * a * c
if d > 0:
r = math.sqrt(d)
return [(-b - r) / (2 * a), (-b + r) / (2 * a)]
if d == 0:
return [-b / (2 * a)]
return []
print(solve_quadratic(2, -4, -6)) # [-1.0, 3.0]The function is the formula written as code. The a == 0 check guards the first step of the derivation, and the three branches on d correspond to the three cases for √(b² − 4ac).
Edge cases and gotchas
When a is zero
If a = 0, Step 1 divides by zero and the derivation fails. The equation is linear, with the single root x = −c/b when b ≠ 0. The code above raises an error instead of returning a wrong answer.
When the discriminant is zero
The square root term vanishes, and the "±" gives the same value twice: x = −b/(2a). The parabola touches the x-axis at its vertex. This is a repeated root, which is also called a double root.
When the discriminant is negative
Step 6 needs the square root of a negative number. No real number squares to a negative, so there are no real roots. The derivation still holds if you allow complex numbers, where √(−k) = i√k. For example, x² + 2x + 5 = 0 has discriminant −16 and roots −1 ± 2i. A later chapter covers this.
When coefficients are fractions or decimals
The derivation is valid for any real coefficients. Fractions and decimals only make the arithmetic harder. A common approach is to multiply the whole equation by a common denominator first, which keeps the roots unchanged because both sides of the equation are scaled equally.
Why the same roots survive Step 1
Dividing by a is a reversible operation, since you can multiply by a to undo it. A reversible step on both sides of an equation never adds or loses solutions. The same holds for adding the same quantity to both sides. Taking a square root is the one step that needs care, because it is why the "±" must be written. Dropping it would lose half the answers.
Common errors in the derivation
- Forgetting to add the new term to both sides. If you add b²/(4a²) only on the left, the equation is no longer balanced.
- Squaring b/(2a) incorrectly. The square is b²/(4a²). Writing b²/(2a²) or b²/4a is wrong because the 2 in the denominator is squared too.
- Dropping the "±". The equation y² = k has two solutions, not one.
- Placing the 2a under only part of the numerator. The whole of −b ± √(b² − 4ac) is divided by 2a.
- Treating √(b² − 4ac) as b − 2√(ac). A square root does not distribute over subtraction.
Another way to see it
Completing the square has a geometric reading. The expression x² + (b/a)x is the area of a square with side x plus a rectangle with sides x and b/a. Split the rectangle into two strips of width b/(2a) and put one on each of two sides of the square. The picture is almost a larger square, missing only a small corner with area (b/(2a))². Adding that corner completes the square, which is where the name comes from.
Summary
- The quadratic formula comes from completing the square on ax² + bx + c = 0.
- The derivation needs a ≠ 0 because it divides by a.
- The discriminant b² − 4ac appears as the numerator after the right side is combined.
- The "±" comes from taking a square root, and the formula gives all the roots the original equation has.
- The formula is exact for real coefficients. It gives real roots when b² − 4ac ≥ 0 and complex roots otherwise.
Exercise
Use the derivation steps (not the final formula) to solve 3x² + 12x + 9 = 0. Then identify which part of your work corresponds to the discriminant b² − 4ac.
Show answer
Divide by 3: x² + 4x + 3 = 0. Move the constant: x² + 4x = −3. Half of 4 is 2, and its square is 4, so add 4 to both sides: x² + 4x + 4 = 1. Factor: (x + 2)² = 1. Take roots: x + 2 = ±1, so x = −1 or x = −3. For this equation b² − 4ac = 144 − 108 = 36. The right side before simplifying is 36/(4·9) = 1, so the discriminant is the numerator of the right-hand side, and its square root is 6, giving x + 2 = ±6/6.
Exercise
In Step 3 of the derivation, why is b²/(4a²) the right quantity to add, and not b²/(2a²)?
Show answer
The x-coefficient after dividing by a is b/a. Half of it is b/(2a). The number added to complete the square is the square of that half, (b/(2a))² = b²/(4a²). The 2 in the denominator is squared as well, which gives 4, not 2.
Exercise
Suppose a student drops the "±" in Step 6 and writes only x = (−b + √(b² − 4ac)) / (2a). For x² − 5x + 6 = 0, which root do they miss?
Show answer
Here a = 1, b = −5, c = 6, so b² − 4ac = 25 − 24 = 1 and √1 = 1. The "+" version gives (5 + 1)/2 = 3. The student misses the "−" root, (5 − 1)/2 = 2. The full solution set is {2, 3}.
Exercise
Why does the derivation not need absolute value bars around 2a when √(4a²) is taken, even though √(4a²) = |2a|?
Show answer
The "±" in front of the square root already covers both signs. Replacing |2a| by 2a or by −2a only swaps which sign gives which root, so the set of two roots is the same.