Sub topic 7
The quadratic formula
This chapter assumes you can expand brackets, simplify square roots, and write a quadratic in standard form, ax² + bx + c = 0 with a ≠ 0. It also assumes you can solve simple quadratics by factorisation. The formula handles every case that factorisation struggles with: large coefficients, non-integer roots, and equations that do not factor over the integers.
Where the formula comes from
The formula comes from completing the square. Start with ax² + bx + c = 0 and divide by a:
x² + (b/a)x + c/a = 0
Add and subtract (b/2a)² to make a perfect square:
(x + b/2a)² = b²/4a² − c/a = (b² − 4ac) / 4a²
Take the square root of both sides, keeping both signs:
x + b/2a = ± √(b² − 4ac) / 2a
Solving for x gives the quadratic formula:
x = (−b ± √(b² − 4ac)) / 2a
The expression under the root, D = b² − 4ac, is the discriminant. The next chapter studies it in detail. Here it decides one thing: whether the formula gives real numbers.
Using the formula step by step
- Rewrite the equation in standard form, with everything on one side and zero on the other.
- Read off a, b and c with their signs.
- Compute D = b² − 4ac.
- If D < 0, there are no real roots. Otherwise compute the two values (−b + √D) / 2a and (−b − √D) / 2a.
- Substitute each root back into the original equation to check it.
Worked example 1: integer roots
Solve x² − 5x + 6 = 0.
Here a = 1, b = −5, c = 6.
D = (−5)² − 4(1)(6) = 25 − 24 = 1
x = (5 ± 1) / 2, so x = 3 or x = 2.
Factorisation gives the same answer: (x − 2)(x − 3) = 0.
Worked example 2: irrational roots
Solve 2x² − 4x − 3 = 0.
a = 2, b = −4, c = −3.
D = 16 − 4(2)(−3) = 16 + 24 = 40
x = (4 ± √40) / 4 = (4 ± 2√10) / 4 = (2 ± √10) / 2
Notice that √40 = 2√10 was simplified before dividing. The roots are 1 ± √10/2, about 2.58 and −0.58. No integer pair multiplies to −6 and adds to −4, so factorisation would not have worked.
Worked example 3: a repeated root
Solve 4x² − 12x + 9 = 0.
D = 144 − 144 = 0, so x = 12 / 8 = 3/2. There is one root, counted twice. The left side is (2x − 3)².
Worked example 4: no real roots
Solve x² + 2x + 5 = 0.
D = 4 − 20 = −16 < 0. A negative number has no real square root, so the equation has no real solution. In CAT, "no real roots" is a valid answer, and a question may ask how many real solutions exist.
The formula as a program
The following function applies the formula after checking the sign of D. It returns an empty list when there are no real roots. When the roots are equal, the set removes the duplicate, so one value comes back.
import math
def quadratic_roots(a, b, c):
d = b * b - 4 * a * c
if d < 0:
return [] # no real roots
r = math.sqrt(d)
return sorted({(-b - r) / (2 * a), (-b + r) / (2 * a)})
# x^2 - 5x + 6 = 0 has roots 2 and 3
print(quadratic_roots(1, -5, 6))This prints [2.0, 3.0]. Floating-point arithmetic means a discriminant that is mathematically zero can come out as a tiny positive or negative number for non-integer inputs. Integer coefficients, as in CAT, avoid this problem.
The paired-roots picture
The two roots are placed symmetrically about −b/2a, because the formula has the form centre ± offset:
- The centre is −b / 2a.
- The offset is √D / 2a.
This is why the roots of x² − 5x + 6 sit at 2.5 ± 0.5. It also shows that the graph of a quadratic is symmetric about the vertical line x = −b/2a, which the chapter on extrema uses.
Choosing between factorisation and the formula
| Situation | Better method |
|---|---|
| Small integer coefficients and an obvious factor pair | Factorisation |
| Large or fractional coefficients | Formula |
| Roots are irrational | Formula |
| You only need to know whether real roots exist | Compute D only |
| You only need the sum or product of roots | Use −b/a and c/a, no solving |
A good CAT habit is to compute D first. If D is a perfect square, the roots are rational and factorisation will work, so you can choose whichever is faster. If D is not a perfect square, the roots are irrational, so stop searching for integer factors.
Edge cases and common errors
- Not in standard form. For 3x² = 5x − 2, first move terms to get 3x² − 5x + 2 = 0. Then a = 3, b = −5, c = 2, and D = 25 − 24 = 1, so x = (5 ± 1) / 6 gives 1 and 2/3.
- Missing terms. In x² − 9 = 0, b = 0. The formula still works: D = 36, x = ±6/2 = ±3. For ax² + bx = 0, c = 0, and the roots are 0 and −b/a.
- Dividing only part of the numerator. In (4 ± 2√10) / 4, you must divide both terms: 1 ± √10/2. Writing 4 ± √10/2 is wrong.
- Forgetting that a multiplies the denominator. The denominator is 2a, not 2 alone, and not just a.
- Leading coefficient zero. If a = 0 the equation is linear, and dividing by 2a is undefined. A question that says "the equation ax² + bx + c = 0 has two roots" implies a ≠ 0.
- Parameter questions. When the equation contains an unknown such as k, treat D as an expression in k. For x² + kx + 9 = 0 to have equal roots, require k² − 36 = 0, so k = ±6.
Worked example 5: a fractional equation
Solve x + 1/x = 5/2, for x ≠ 0.
Multiply through by 2x: 2x² + 2 = 5x, so 2x² − 5x + 2 = 0.
D = 25 − 16 = 9, so x = (5 ± 3) / 4, which gives 2 or 1/2.
Both are non-zero, so both are valid. The roots are reciprocals, as expected, because the product of the roots is c/a = 1.
Speed techniques
- Even b. If b is even, write b = 2k. Then x = (−k ± √(k² − ac)) / a. For x² − 6x + 4 = 0 this gives k = −3, so x = 3 ± √(9 − 4) = 3 ± √5, with smaller numbers throughout.
- Coefficients summing to zero. If a + b + c = 0, then x = 1 is a root and the other root is c/a. For 5x² − 8x + 3 = 0, the roots are 1 and 3/5.
- If a − b + c = 0, then x = −1 is a root and the other root is −c/a.
- Sanity check with the sum. The two roots must add to −b/a. If your roots do not, you have made an arithmetic error.
The following code checks the sum-and-product relationships for x² − 5x + 6 = 0, which is a quick way to confirm roots from the formula.
a, b, c = 1, -5, 6
roots = [2, 3]
assert sum(roots) == -b / a # sum of roots = -b/a
assert roots[0] * roots[1] == c / a # product of roots = c/a
print("sum =", sum(roots), "product =", roots[0] * roots[1])Summary of key points
- The formula x = (−b ± √(b² − 4ac)) / 2a solves every quadratic with a ≠ 0.
- D = b² − 4ac decides whether real roots exist and whether they are repeated.
- Simplify the root and cancel carefully, and always keep the sign of b.
- Check the roots with their sum, −b/a, and product, c/a.
Exercise
For the equation 3x² − 7x + 2 = 0, find the discriminant and both roots, then confirm them using the sum and product of roots.
Show answer
a = 3, b = −7, c = 2. D = 49 − 24 = 25. x = (7 ± 5) / 6, so x = 2 or x = 1/3. Check: the sum is 2 + 1/3 = 7/3, which equals −b/a = 7/3. The product is 2 × 1/3 = 2/3, which equals c/a = 2/3.
Exercise
For what values of k does x² − 2kx + (k + 6) = 0 have exactly one real root?
Show answer
One repeated root needs D = 0. D = 4k² − 4(k + 6) = 4k² − 4k − 24 = 0, so k² − k − 6 = 0, which factors as (k − 3)(k + 2) = 0. Hence k = 3 or k = −2.
Exercise
Solve 2x² + 3x − 1 = 0 and give the roots in simplest radical form.
Show answer
a = 2, b = 3, c = −1. D = 9 + 8 = 17. x = (−3 ± √17) / 4. Since 17 is not a perfect square, the roots are irrational and cannot be found by integer factorisation.