Sub topic 7
Solving equations by factoring
This chapter assumes you can expand binomials, solve linear equations, and factor the pieces covered earlier in this tutorial: common factors, trinomials with leading coefficient 1, trinomials with leading coefficient other than 1, and the special patterns (difference of squares and perfect square trinomials). Here those skills become a complete procedure for solving ax^2 + bx + c = 0.
The working model
Factoring turns one quadratic equation into two linear equations. The idea rests on the zero product property: if A * B = 0, then A = 0 or B = 0 (or both). A product of numbers is zero only when at least one factor is zero.
So the method has three stages:
- Rewrite the equation as (expression) = 0.
- Factor the expression into linear factors.
- Set each factor equal to 0 and solve each linear equation.
The zero on one side is essential. If a product equals 6, knowing that A * B = 6 tells you nothing about A or B individually. Many pairs multiply to 6. Only zero forces a factor to be zero.
Step 1: Get standard form
Collect everything on one side, so the equation reads ax^2 + bx + c = 0. Do this even when the equation looks partly factored.
For example, x(x + 2) = 15 is not ready. You cannot conclude x = 15 or x + 2 = 15. Expand and move the constant:
x^2 + 2x - 15 = 0
Then factor: (x + 5)(x - 3) = 0, so x = -5 or x = 3.
Step 2: Factor completely
Work in this order, because it avoids most dead ends:
- Pull out the greatest common factor (GCF) of all terms.
- If two terms remain, look for a difference of squares: a^2 - b^2 = (a - b)(a + b).
- If three terms remain, look for a perfect square trinomial: a^2 + 2ab + b^2 = (a + b)^2.
- Otherwise, find two integers that add to b and multiply to c (when a = 1). When a is not 1, find two integers that add to b and multiply to ac, then split the middle term and factor by grouping.
Here is a case where a is not 1. Solve 6x^2 + x - 2 = 0. Here ac = -12 and b = 1. The integers 4 and -3 add to 1 and multiply to -12. Split the middle term and group:
6x^2 + 4x - 3x - 2 = 2x(3x + 2) - 1(3x + 2) = (3x + 2)(2x - 1)
Setting each factor to zero gives 3x + 2 = 0, so x = -2/3, and 2x - 1 = 0, so x = 1/2.
Notice that the roots are -p/a and -q/a, where p and q are the two split integers. Here p = 4, q = -3, and a = 6, giving -4/6 = -2/3 and 3/6 = 1/2. This is why the split step works, and it is how the code later in this chapter finds roots.
Step 3: Set each factor to zero
Each factor of the form (mx + n) gives x = -n/m. Write both solutions, even when they are equal.
A GCF that contains the variable
Solve 3x^2 - 12x = 0. Factor out 3x:
3x(x - 4) = 0
There are two linear conditions from the variable-containing factors: x = 0 or x = 4. The constant factor 3 never equals zero, so it contributes no solution.
The tempting shortcut is to divide both sides by x to get 3x - 12 = 0. That gives only x = 4 and loses x = 0. Dividing by a variable expression is only legal if that expression cannot be zero, so factor instead.
A repeated root
Solve x^2 - 6x + 9 = 0. This is a perfect square trinomial:
(x - 3)^2 = 0
Both factors are x - 3, so the only solution is x = 3. It is called a repeated root, or a root of multiplicity 2. Graphically, the parabola touches the x-axis at one point and does not cross it.
Difference of squares
Solve 4x^2 - 25 = 0. Here 4x^2 = (2x)^2 and 25 = 5^2, so:
(2x - 5)(2x + 5) = 0
This gives x = 5/2 or x = -5/2.
Compare x^2 + 25 = 0. A sum of squares does not factor over the real numbers, and the equation has no real solutions.
Checking your answer
Substitute each root into the original equation, not into your rearranged or factored version. If you made a mistake while rearranging, checking the factored form will not catch it.
Check x = -5 in x(x + 2) = 15: (-5)(-3) = 15. Correct. Check x = 3: 3 * 5 = 15. Correct.
Common errors
| Error | Example | Fix |
|---|---|---|
| Applying the zero product property when the right side is not 0 | (x - 2)(x + 1) = 4, so x = 6 or x = 5 | Expand and move 4 to the left first |
| Dividing out a variable factor | x^2 = 5x, so x = 5 | Write x^2 - 5x = 0, then x(x - 5) = 0, so x = 0 or x = 5 |
| Sign error in the root | (x + 3)(x - 1) = 0, so x = 3 or x = -1 | Solve x + 3 = 0 and x - 1 = 0, giving x = -3 or x = 1 |
| Stopping after one factor | (x - 4)^2 = 0 treated as two roots | Report one root, x = 4, and note it is repeated |
| Forgetting the common factor | 2x^2 - 8x + 6 = 0 treated as hard | Factor out 2, giving 2(x - 1)(x - 3) = 0 |
| Wrong split of the middle term | 2x^2 + 7x + 3 split as 5 and 2 | The integers must multiply to ac = 6 and add to 7, so use 6 and 1 |
When factoring does not work
Many quadratics have real roots but do not factor over the integers. For x^2 - 2 = 0, no pair of integers adds to 0 and multiplies to -2, yet the roots are the real numbers sqrt(2) and -sqrt(2). Failure to factor over the integers tells you nothing about whether real roots exist. It only means this method is the wrong tool, and the next chapters give methods that always work.
Two other edge cases:
- If c = 0, the equation factors immediately by pulling out x: ax^2 + bx = x(ax + b) = 0, so x = 0 or x = -b/a.
- If the equation has fractional or decimal coefficients, multiply through by the common denominator first so that you factor with integers.
A factoring solver in Python
This function automates the split-the-middle-term search. It looks for integers p and q with p + q = b and p * q = ac, then returns the roots -p/a and -q/a as exact fractions. It returns None when no such integers exist.
from fractions import Fraction
def solve_by_factoring(a, b, c):
"""Solve a*x^2 + b*x + c = 0 for integers a, b, c (a != 0).
Returns a sorted tuple of distinct roots as Fractions,
or None if the quadratic does not factor over the integers.
"""
if a == 0:
raise ValueError("a must be nonzero")
ac = a * c
for p in range(-abs(ac), abs(ac) + 1):
q = b - p
if p * q == ac:
return tuple(sorted({Fraction(-p, a), Fraction(-q, a)}))
return None
def show(roots):
if roots is None:
print("not factorable over the integers")
else:
print(", ".join(str(r) for r in roots))
show(solve_by_factoring(1, -5, 6)) # 2, 3
show(solve_by_factoring(6, 1, -2)) # -2/3, 1/2
show(solve_by_factoring(1, -4, 4)) # 2 (repeated root)
show(solve_by_factoring(3, -12, 0)) # 0, 4
show(solve_by_factoring(1, 0, -2)) # not factorable over the integers
show(solve_by_factoring(1, 0, 1)) # not factorable over the integersThe result for (1, 0, 1) is correct for a different reason than the result for (1, 0, -2). The first equation has no real roots at all, while the second has the irrational roots plus and minus sqrt(2). The function reports both as "not factorable" and cannot tell them apart. Telling them apart is the job of the discriminant, which comes up when we derive the quadratic formula.
Higher-degree equations
The zero product property works for any number of factors. For example, x^3 - 9x = 0 factors as x(x - 3)(x + 3) = 0, giving x = 0, x = 3, or x = -3. Factor out x first, then recognize the difference of squares. This is the same procedure applied one more time.
Exercise
Solve 2x^2 = 8x. Explain why dividing both sides by 2x is a mistake.
Show answer
Move everything to one side: 2x^2 - 8x = 0. Factor out 2x: 2x(x - 4) = 0. Then 2x = 0 gives x = 0, and x - 4 = 0 gives x = 4. The solutions are x = 0 and x = 4. Dividing by 2x assumes x is not 0, so it removes the solution x = 0 and leaves only x = 4.
Exercise
Solve (x + 1)(x - 4) = 6. Then check both roots in the original equation.
Show answer
Expand: x^2 - 3x - 4 = 6, so x^2 - 3x - 10 = 0. Two integers that add to -3 and multiply to -10 are -5 and 2, so (x - 5)(x + 2) = 0 and x = 5 or x = -2. Check x = 5: (6)(1) = 6. Check x = -2: (-1)(-6) = 6. Both work.
Exercise
Solve 10x^2 + 13x - 3 = 0 by splitting the middle term.
Show answer
Here ac = -30 and b = 13. The integers 15 and -2 add to 13 and multiply to -30. Split: 10x^2 + 15x - 2x - 3 = 5x(2x + 3) - 1(2x + 3) = (2x + 3)(5x - 1). So x = -3/2 or x = 1/5.