Sub topic 6
Factoring ax^2 + bx + c when a is not 1
This chapter assumes you can factor out a greatest common factor (GCF), factor x^2 + bx + c, and expand a product of two binomials. If any of those is shaky, review the earlier chapters first.
Why a leading coefficient other than 1 changes the problem
With a = 1, you look for two numbers that multiply to c and add to b. When a is not 1, the factors look like (px + q)(rx + s), and expanding gives:
(px + q)(rx + s) = pr x^2 + (ps + qr) x + qs
So the three coefficients of ax^2 + bx + c must satisfy:
- a = pr
- b = ps + qr
- c = qs
The middle coefficient now mixes two cross products, ps and qr. That is why a single "multiply to c, add to b" search no longer works. This chapter covers two methods that handle it: the ac method (split the middle term and group) and trial and error with the factor pairs of a and c.
Always take out the GCF first
If all three terms share a common factor, remove it before anything else. It makes the numbers smaller and often reduces a to 1.
Consider 12x^2 + 14x - 6. Every coefficient is even, so:
12x^2 + 14x - 6 = 2(6x^2 + 7x - 3)
Now you only need to factor 6x^2 + 7x - 3. The 2 stays in front of the final answer. Forgetting to carry it along is one of the most common errors.
Method 1: the ac method
The idea is to rewrite the middle term bx as the sum of two terms, so the four-term expression can be factored by grouping.
- Compute the product ac.
- Find two integers m and n with m * n = ac and m + n = b.
- Rewrite bx as mx + nx.
- Factor the first two terms and the last two terms separately, each by pulling out its GCF.
- The two groups now share a binomial. Factor it out.
Worked example 1: 6x^2 + 7x - 3
Here a = 6, b = 7, c = -3, so ac = -18. You need two integers that multiply to -18 and add to 7. The pair 9 and -2 works, since 9 * (-2) = -18 and 9 + (-2) = 7.
Rewrite and group:
6x^2 + 9x - 2x - 3 = 3x(2x + 3) - 1(2x + 3) = (3x - 1)(2x + 3)
Notice that the second group needs a -1 pulled out, not +1, so that the leftover binomial matches (2x + 3). Check by expanding: 6x^2 + 9x - 2x - 3 = 6x^2 + 7x - 3. ✓
So the full factorization of the earlier example is 12x^2 + 14x - 6 = 2(3x - 1)(2x + 3).
Worked example 2: 2x^2 - 7x + 3
Here ac = 6 and b = -7. The pair must multiply to 6 and add to -7, so both are negative: -6 and -1.
2x^2 - 6x - x + 3 = 2x(x - 3) - 1(x - 3) = (2x - 1)(x - 3)
Finding the pair quickly
The signs of m and n follow from the signs of ac and b.
| Sign of ac | Sign of b | Signs of m and n |
|---|---|---|
| positive | positive | both positive |
| positive | negative | both negative |
| negative | positive | opposite, the larger absolute value is positive |
| negative | negative | opposite, the larger absolute value is negative |
List the factor pairs of |ac| in order and check which pair has the right sum or difference. Stop when you find it.
The order of the split does not matter
Writing 6x^2 - 2x + 9x - 3 instead gives 2x(3x - 1) + 3(3x - 1) = (2x + 3)(3x - 1). It is the same answer with the factors in a different order.
Method 2: trial and error with factor pairs
You can also guess the shape (px + q)(rx + s) directly. List the ways to write a as pr and c as qs, then test which combination makes ps + qr equal to b.
For 6x^2 + 7x - 3, the options for a are 1 6 and 2 3. The options for c = -3 are 1 (-3), (-1) 3, 3 (-1), and (-3) 1. Try (2x + 3)(3x - 1): the cross products are 2x (-1) = -2x and 3 3x = 9x, which sum to 7x. ✓
Trial and error is fast once you have practice and the coefficients are small. The ac method is slower per step but always terminates with a definite answer, so use it when the numbers are large or the guesses are not landing.
When there is no factorization
Some trinomials do not factor over the integers. For 2x^2 + 3x + 4, we have ac = 8. The factor pairs of 8 are 1 and 8, and 2 and 4, with sums 9 and 6. With both numbers negative the sums are -9 and -6. None equals 3, so the trinomial does not factor with integer coefficients.
Another example is 3x^2 + 2x - 2, where ac = -6. The pairs are (1, -6), (-1, 6), (2, -3), and (-2, 3), with sums -5, 5, -1, and 1. None equals 2, so it does not factor either.
An exhaustive search of the pairs is a proof, but it can be tedious. A faster test uses the discriminant b^2 - 4ac. The trinomial factors over the integers only if the discriminant is a perfect square. For 3x^2 + 2x - 2 it is 4 + 24 = 28, which is not a perfect square. For 2x^2 + 3x + 4 it is 9 - 32 = -23, which is negative.
Automating the search
The function below finds integers p, q, r, s with ax^2 + bx + c = (px + q)(rx + s). It tries every divisor p of a and every divisor q of c, then tests the cross-product condition from the start of the chapter. It requires a nonzero and c nonzero. If c is 0, factor out x instead.
def split_middle(a, b, c):
"""Return integers (m, n) with m*n == a*c and m+n == b, or None."""
ac = a * c
for m in range(-abs(ac), abs(ac) + 1):
n = b - m
if m * n == ac:
return m, n
return None
def factor_general(a, b, c):
"""Return (p, q, r, s) with a*x^2 + b*x + c = (p*x + q)(r*x + s), or None.
Requires a != 0 and c != 0.
"""
for p in range(1, abs(a) + 1):
if a % p != 0:
continue
r = a // p
for q in range(-abs(c), abs(c) + 1):
if q == 0 or c % q != 0:
continue
s = c // q
if p * s + q * r == b:
return p, q, r, s
return None
print(split_middle(6, 7, -3)) # (-2, 9)
print(split_middle(2, -7, 3)) # (-6, -1)
print(factor_general(6, 7, -3)) # (2, 3, 3, -1) -> (2x + 3)(3x - 1)
print(factor_general(2, -7, 3)) # (1, -3, 2, -1) -> (x - 3)(2x - 1)
print(factor_general(2, 3, 4)) # NoneThe None result for 2x^2 + 3x + 4 agrees with the manual search above.
Common errors
- Dropping the GCF. If you factor 12x^2 + 14x - 6 and write only (3x - 1)(2x + 3), the answer expands to 6x^2 + 7x - 3, not the original. The factor 2 must stay.
- Sign slips when grouping. When the second group starts with a negative term, pull out a negative factor so the binomials match. Writing -2x - 3 as -1(2x + 3) is right. Writing it as 1(2x - 3) is not.
- Using the wrong target sum. The pair for the ac method must add to b, not to c or to ac.
- Forgetting to divide back. In the ac method you do not divide by a at the end. Grouping produces the final binomials directly.
- Skipping the check. Expanding your answer takes seconds and catches nearly every error above.
Exercises
Exercise
Factor 4x^2 - 4x - 15 using the ac method.
Show answer
Here ac = -60 and b = -4. The pair -10 and 6 multiplies to -60 and adds to -4. Then 4x^2 - 10x + 6x - 15 = 2x(2x - 5) + 3(2x - 5) = (2x + 3)(2x - 5). Expanding gives 4x^2 - 10x + 6x - 15 = 4x^2 - 4x - 15, which confirms it.
Exercise
Factor completely: 18x^2 + 3x - 6.
Show answer
Take out the GCF 3 first: 3(6x^2 + x - 2). For 6x^2 + x - 2, ac = -12 and b = 1, so the pair is 4 and -3. Then 6x^2 + 4x - 3x - 2 = 2x(3x + 2) - 1(3x + 2) = (2x - 1)(3x + 2). The full answer is 3(2x - 1)(3x + 2).
Exercise
Use the discriminant to decide whether 5x^2 + 4x + 1 factors over the integers.
Show answer
The discriminant is b^2 - 4ac = 16 - 20 = -4. It is negative, so it is not a perfect square, and the trinomial does not factor over the integers. It also has no real roots.