Skip to content
Greatest Common Factor and Factor by Grouping

Greatest Common Factor and Factor by Grouping

By the end of this section, you will be able to: find the greatest common factor of two or more expressions, factor the greatest common factor from a polynomial, and factor by grouping.

Find the greatest common factor of two or more expressions

Earlier we multiplied factors together to get a product. Now we will be reversing this process; we will start with a product and then break it down into its factors. Splitting a product into factors is called factoring.

factors87=56productfactors2x(x+3)=2x2+6xproduct \begin{array}{lrcl} \text{factors} & 8 \cdot 7 &=& 56 \quad \text{product} \\[4pt] \text{factors} & 2x(x + 3) &=& 2x^2 + 6x \quad \text{product} \end{array}

We have learned how to factor numbers to find the least common multiple (LCM) of two or more numbers. Now we will factor expressions and find the greatest common factor of two or more expressions. The method we use is similar to what we used to find the LCM.

Greatest common factor. The greatest common factor (GCF) of two or more expressions is the largest expression that is a factor of all the expressions.

First we’ll find the GCF of two numbers.

Example. Find the GCF of 5454 and 3636.

Factor each coefficient into primes, and line up the common factors in columns. We circle the 22, 33, and 33 that are shared by both numbers:

54=2233336=2233 \begin{array}{rcl} 54 &=& 2 \cdot \phantom{2 \cdot {}} 3 \cdot 3 \cdot 3 \\ 36 &=& 2 \cdot 2 \cdot 3 \cdot 3 \end{array}

Bring down the common factors that both share — one 22, and two 3s3\text{s} — then multiply:

GCF=233=18\text{GCF} = 2 \cdot 3 \cdot 3 = 18

The GCF of 5454 and 3636 is 1818. Notice that, because the GCF is a factor of both numbers, 5454 and 3636 can be written as multiples of 1818:

54=18336=18254 = 18 \cdot 3 \qquad 36 = 18 \cdot 2

Find the GCF of 48 and 80.

Find the GCF of 18 and 40.

We summarize the steps we use to find the GCF below.

Find the greatest common factor (GCF) of two expressions.

  1. Factor each coefficient into primes. Write all variables with exponents in expanded form.
  2. List all factors — matching common factors in a column. In each column, circle the common factors.
  3. Bring down the common factors that all expressions share.
  4. Multiply the factors.

In the first example, the GCF was a constant. In the next two examples, we will get variables in the greatest common factor.

Example. Find the greatest common factor of 27x327x^3 and 18x418x^4.

Factor each coefficient into primes and write the variables with exponents in expanded form. Circle the common factors in each column, then bring them down:

27x3=333xxx18x4=233xxxx \begin{array}{rcl} 27x^3 &=& 3 \cdot 3 \cdot 3 \cdot x \cdot x \cdot x \\ 18x^4 &=& 2 \cdot 3 \cdot 3 \cdot x \cdot x \cdot x \cdot x \end{array}

The shared factors are two 3s3\text{s} and three xsx\text{s}, so:

GCF=33xxx=9x3\text{GCF} = 3 \cdot 3 \cdot x \cdot x \cdot x = 9x^3

The GCF of 27x327x^3 and 18x418x^4 is 9x39x^3.

Find the GCF of 12x212x^2 and 18x318x^3.

Find the GCF of 16y216y^2 and 24y324y^3.

Example. Find the GCF of 4x2y4x^2 y and 6xy36xy^3.

Factor each coefficient into primes and expand the variables. The shared factors are one 22, one xx, and one yy:

4x2y=22xxy6xy3=23xyyy \begin{array}{rcl} 4x^2 y &=& 2 \cdot 2 \cdot x \cdot x \cdot y \\ 6xy^3 &=& 2 \cdot 3 \cdot x \cdot y \cdot y \cdot y \end{array} GCF=2xy=2xy\text{GCF} = 2 \cdot x \cdot y = 2xy

The GCF of 4x2y4x^2 y and 6xy36xy^3 is 2xy2xy.

Find the GCF of 6ab46ab^4 and 8a2b8a^2 b.

Find the GCF of 9m5n29m^5 n^2 and 12m3n12m^3 n.

We can also find the greatest common factor of more than two expressions.

Example. Find the GCF of 21x321x^3, 9x29x^2, and 15x15x.

Factor each coefficient into primes and expand the variables. Every term shares one 33 and one xx:

21x3=37xxx9x2=33xx15x=35x \begin{array}{rcl} 21x^3 &=& 3 \cdot 7 \cdot x \cdot x \cdot x \\ 9x^2 &=& 3 \cdot 3 \cdot x \cdot x \\ 15x &=& 3 \cdot 5 \cdot x \end{array} GCF=3x=3x\text{GCF} = 3 \cdot x = 3x

The GCF of 21x321x^3, 9x29x^2, and 15x15x is 3x3x.

Find the greatest common factor of 25m425m^4, 35m335m^3, and 20m220m^2.

Find the greatest common factor of 14x314x^3, 70x270x^2, and 105x105x.

Factor the greatest common factor from a polynomial

Just like in arithmetic, where it is sometimes useful to represent a number in factored form (for example, 1212 as 262 \cdot 6 or 343 \cdot 4), in algebra it can be useful to represent a polynomial in factored form. One way to do this is by finding the GCF of all the terms. Remember, we multiply a polynomial by a monomial using the Distributive Property:

factors2(x+7)2x+27=2x+14product \begin{array}{lrcl} \text{factors} & 2(x + 7) && \\[4pt] & 2 \cdot x + 2 \cdot 7 &=& 2x + 14 \quad \text{product} \end{array}

Now we will start with a product, like 2x+142x + 14, and end with its factors, 2(x+7)2(x + 7). To do this we apply the Distributive Property “in reverse.”

Distributive Property. If aa, bb, cc are real numbers, then

a(b+c)=ab+acandab+ac=a(b+c)a(b + c) = ab + ac \qquad \text{and} \qquad ab + ac = a(b + c)

The form on the left is used to multiply. The form on the right is used to factor.

So how do you use the Distributive Property to factor a polynomial? You just find the GCF of all the terms and write the polynomial as a product!

Example. Factor 4x+124x + 12.

First find the GCF of all the terms. Since 4x=22x4x = 2 \cdot 2 \cdot x and 12=22312 = 2 \cdot 2 \cdot 3, the GCF is 22=42 \cdot 2 = 4. Rewrite each term as a product using the GCF, then use the “reverse” Distributive Property to factor:

4x+12=4x+43=4(x+3) \begin{array}{rcl} 4x + 12 &=& 4 \cdot x + 4 \cdot 3 \\ &=& 4(x + 3) \end{array}

Check by multiplying: 4(x+3)=4x+43=4x+124(x + 3) = 4 \cdot x + 4 \cdot 3 = 4x + 12. ✓

Factor: 6a+246a + 24.

Factor: 2b+142b + 14.

Factor the greatest common factor from a polynomial.

  1. Find the GCF of all the terms of the polynomial.
  2. Rewrite each term as a product using the GCF.
  3. Use the “reverse” Distributive Property to factor the expression.
  4. Check by multiplying the factors.

We use “factor” as both a noun and a verb. As a noun, 77 is a factor of 1414. As a verb, we factor 33 from 3a+33a + 3.

Example. Factor 5a+55a + 5.

The GCF of 5a5a and 55 is 55. Rewrite each term as a product using the GCF, then factor:

5a+5=5a+51=5(a+1) \begin{array}{rcl} 5a + 5 &=& 5 \cdot a + 5 \cdot 1 \\ &=& 5(a + 1) \end{array}

Check by multiplying: 5(a+1)=5a+51=5a+55(a + 1) = 5 \cdot a + 5 \cdot 1 = 5a + 5. ✓

Factor: 14x+1414x + 14.

Factor: 12p+1212p + 12.

The expressions in the next example have several factors in common. Remember to write the GCF as the product of all the common factors.

Example. Factor 12x6012x - 60.

Since 12x=223x12x = 2 \cdot 2 \cdot 3 \cdot x and 60=223560 = 2 \cdot 2 \cdot 3 \cdot 5, the GCF is 223=122 \cdot 2 \cdot 3 = 12. Rewrite each term and factor:

12x60=12x125=12(x5) \begin{array}{rcl} 12x - 60 &=& 12 \cdot x - 12 \cdot 5 \\ &=& 12(x - 5) \end{array}

Check by multiplying: 12(x5)=12x125=12x6012(x - 5) = 12 \cdot x - 12 \cdot 5 = 12x - 60. ✓

Factor: 18u3618u - 36.

Factor: 30y6030y - 60.

Now we’ll factor the greatest common factor from a trinomial. We start by finding the GCF of all three terms.

Example. Factor 4y2+24y+284y^2 + 24y + 28.

Find the GCF of all three terms. Since 4y2=22yy4y^2 = 2 \cdot 2 \cdot y \cdot y, 24y=2223y24y = 2 \cdot 2 \cdot 2 \cdot 3 \cdot y, and 28=22728 = 2 \cdot 2 \cdot 7, the GCF is 22=42 \cdot 2 = 4. Rewrite each term as a product using the GCF, then factor:

4y2+24y+28=4y2+46y+47=4(y2+6y+7) \begin{array}{rcl} 4y^2 + 24y + 28 &=& 4 \cdot y^2 + 4 \cdot 6y + 4 \cdot 7 \\ &=& 4(y^2 + 6y + 7) \end{array}

Check by multiplying: 4(y2+6y+7)=4y2+24y+284(y^2 + 6y + 7) = 4y^2 + 24y + 28. ✓

Factor: 5x225x+155x^2 - 25x + 15.

Factor: 3y212y+273y^2 - 12y + 27.

Example. Factor 5x325x25x^3 - 25x^2.

The GCF of 5x35x^3 and 25x225x^2 is 5x25x^2. Rewrite each term and factor:

5x325x2=5x2x5x25=5x2(x5) \begin{array}{rcl} 5x^3 - 25x^2 &=& 5x^2 \cdot x - 5x^2 \cdot 5 \\ &=& 5x^2(x - 5) \end{array}

Check by multiplying: 5x2(x5)=5x2x5x25=5x325x25x^2(x - 5) = 5x^2 \cdot x - 5x^2 \cdot 5 = 5x^3 - 25x^2. ✓

Factor: 2x3+12x22x^3 + 12x^2.

Factor: 6y315y26y^3 - 15y^2.

Example. Factor 21x39x2+15x21x^3 - 9x^2 + 15x.

In a previous example we found the GCF of 21x321x^3, 9x29x^2, and 15x15x to be 3x3x. Rewrite each term using the GCF, then factor:

21x39x2+15x=3x7x23x3x+3x5=3x(7x23x+5) \begin{array}{rcl} 21x^3 - 9x^2 + 15x &=& 3x \cdot 7x^2 - 3x \cdot 3x + 3x \cdot 5 \\ &=& 3x(7x^2 - 3x + 5) \end{array}

Check by multiplying: 3x(7x23x+5)=21x39x2+15x3x(7x^2 - 3x + 5) = 21x^3 - 9x^2 + 15x. ✓

Factor: 20x310x2+14x20x^3 - 10x^2 + 14x.

Factor: 24y312y220y24y^3 - 12y^2 - 20y.

Example. Factor 8m312m2n+20mn28m^3 - 12m^2 n + 20mn^2.

Since 8m3=222mmm8m^3 = 2 \cdot 2 \cdot 2 \cdot m \cdot m \cdot m, 12m2n=223mmn12m^2 n = 2 \cdot 2 \cdot 3 \cdot m \cdot m \cdot n, and 20mn2=225mnn20mn^2 = 2 \cdot 2 \cdot 5 \cdot m \cdot n \cdot n, the GCF is 22m=4m2 \cdot 2 \cdot m = 4m. Rewrite each term and factor:

8m312m2n+20mn2=4m2m24m3mn+4m5n2=4m(2m23mn+5n2) \begin{array}{rcl} 8m^3 - 12m^2 n + 20mn^2 &=& 4m \cdot 2m^2 - 4m \cdot 3mn + 4m \cdot 5n^2 \\ &=& 4m(2m^2 - 3mn + 5n^2) \end{array}

Check by multiplying: 4m(2m23mn+5n2)=8m312m2n+20mn24m(2m^2 - 3mn + 5n^2) = 8m^3 - 12m^2 n + 20mn^2. ✓

Factor: 9xy2+6x2y2+21y39xy^2 + 6x^2 y^2 + 21y^3.

Factor: 3p36p2q+9pq33p^3 - 6p^2 q + 9pq^3.

When the leading coefficient is negative, we factor the negative out as part of the GCF.

Example. Factor 8y24-8y - 24.

When the leading coefficient is negative, the GCF will be negative. Ignoring the signs of the terms, the GCF of 8y8y and 2424 is 88. Since the expression 8y24-8y - 24 has a negative leading coefficient, we use 8-8 as the GCF. Rewrite each term and factor:

8y24=8y+(8)3=8(y+3) \begin{array}{rcl} -8y - 24 &=& -8 \cdot y + (-8) \cdot 3 \\ &=& -8(y + 3) \end{array}

Check by multiplying: 8(y+3)=8y+(8)3=8y24-8(y + 3) = -8 \cdot y + (-8) \cdot 3 = -8y - 24. ✓

Factor: 16z64-16z - 64.

Factor: 9y27-9y - 27.

Example. Factor 6a2+36a-6a^2 + 36a.

The leading coefficient is negative, so the GCF is negative, 6a-6a. Rewrite each term using the GCF, then factor:

6a2+36a=6aa+(6a)(6)=6a(a6) \begin{array}{rcl} -6a^2 + 36a &=& -6a \cdot a + (-6a)(-6) \\ &=& -6a(a - 6) \end{array}

Check by multiplying: 6a(a6)=6aa+(6a)(6)=6a2+36a-6a(a - 6) = -6a \cdot a + (-6a)(-6) = -6a^2 + 36a. ✓

Factor: 4b2+16b-4b^2 + 16b.

Factor: 7a2+21a-7a^2 + 21a.

The greatest common factor doesn’t have to be a monomial — it can be a binomial too.

Example. Factor 5q(q+7)6(q+7)5q(q + 7) - 6(q + 7).

The GCF here is the binomial q+7q + 7. Factor it out from each term:

5q(q+7)6(q+7)=(q+7)(5q6)5q(q + 7) - 6(q + 7) = (q + 7)(5q - 6)

Check on your own by multiplying.

Factor: 4m(m+3)7(m+3)4m(m + 3) - 7(m + 3).

Factor: 8n(n4)+5(n4)8n(n - 4) + 5(n - 4).

Factor by grouping

When there is no common factor of all the terms of a polynomial, look for a common factor in just some of the terms. When there are four terms, a good way to start is by separating the polynomial into two parts with two terms in each part. Then look for the GCF in each part. If the polynomial can be factored, you will find a common factor emerges from both parts.

(Not all polynomials can be factored. Just like some numbers are prime, some polynomials are prime.)

Example. Factor xy+3y+2x+6xy + 3y + 2x + 6.

There is no greatest common factor of all four terms, so let’s separate the first two terms from the second two terms. Factor the GCF from each group: from xy+3yxy + 3y we factor yy, and from 2x+62x + 6 we factor 22:

xy+3y+2x+6=y(x+3)+2(x+3)=(x+3)(y+2) \begin{array}{rcl} xy + 3y + 2x + 6 &=& y(x + 3) + 2(x + 3) \\ &=& (x + 3)(y + 2) \end{array}

Notice that each term now has a common factor of (x+3)(x + 3), so we factor it out. Check by multiplying: (x+3)(y+2)=xy+2x+3y+6(x + 3)(y + 2) = xy + 2x + 3y + 6. ✓

Factor: xy+8y+3x+24xy + 8y + 3x + 24.

Factor: ab+7b+8a+56ab + 7b + 8a + 56.

Factor by grouping.

  1. Group terms with common factors.
  2. Factor out the common factor in each group.
  3. Factor the common factor from the expression.
  4. Check by multiplying the factors.

Example. Factor x2+3x2x6x^2 + 3x - 2x - 6.

There is no GCF in all four terms. Separate the polynomial into two parts: x2+3xx^2 + 3x and 2x6-2x - 6. Factor the GCF from both parts, being careful with the signs when factoring the GCF from the last two terms:

x2+3x2x6=x(x+3)2(x+3)=(x+3)(x2) \begin{array}{rcl} x^2 + 3x - 2x - 6 &=& x(x + 3) - 2(x + 3) \\ &=& (x + 3)(x - 2) \end{array}

Check on your own by multiplying.

Factor: x2+2x5x10x^2 + 2x - 5x - 10.

Factor: y2+4y7y28y^2 + 4y - 7y - 28.

Key terms

factoring — splitting a product into the factors that multiply to give it. greatest common factor (GCF) — the largest expression that is a factor of each of two or more given expressions. factor by grouping — a method for factoring a four-term polynomial by grouping terms with common factors, factoring the GCF from each group, and then factoring out the common binomial.


This section is adapted from Elementary Algebra 2e, Section 7.1: Greatest Common Factor and Factor by Grouping by Lynn Marecek, MaryAnne Anthony-Smith, and Andrea Honeycutt Mathis, © OpenStax, licensed under CC BY-NC-SA 4.0. Access the original for free at openstax.org. Changes: recast the GCF prime-factorization tables and worked factoring examples as prose with display equality chains, and stated each GCF as a bring-down product; omitted the Be Prepared quiz, Self Check checklist, media links, and end-of-section exercises; and converted the practice problems (“Try Its”) into interactive exercises with instant feedback.