Expanding and Factoring Expressions

Learning goals

  • Expand a product so the factor reaches every term
  • Multiply two expressions by pairing every term with every term
  • Treat FOIL as a name for four products, not a general rule
  • Factor by pulling out the greatest common factor
  • Check any factoring by re-expanding it

Expanding a factor across every term

To expand a product is to multiply it out into a sum, using the distributive law. You met the law for a sum of two terms, a(b+c)=ab+aca(b + c) = ab + ac, but nothing about it stops at two terms. The factor out front reaches every term inside the parentheses, however many there are.

Why a(b+c+d)=ab+ac+ada(b + c + d) = ab + ac + ad#

The distributive law is stated for a sum of two terms, a(b+c)=ab+aca(b + c) = ab + ac, but a sum can have more terms than that. To see that the factor still reaches each one, group the extra terms and apply the two-term law twice. Treat b+c+db + c + d as (b+c)+d(b + c) + d, a sum of the single quantity b+cb + c and the term dd:

a((b+c)+d)=a(b+c)+ad.a\big((b + c) + d\big) = a(b + c) + ad.

That is the two-term law with b+cb + c playing the role of the first term. Now distribute across the remaining pair:

a(b+c)+ad=ab+ac+ad.a(b + c) + ad = ab + ac + ad.

The factor aa has multiplied every term inside. The same grouping works for a sum of any length, so a factor outside a parenthesis multiplies each term within it, one at a time. That is the whole content of expanding: no term is ever skipped.

The factor out front need not be a bare number. It can carry a sign or a variable, and the rule does not change: multiply it against each term, following the sign and exponent rules you already know. When two powers of the same base meet, their exponents add, so x⋅x=x2x \cdot x = x^2 and x⋅x2=x3x \cdot x^2 = x^3. A negative factor flips the sign of each term it lands on, exactly as a leading minus did in the last lesson. The flip happens because a minus sign in front is the factor −1-1 waiting to be distributed.

Worked example 1 Expand three products

In each product, multiply the outside factor against every inside term, keeping each sign.

Distributing a negative number across a difference, the sign of each term flips:

−3(x−4)=(−3)(x)+(−3)(−4)=−3x+12.-3(x - 4) = (-3)(x) + (-3)(-4) = -3x + 12.

Distributing a single variable, the powers add where the variable meets itself:

x(2x+3)=x⋅2x+x⋅3=2x2+3x.x(2x + 3) = x \cdot 2x + x \cdot 3 = 2x^2 + 3x.

Distributing a term that carries both a coefficient and a power, handle the numbers and the exponents separately:

2x2(3x−5)=2x2⋅3x−2x2⋅5=6x3−10x2.2x^2(3x - 5) = 2x^2 \cdot 3x - 2x^2 \cdot 5 = 6x^3 - 10x^2.

In each case the factor reached both terms. The second term is never left behind.

One case deserves a second look, because the factor is hidden. Subtracting a whole group, as in a−(b+c)a - (b + c), is the same as multiplying that group by −1-1 and adding, so every term inside changes sign:

a−(b+c)=a−b−c,−(a−b)=−a+b.a - (b + c) = a - b - c, \qquad -(a - b) = -a + b.

This is the leading-minus rule from the last lesson seen as one more case of expanding, with the hidden factor being −1-1.

Check your understanding

Expand −2x(3x−4)-2x(3x - 4).

Answer choices

Multiplying two expressions

Multiplying two multi-term expressions, such as (a+b)(c+d)(a + b)(c + d), looks like a new problem, but a picture makes it concrete first. Give a rectangle a width of a+ba + b and a height of c+dc + d. Splitting the width into aa and bb, and the height into cc and dd, carves the rectangle into four smaller rectangles, and their areas are exactly the four products you get from multiplying every part of one sum by every part of the other.

Area model for multiplying two sumsA rectangle of width a plus b and height c plus d is divided by one vertical and one horizontal line into four cells with areas ac, bc, ad, and bd, whose sum is the product of the two sums.abcdacbcadbd(a + b)(c + d) = ac + bc + ad + bd
A rectangle with width a plus b and height c plus d splits into four smaller rectangles with areas ac, bc, ad, and bd. Their total is the whole area, so the product of the two sums equals the sum of the four pairwise products.

The same result follows from the distributive law alone, with no picture needed. Treat the first factor as a single quantity for a moment: nothing in the distributive law requires the outside factor to be short, so let the whole of a+ba + b play that role.

Why (a+b)(c+d)=ac+bc+ad+bd(a + b)(c + d) = ac + bc + ad + bd#

Nothing in the distributive law says the outside factor has to be a single letter. Treat the whole quantity a+ba + b as one factor and distribute it across c+dc + d, the usual way:

(a+b)(c+d)=(a+b)c+(a+b)d.(a + b)(c + d) = (a + b)c + (a + b)d.

Each of those two pieces is itself a distributive-law step, this time with cc and dd spreading back across a+ba + b:

(a+b)c=ac+bc,(a+b)d=ad+bd.(a + b)c = ac + bc, \qquad (a + b)d = ad + bd.

Adding the four pieces gives

(a+b)(c+d)=ac+bc+ad+bd.(a + b)(c + d) = ac + bc + ad + bd.

Every term of the first factor has multiplied every term of the second, one product for each pairing, matching the four cells of the rectangle above. Because the argument used nothing but the distributive law, it does not stop at two terms each. So to multiply any two expressions, multiply every term of the first by every term of the second, then combine like terms.

For the common case of two two-term factors, the four products come in a memorable order. Reading (a+b)(c+d)(a + b)(c + d) left to right, they are the product of the First terms acac and the Outer terms adad. Then come the Inner terms bcbc and the Last terms bdbd, so the four initials spell the mnemonic FOIL. It is a handy way to be sure you have all four products, but it is only a name for what the distributive law already told you. FOIL works only when each factor has exactly two terms. The underlying rule, every term times every term, is what you fall back on the moment a factor has three terms or more.

Worked example 2 Multiply two binomials

Multiply every term of the first factor by every term of the second, then gather like terms.

For (x+2)(x+3)(x + 2)(x + 3), the four products are x⋅xx \cdot x, x⋅3x \cdot 3, 2⋅x2 \cdot x, and 2⋅32 \cdot 3:

(x+2)(x+3)=x2+3x+2x+6.(x + 2)(x + 3) = x^2 + 3x + 2x + 6.

The middle terms 3x3x and 2x2x are like terms, so combine them:

x2+3x+2x+6=x2+5x+6.x^2 + 3x + 2x + 6 = x^2 + 5x + 6.

The same method handles coefficients and negatives. For (2x−1)(x+4)(2x - 1)(x + 4),

(2x−1)(x+4)=2x2+8x−x−4=2x2+7x−4,(2x - 1)(x + 4) = 2x^2 + 8x - x - 4 = 2x^2 + 7x - 4,

where 2x⋅x=2x22x \cdot x = 2x^2, the outer and inner products 8x8x and −x-x combine to 7x7x, and (−1)(4)=−4(-1)(4) = -4.

Check your understanding

Multiply (x+4)(x+2)(x + 4)(x + 2).

Answer choices

Worked example 3 Multiply a binomial by a trinomial

When a factor has three terms, FOIL no longer applies, but every term times every term still does. Multiply each of the two terms of x+2x + 2 against all three terms of x2+3x−1x^2 + 3x - 1:

(x+2)(x2+3x−1)=x(x2+3x−1)+2(x2+3x−1).(x + 2)(x^2 + 3x - 1) = x(x^2 + 3x - 1) + 2(x^2 + 3x - 1).

Expand each product:

x(x2+3x−1)=x3+3x2−x,2(x2+3x−1)=2x2+6x−2.x(x^2 + 3x - 1) = x^3 + 3x^2 - x, \qquad 2(x^2 + 3x - 1) = 2x^2 + 6x - 2.

Add them and combine the like x2x^2 terms and the like xx terms:

x3+3x2−x+2x2+6x−2=x3+5x2+5x−2.x^3 + 3x^2 - x + 2x^2 + 6x - 2 = x^3 + 5x^2 + 5x - 2.

That is six products in all, one for each pairing of a term from the first factor with a term from the second.

Check your understanding

How many products does multiplying (x2+4x−3)(x+5)(x^2 + 4x - 3)(x + 5) require, before combining any like terms?

Answer choices

Factoring by reversing distribution

Expanding turns a product into a sum. Factoring runs the machine backward. In this lesson, that means turning a sum into a product by pulling out a factor shared by every term. The tool is the distributive law read from right to left, ab+ac=a(b+c)ab + ac = a(b + c), which says a factor common to each term can be lifted outside a parenthesis.

Why pulling out a common factor is the distributive law reversed#

The distributive law, read left to right, expands: a(b+c)=ab+aca(b + c) = ab + ac. Every equation can be read in either direction, so read this one right to left:

ab+ac=a(b+c).ab + ac = a(b + c).

This says that if a factor aa appears in every term of a sum, it can be pulled out to the front. The other factors of each term stay behind inside the parenthesis. Nothing new is needed; it is the same identity, used in reverse.

To factor 6x+96x + 9, look for a factor common to both terms. Since 6x=3⋅2x6x = 3 \cdot 2x and 9=3⋅39 = 3 \cdot 3, the number 33 divides each, so lift it out:

6x+9=3⋅2x+3⋅3=3(2x+3).6x + 9 = 3 \cdot 2x + 3 \cdot 3 = 3(2x + 3).

For x2+3xx^2 + 3x the shared factor is the variable xx, because x2=x⋅xx^2 = x \cdot x and 3x=x⋅33x = x \cdot 3:

x2+3x=x⋅x+x⋅3=x(x+3).x^2 + 3x = x \cdot x + x \cdot 3 = x(x + 3).

In both cases you can check the result at once by expanding it again: 3(2x+3)=6x+93(2x + 3) = 6x + 9 and x(x+3)=x2+3xx(x + 3) = x^2 + 3x, right back to where you started.

The factor worth pulling out is the greatest common factor, or GCF: the largest factor every term shares. It has two parts. The numerical part is the greatest common divisor of the coefficients, and the variable part is each common variable raised to the smallest power that appears. For 4x2+6x4x^2 + 6x the coefficients 44 and 66 share the factor 22, and both terms contain at least one xx, so the GCF is 2x2x. Pulling it out,

4x2+6x=2x⋅2x+2x⋅3=2x(2x+3).4x^2 + 6x = 2x \cdot 2x + 2x \cdot 3 = 2x(2x + 3).

Taking out less than the full GCF leaves the job unfinished. The forms 2(2x2+3x)2(2x^2 + 3x) and x(4x+6)x(4x + 6) are both correct as far as they go, but each still hides a shared factor inside, so neither is fully factored.

The area model reads backward here too. A rectangle whose area is 6x+96x + 9 and whose height is the common factor 33 must have width 2x+32x + 3. So factoring is just naming the side lengths of the rectangle you already drew when expanding.

Area model for factoring out a common factorA rectangle of height 3 is split into a left cell of area 6x below the top width 2x and a right cell of area 9 below the top width 3, so the total area 6x plus 9 equals 3 times the quantity 2x plus 3.2x336x96x + 9 = 3(2x + 3)
A rectangle of height 3 and width 2x plus 3 has area 6x plus 9, split into a part of area 6x and a part of area 9. Reading the common height 3 as a factor pulled out front shows 6x plus 9 equals 3 times the quantity 2x plus 3.

Worked example 5 Factor out the greatest common factor

Find the GCF, lift it out, then confirm the answer by expanding it again.

For 12x2−8x12x^2 - 8x, the coefficients 1212 and 88 share 44 and both terms contain xx, so the GCF is 4x4x:

12x2−8x=4x(3x−2).12x^2 - 8x = 4x(3x - 2).

Expanding the answer returns the original, which is the check that the factoring is right: 4x(3x−2)=12x2−8x4x(3x - 2) = 12x^2 - 8x, as it should.

Check your understanding

Factor out the greatest common factor of 8x2+12x8x^2 + 12x.

Answer choices

Check your understanding

To check a proposed factoring, you expand it back out and compare. Expand 3x(3x+2)3x(3x + 2) using the distributive law. What do you get?

Answer choices

Common mistakes

Practice

Multiple Choice Questions (MCQ)

Progressively harder sets of questions. Each opens on its own page.

Core practice

Practice problems at the level of the course, to be worked out on paper. Hints one at a time, then the answer or the full worked solution, with your progress kept in this browser.

Core practice Work it out on paper 10 problems Start →
More practice (optional)

Extra sets, as hard as the Challenge set. Each one opens on its own page.

More resources (optional)

Other explanations of this lesson, if you want a second take.

Go deeper (optional)

You can skip this and keep going. Read it if you want to know more.

Two products with a shortcut shape

Some products have a tidy shape, and expanding them is the same distribution as always. Take a sum times a difference of the same two terms:

(x+5)(x−5)=x2−5x+5x−25=x2−25.(x + 5)(x - 5) = x^2 - 5x + 5x - 25 = x^2 - 25.

The two middle terms −5x-5x and 5x5x cancel, leaving only x2−25x^2 - 25. A squared binomial is a product with itself:

(x+3)2=(x+3)(x+3)=x2+3x+3x+9=x2+6x+9.(x + 3)^2 = (x + 3)(x + 3) = x^2 + 3x + 3x + 9 = x^2 + 6x + 9.

Here the middle terms add rather than cancel, giving the 6x6x. Both results come straight from multiplying every term by every term; there is nothing to memorize beyond the method you already have.

A bit of history (optional)

The rectangle you cut apart in this lesson is about twenty-three centuries old.

Around 300 BCE, Euclid gathered the geometry of his day into a work called the Elements. Book II of it reads oddly to a modern eye. Its propositions carry no algebraic symbols and no variables standing for an unknown number, though Euclid still labeled the points of his diagrams with letters, A, B, C, and so on, purely to refer to them in the proof. They concern lines, rectangles and squares, and nothing else. One of them says this. Take two straight lines, and cut one of them into two parts. Then the rectangle contained by the two lines equals the two rectangles contained by the uncut line and each part of the cut one. Rewrite that sentence in symbols and you have the distributive law, a(b+c)=ab+aca(b + c) = ab + ac.

Euclid could not have written it that way. Algebraic notation was still nineteen centuries in his future, so he proved the fact the way his geometry allowed: by drawing the rectangle and dividing it.

The picture never left. Slicing a rectangle into acac, bcbc, adad and bdbd to expand (a+b)(c+d)(a + b)(c + d) is Book II with modern labels. Reading that same rectangle backward is equally Book II. You were handed a height of 33 and an area of 6x+96x + 9, and you recovered the width 2x+32x + 3. A Greek geometer would have described that as naming a side, and you described it as factoring. Factor is Latin for one who makes, so the factors of an expression are simply its makers.