Sub topic 2
Solving quadratics by factorisation
This chapter assumes you can expand brackets, work with fractions and square roots, and apply the sign rules for negative numbers.
A quadratic equation has the form ax² + bx + c = 0, where a ≠ 0. A root is a value of x that makes the equation true. A quadratic has at most two roots.
Solving by factorisation
Rewrite the expression as a product of two brackets, then set each bracket to zero. This works because a product is zero only when one factor is zero.
For x² − 5x + 6 = 0, the factors are (x − 2)(x − 3) = 0, so x = 2 or x = 3.
The quadratic formula
When factors are hard to spot, use the quadratic formula: x = (−b ± √(b² − 4ac)) / (2a). It works for every quadratic.
import math
def quadratic_roots(a, b, c):
d = b * b - 4 * a * c
if d < 0:
return []
r = math.sqrt(d)
return sorted({(-b - r) / (2 * a), (-b + r) / (2 * a)})
print(quadratic_roots(1, -5, 6)) # [2.0, 3.0]The discriminant and the nature of roots
The discriminant is D = b² − 4ac. It tells you the nature of the roots without solving the equation.
| Discriminant | Nature of roots |
|---|---|
| D > 0 | Two distinct real roots |
| D = 0 | One repeated real root |
| D < 0 | No real roots |
Exercise
Without solving, state the nature of the roots of 2x² + 4x + 5 = 0.
Show answer
D = 4² − 4(2)(5) = 16 − 40 = −24, which is less than 0, so there are no real roots.
Sum and product of roots
If α and β are the roots of ax² + bx + c = 0, then α + β = −b/a and αβ = c/a. For x² − 5x + 6 = 0, the sum is 5 and the product is 6, which matches the roots 2 and 3.
a, b, c = 1, -5, 6
roots = [2, 3]
assert sum(roots) == -b / a
assert roots[0] * roots[1] == c / a
print("sum =", sum(roots), "product =", roots[0] * roots[1])Exercise
For 2x² − 6x + 4 = 0, find α + β and αβ without solving.
Show answer
α + β = −(−6)/2 = 3 and αβ = 4/2 = 2.