Sub topic 5
Factoring x^2 + bx + c
What this chapter assumes
You should already be comfortable with multiplying two binomials using FOIL, with the distributive property, and with adding and multiplying signed integers. You should also have read the previous chapters. They cover pulling out a greatest common factor (GCF), which is the first step of the strategy used here.
A trinomial of the form x^2 + bx + c has a leading coefficient of 1. This is called a monic trinomial. Here b is the coefficient of the x term and c is the constant term. The goal is to rewrite it as a product of two binomials, (x + p)(x + q), where p and q are integers.
Why the method works
Factoring reverses multiplication, so start by multiplying two binomials with the same leading x:
(x + p)(x + q) = x^2 + qx + px + pq
= x^2 + (p + q)x + pqCompare this with x^2 + bx + c. The coefficients must match term by term:
- The constant term c equals the product pq.
- The middle coefficient b equals the sum p + q.
So factoring a monic trinomial means finding two integers whose product is c and whose sum is b. You are solving a small number puzzle, and the numbers you find become the constants in the binomials.
For x^2 + 5x + 6, you need a product of 6 and a sum of 5. The integer pairs with product 6 are 1 and 6, 2 and 3, -1 and -6, and -2 and -3. Only 2 and 3 add to 5, so:
x^2 + 5x + 6 = (x + 2)(x + 3)Reading the signs first
The signs of b and c tell you what kind of pair to look for before you list anything. This removes about half the candidates.
| Sign of c | Sign of b | What p and q look like | Example |
|---|---|---|---|
| Positive | Positive | Both positive | x^2 + 7x + 12 = (x + 3)(x + 4) |
| Positive | Negative | Both negative | x^2 - 7x + 12 = (x - 3)(x - 4) |
| Negative | Positive | Opposite signs, the larger number is positive | x^2 + 2x - 15 = (x + 5)(x - 3) |
| Negative | Negative | Opposite signs, the larger number is negative | x^2 - 3x - 28 = (x + 4)(x - 7) |
The reasoning is as follows. A positive product means p and q have the same sign. A same-sign pair adds to something with that same sign, so the sign of b tells you which one. A negative product means the signs differ. The sum then takes the sign of whichever number has the larger absolute value, so b's sign tells you which number is larger in absolute value.
A worked example with a systematic search
Factor x^2 + 2x - 15.
Here c = -15 is negative, so p and q have opposite signs. Since b = 2 is positive, the positive number is the larger one in absolute value. List every pair with product -15 and check the sums:
| p | q | p + q |
|---|---|---|
| 1 | -15 | -14 |
| -1 | 15 | 14 |
| 3 | -5 | -2 |
| -3 | 5 | 2 |
The pair -3 and 5 gives the sum 2. Therefore:
x^2 + 2x - 15 = (x - 3)(x + 5)Check by multiplying: x^2 + 5x - 3x - 15 = x^2 + 2x - 15. The result matches the original.
You do not need to write out the full table every time. With practice you scan the factor pairs of |c| and look for the pair whose sum or difference equals |b|. The table is still the safest method when c has many factors.
A larger case is x^2 - 2x - 120. The constant is negative, so the signs are opposite. The factor pairs of 120 are 1 and 120, 2 and 60, 3 and 40, 4 and 30, 5 and 24, 6 and 20, 8 and 15, and 10 and 12. We need a difference of 2, and the pair 10 and 12 has one. Since b is negative, the larger number (12) takes the negative sign:
x^2 - 2x - 120 = (x + 10)(x - 12)The procedure
Edge cases
A GCF comes first
If the terms share a common factor, remove it before looking for the pair. Otherwise the numbers are larger and the search is harder.
3x^3 - 15x^2 + 12x
= 3x(x^2 - 5x + 4)
= 3x(x - 1)(x - 4)The pair for x^2 - 5x + 4 has product 4 and sum -5, so it is -1 and -4. Keep the 3x in the final answer. A common mistake is to drop the GCF after factoring the trinomial inside the parentheses.
A negative leading coefficient
If the leading coefficient is -1, as in -x^2 + 5x - 6, factor out -1 first so the leading coefficient becomes 1:
-x^2 + 5x - 6 = -(x^2 - 5x + 6) = -(x - 2)(x - 3)A zero constant term
When c = 0, the trinomial is really a binomial, and the pair is 0 and b. For example, x^2 - 5x = x(x - 5). This is the same as factoring out the GCF x.
Two variables
The same pattern works when the trinomial has a second variable. In x^2 + 3xy + 2y^2, the coefficients 3 and 2 play the roles of b and c, and each constant becomes a multiple of y:
x^2 + 3xy + 2y^2 = (x + y)(x + 2y)Check: x^2 + 2xy + xy + 2y^2 = x^2 + 3xy + 2y^2.
Perfect squares are a special case
When the pair has two equal numbers, the result is a squared binomial. For x^2 + 6x + 9, the numbers 3 and 3 give the product 9 and the sum 6, so x^2 + 6x + 9 = (x + 3)^2. A later chapter treats this as a pattern in its own right.
Trinomials that do not factor
Consider x^2 + 4x + 5. The integer pairs with product 5 are 1 and 5, and -1 and -5. Their sums are 6 and -6. Neither equals 4, so no integer pair works. This trinomial is prime over the integers, which means it cannot be written as a product of two lower-degree polynomials with integer coefficients.
Common errors
- Using the wrong sign for the sum. Students find a pair with product c and the right absolute sum, but give the numbers the wrong signs. For x^2 - 7x + 12, the pair 3 and 4 has the right product, but the sum is +7. Both numbers must be negative.
- Matching the product but not the sum. The pair 1 and 6 has product 6, but it does not factor x^2 + 5x + 6, because 1 + 6 = 7. Always test both conditions.
- Forgetting the GCF. If you skip the first step, you may think a polynomial like 2x^2 + 10x + 12 is not monic and give up. Factored, it is 2(x^2 + 5x + 6) = 2(x + 2)(x + 3).
- Dropping the GCF from the answer. After factoring the inner trinomial, write the GCF back in front of the product.
- Not checking. Multiplying the binomials back out takes about ten seconds and catches sign errors.
Checking with code
You can write the search as a short function. It tries every divisor p of c, computes q = c / p, and returns the pair whose sum is b.
def find_pair(b, c):
"""Return integers (p, q) with p + q == b and p * q == c, or None."""
if c == 0:
return (0, b)
for p in range(-abs(c), abs(c) + 1):
if p != 0 and c % p == 0:
q = c // p
if p + q == b:
return (p, q)
return None
for b, c in [(5, 6), (-7, 12), (2, -15), (4, 5)]:
print(b, c, find_pair(b, c))This prints 5 6 (2, 3), -7 12 (-4, -3), 2 -15 (-3, 5), and 4 5 None. The last line matches the hand analysis above: x^2 + 4x + 5 is prime.
The SymPy library does the same work and can also verify your answer by expanding it:
from sympy import symbols, factor, expand
x = symbols('x')
expr = x**2 + 2*x - 15
factored = factor(expr)
print(factored)
print(expand(factored) == expr)
print(factor(x**2 + 4*x + 5))The first line prints the factored form, which is (x - 3)(x + 5). The second prints True. The third prints `x2 + 4x + 5` unchanged, because SymPy returns a prime polynomial as it is.
Practice
Exercise
Factor x^2 + 9x + 20 and check your answer by multiplying.
Show answer
Both signs are positive, so look for two positive numbers with product 20 and sum 9. The pair 4 and 5 works. So x^2 + 9x + 20 = (x + 4)(x + 5). Check: x^2 + 5x + 4x + 20 = x^2 + 9x + 20.
Exercise
Factor x^2 - 11x + 28.
Show answer
The product is positive and the sum is negative, so both numbers are negative. The pair -4 and -7 has product 28 and sum -11. So x^2 - 11x + 28 = (x - 4)(x - 7).
Exercise
Factor x^2 - x - 42.
Show answer
The product is negative, so the signs differ. We need a difference of 1 between numbers whose product is 42, and the pair 6 and 7 works. Because b = -1 is negative, the larger number takes the minus sign: 6 and -7. So x^2 - x - 42 = (x + 6)(x - 7).
Exercise
Factor completely: 2x^3 + 6x^2 - 20x.
Show answer
The GCF is 2x, so the expression is 2x(x^2 + 3x - 10). For the trinomial we need product -10 and sum 3, which is -2 and 5. The complete factorization is 2x(x - 2)(x + 5).
Exercise
Use b^2 - 4c to decide whether x^2 + 6x + 4 factors over the integers. Then check your decision by listing the factor pairs of 4.
Show answer
b^2 - 4c = 36 - 16 = 20, which is not a perfect square, so the trinomial is prime over the integers. The pairs with product 4 are 1 and 4, 2 and 2, -1 and -4, and -2 and -2. Their sums are 5, 4, -5, and -4, and none equals 6.
Exercise
Factor x^2 - 4xy - 12y^2.
Show answer
Treat -4 as b and -12 as c. The pair 2 and -6 has product -12 and sum -4. So x^2 - 4xy - 12y^2 = (x + 2y)(x - 6y). Check: x^2 - 6xy + 2xy - 12y^2 = x^2 - 4xy - 12y^2.