Polynomials & Factoring

Factoring by Grouping: A Step-by-Step Method That Works

Factoring by grouping rewrites a four-term polynomial as a product: split it into two pairs, pull the greatest common factor out of each pair, then pull out the binomial both pairs now share. In symbols, ax+ay+bx+by=(a+b)(x+y)ax+ay+bx+by=(a+b)(x+y).

ax+ay+bx+by=(a+b)(x+y)ax+ay+bx+by=(a+b)(x+y)

Try it with your numbers

Show every step

The method works because that shared binomial is hiding in plain sight. Use the solver above on any four-term polynomial to see every step, then read on for the parts that decide whether you get the answer: what to do with negative signs, how to reorder terms, and a quick test that tells you whether grouping can work at all.

How does factoring by grouping work?

Grouping is the distributive property run backward. Expand (a+b)(x+y)(a+b)(x+y) by treating (x+y)(x+y) as a single block:

(a+b)(x+y)=a(x+y)+b(x+y)=ax+ay+bx+by(a+b)(x+y)=a(x+y)+b(x+y)=ax+ay+bx+by

Four terms appear because nothing combines. The FOIL method is the same expansion with a name for each of the four products. Grouping starts from the finished four terms and recovers the two pieces a(x+y)a(x+y) and b(x+y)b(x+y).

The payoff is the shared block. After you pull a GCF out of each pair, you hold two terms that are the same binomial multiplied by different coefficients. That binomial then factors out of both, and what is left over, a+ba+b, becomes the second factor. If the two binomials differ, that pairing has not exposed any structure, and you need a different pairing.

Quick check

Which four-term polynomial is the expansion of (2x+3)(y+5)(2x+3)(y+5)?

How to factor by grouping, step by step

Follow this order every time:

  1. Pull out any GCF shared by all four terms.
  2. Split what remains into two pairs.
  3. Factor the GCF out of each pair, choosing a negative GCF when that makes the leftover binomials match.
  4. Pull out the shared binomial.
  5. Check whether either factor can be factored further.
Take the GCF first

In 4x3−12x2−16x+484x^3-12x^2-16x+48, the 44 belongs to all four terms. Skipping it still works, but leaves a factor that keeps factoring, and you may stop too early.

Take x3+2x2−9x−18x^3+2x^2-9x-18. No factor is shared by all four terms, so split into pairs and factor each one. The second pair has a negative leading coefficient, so pull out −9-9 rather than 99:

x3+2x2−9x−18=x2(x+2)−9(x+2)=(x2−9)(x+2)x^3+2x^2-9x-18=x^2(x+2)-9(x+2)=(x^2-9)(x+2)

The first factor is a difference of squares, which factors again into (x−3)(x+3)(x-3)(x+3). The complete answer is (x−3)(x+3)(x+2)(x-3)(x+3)(x+2). If the cubic had come with a common factor, factoring out the GCF would have been the first move.

What if the two binomials are opposites?

Wrong versus right grouping where 3−2x is rewritten as negative 2x−3 so binomials match
Factoring out −2 instead of 2 turns (3−2x) into (2x−3), so grouping succeeds.

This is the trap that costs the most points. Take 6x2−9x+6−4x6x^2-9x+6-4x. Pairing in the given order and factoring each pair gives:

3x(2x−3)+2(3−2x)3x(2x-3)+2(3-2x)

The binomials look different, so many students decide grouping has failed. They are opposites: 3−2x=−(2x−3)3-2x=-(2x-3). Factor out −2-2 instead of 22 from the second pair, and the binomials match:

3x(2x−3)−2(2x−3)=(3x−2)(2x−3)3x(2x-3)-2(2x-3)=(3x-2)(2x-3)

Expanding confirms it: 6x2−9x−4x+66x^2-9x-4x+6 is the original. The habit to build is to write each pair so its binomial starts with the same variable term, positive. When a pair ends with a leftover that reads (3−2x)(3-2x), flip it by factoring out a negative.

What to do when the first grouping fails

Sometimes the given order cannot work. Consider 4xy+21+6x+14y4xy+21+6x+14y. The first pair, 4xy4xy and 2121, shares no factor except 11, so there is nothing to pull out. Do not give up. Reorder so that terms with a shared factor sit together:

4xy+6x+14y+21=2x(2y+3)+7(2y+3)=(2x+7)(2y+3)4xy+6x+14y+21=2x(2y+3)+7(2y+3)=(2x+7)(2y+3)

The usual repair is to swap the two middle terms, as above. Another is to pair by variable, putting every term that contains xx together. Several reorderings may succeed, and they all produce the same factors, only listed in a different order.

Try this: Reorder 2xy+15+6x+5y2xy+15+6x+5y so the pairs share a factor, then factor it. Expand your answer to confirm. (Answer: (2x+5)(y+3)(2x+5)(y+3).)

Can you tell if grouping will work before you start?

Area model of (2x+7)(2y+3) showing diagonal terms both multiply to 84xy
In 4xy+6x+14y+21, the diagonal products 4xy·21 and 14y·6x both equal 84xy.

Yes, and the test saves a lot of trial and error. If four terms came from (p+q)(r+s)(p+q)(r+s), they are prpr, psps, qrqr and qsqs. The two opposite corners multiply to the same thing as the other two:

(pr)(qs)=(ps)(qr)(pr)(qs)=(ps)(qr)

So look for two terms whose product equals the product of the other two. Those two belong in the first and last positions. In 4xy+21+6x+14y4xy+21+6x+14y, the products are 4xy⋅21=84xy4xy\cdot21=84xy and 6x⋅14y=84xy6x\cdot14y=84xy. They match, which is why the reordering above succeeded.

Now try x3+x2+x+2x^3+x^2+x+2. The possible products are x3⋅x2=x5x^3\cdot x^2=x^5 against x⋅2=2xx\cdot2=2x, then x3⋅x=x4x^3\cdot x=x^4 against x2⋅2=2x2x^2\cdot2=2x^2, then x3⋅2=2x3x^3\cdot2=2x^3 against x2⋅x=x3x^2\cdot x=x^3. Nothing matches, so no ordering will group. When that happens:

  • Test for rational roots with the Rational Root Theorem. The candidates here are ±1\pm1 and ±2\pm2, and none gives zero, so this cubic does not factor over the integers.
  • Do not assume failure means “prime”. The polynomial x3−2x2−5x+6x^3-2x^2-5x+6 also fails the test, yet x=1x=1 is a root, and the Factor Theorem then gives (x−1)(x+2)(x−3)(x-1)(x+2)(x-3).

Quick check

In 12xy+4x+15y+512xy+4x+15y+5, which term has a product with 12xy12xy equal to 4x⋅15y4x\cdot15y?

Can you factor trinomials by grouping?

Yes. A trinomial ax2+bx+cax^2+bx+c is what you get when the two middle terms of a four-term expansion combine. Splitting the middle term pulls them apart again. You need two numbers mm and nn with mn=acmn=ac and m+n=bm+n=b. That condition is exactly the product test from the previous section, applied to ax2ax^2, mxmx, nxnx and cc.

Factor 6x2+11x−106x^2+11x-10. Here ac=6⋅(−10)=−60ac=6\cdot(-10)=-60. The pair that multiplies to −60-60 and adds to 1111 is 1515 and −4-4. Split the middle term, then group:

6x2+15x−4x−10=3x(2x+5)−2(2x+5)=(3x−2)(2x+5)6x^2+15x-4x-10=3x(2x+5)-2(2x+5)=(3x-2)(2x+5)

Expanding gives 6x2+15x−4x−106x^2+15x-4x-10, which collapses back to 6x2+11x−106x^2+11x-10. This is the AC method, and it is the reliable option when guessing at factoring trinomials turns into a guessing game. The box method organizes the same numbers in a grid.

The split order is free

Writing 6x2−4x+15x−106x^2-4x+15x-10 instead gives 2x(3x−2)+5(3x−2)=(2x+5)(3x−2)2x(3x-2)+5(3x-2)=(2x+5)(3x-2), the same answer. Pick whichever order makes the first pair easy.

Factoring by grouping with cubics, two variables and 6 terms

The pattern does not care about the exponent. A degree 3 polynomial with four terms is the most common case, and x3+3x2+4x+12x^3+3x^2+4x+12 groups into (x2+4)(x+3)(x^2+4)(x+3) in two lines. With two variables, the shared block is simply a binomial in both letters, as in 4xy+6x+14y+214xy+6x+14y+21 above.

Fractions are easier than they look. Pull out the fraction first: 12x3+x2+3x+6=12(x3+2x2+6x+12)=12(x2+6)(x+2)\tfrac12x^3+x^2+3x+6=\tfrac12(x^3+2x^2+6x+12)=\tfrac12(x^2+6)(x+2). Six terms group into three pairs or two triples. For example, xa+xb+xc+ya+yb+yc=x(a+b+c)+y(a+b+c)=(x+y)(a+b+c)xa+xb+xc+ya+yb+yc=x(a+b+c)+y(a+b+c)=(x+y)(a+b+c).

Sometimes the right grouping is three terms against one. In x2+2x+1−y2x^2+2x+1-y^2, the first three terms are a perfect square trinomial, so the expression equals (x+1)2−y2(x+1)^2-y^2. That is a difference of squares, and it factors as (x+1−y)(x+1+y)(x+1-y)(x+1+y). Four terms is a signal to try pairs first, but not the only option.

How to check a factoring by grouping answer

The slow check is to multiply your factors back out with multiplying polynomials and compare. The fast check is to substitute a number. A correct factoring must give the same value on both sides for every xx.

Test (x−3)(x+3)(x+2)(x-3)(x+3)(x+2) against x3+2x2−9x−18x^3+2x^2-9x-18 at x=1x=1. The polynomial gives 1+2−9−18=−241+2-9-18=-24. The product gives (−2)(4)(3)=−24(-2)(4)(3)=-24. They agree. Try x=2x=2 as well: the polynomial gives 8+8−18−18=−208+8-18-18=-20 and the product gives (−1)(5)(4)=−20(-1)(5)(4)=-20.

One agreeing value is evidence, not proof, because an error can happen to cancel at a single number. Two different values make a slip very unlikely. Avoid values that make a factor zero, since both sides then read 00 and tell you little. Finally, confirm that no factor you wrote can still be factored.

Quick check

Does (x2+5)(x+2)(x^2+5)(x+2) equal x3+2x2−5x−10x^3+2x^2-5x-10? Test at x=1x=1.

Where factoring by grouping is used

The main use is solving equations. Once a cubic is a product, the zero-product rule turns it into three small equations:

x3+2x2−9x−18=0  ⇒  (x−3)(x+3)(x+2)=0  ⇒  x=3, −3, −2x^3+2x^2-9x-18=0 \;\Rightarrow\; (x-3)(x+3)(x+2)=0 \;\Rightarrow\; x=3,\,-3,\,-2

It also simplifies rational expressions. The fraction x3+2x2−9x−18x2−x−6\dfrac{x^3+2x^2-9x-18}{x^2-x-6} has the denominator x2−x−6=(x−3)(x+2)x^2-x-6=(x-3)(x+2). After factoring the top, (x−3)(x-3) and (x+2)(x+2) cancel, leaving x+3x+3 for x≠3,−2x\ne3,-2.

Grouping also sits inside the AC method for quadratics, so most trinomial work with a leading coefficient above 11 uses it, even when it is not named. To build speed, work through factoring practice problems that mix grouping with the other methods, and use the order GCF, then count terms, then grouping or a special pattern.

Practice problems

0 of 5 solved

  1. Factor by grouping: x3+3x2+4x+12x^3+3x^2+4x+12

  2. Factor by grouping: 5x3−10x2−3x+65x^3-10x^2-3x+6

  3. Factor by grouping: 3xy+10+6x+5y3xy+10+6x+5y

  4. Factor 8x2+14x−158x^2+14x-15 by splitting the middle term.

  5. Factor completely: 4x3−12x2−16x+484x^3-12x^2-16x+48

Common questions

What is factoring by grouping?

It is a method that factors a four-term polynomial by splitting it into two pairs, pulling the GCF out of each pair, and then pulling out the binomial the pairs share. It reverses the expansion (a+b)(x+y)=ax+ay+bx+by(a+b)(x+y)=ax+ay+bx+by.

What do you do if the binomials do not match after grouping?

First check whether they are opposites, such as (x−3)(x-3) and (3−x)(3-x), and factor out a −1-1 from one pair to fix it. If that fails, reorder the terms (swapping the two middle terms is the usual fix) and group again.

Can you factor by grouping with three terms?

Yes, for a trinomial ax2+bx+cax^2+bx+c you split the middle term into two terms whose product is acac and whose sum is bb. That gives four terms, which you then group. This is called the AC method.

Does the order of the terms matter when factoring by grouping?

It matters for the grouping, not for the final answer. A bad order produces pairs with no common binomial, but any order that does work gives the same factors.

How do you know a polynomial cannot be factored by grouping?

For four terms that come from two binomials, the product of one pair of terms must equal the product of the other two. If no pairing satisfies that, grouping cannot work. The polynomial may still factor by another method, such as finding a rational root.

Should you take out the GCF before grouping?

Yes. A factor common to all four terms should come out first, because it keeps the numbers small and prevents a final answer that can still be factored.

Up next