Expanding and Factorising

Change the brackets and watch the rectangle. The four pieces are the four terms, and switching to factorising asks the same question from the other side.

Two brackets (a+b)(c+d)=ac+ad+bc+bd(a+b)(c+d)=ac+ad+bc+bd
A square (a±b)2=a2±2ab+b2(a\pm b)^{2}=a^{2}\pm2ab+b^{2}
Difference of two squares a2−b2=(a−b)(a+b)a^{2}-b^{2}=(a-b)(a+b)
Whole-number brackets exist when b2−4ac=n2,n∈Zb^{2}-4ac=n^{2},\quad n\in\mathbb{Z}
Loading interactive simulation...

Lesson

The theory — Expanding and Factorising

To expand is to multiply brackets out into a sum of terms. To factorise is to go back, writing the sum as a product of brackets with whole-number coefficients wherever that is possible.

Where the formula comes from

  1. Multiply every term by every term. Two brackets of two terms give four products, the four pieces of the rectangle.
    (px+q)(rx+s)=prx2+psx+qrx+qs(px+q)(rx+s)=prx^{2}+psx+qrx+qs
  2. Collect like terms. The two strips are both multiples of x, so they add to one middle term, and that sum is where the middle coefficient comes from.
    prx2+(ps+qr)x+qsprx^{2}+(ps+qr)x+qs
  3. Factorising starts with the common factor. Take out the highest common factor of a, b and c, with the sign of a, so the trinomial left inside starts with a positive x² term.
    3x2−12x−36=3(x2−4x−12)3x^{2}-12x-36=3(x^{2}-4x-12)
  4. Find the brackets. For x² + bx + c look for two numbers whose product is c and whose sum is b. When a is not 1, find two numbers with product ac and sum b, split the middle term with them, and factorise in pairs.
    (−6)(2)=−12,  −6+2=−4x2−4x−12=(x−6)(x+2)6x2+5x−4=6x2+8x−3x−4=2x(3x+4)−(3x+4)=(2x−1)(3x+4)\begin{aligned}&(-6)(2)=-12,\ \ -6+2=-4\\&x^{2}-4x-12=(x-6)(x+2)\\[4pt]&6x^{2}+5x-4=6x^{2}+8x-3x-4\\&=2x(3x+4)-(3x+4)\\&=(2x-1)(3x+4)\end{aligned}
  5. Test before searching. Whole-number brackets exist exactly when b² − 4ac is a perfect square. If it is not, no search will find them.
    ax2+bx+c=(px+q)(rx+s),  p,q,r,s∈Z  ⟺  b2−4ac=n2,  n∈Z\begin{aligned}&ax^{2}+bx+c=(px+q)(rx+s),\ \ p,q,r,s\in\mathbb{Z}\\&\iff b^{2}-4ac=n^{2},\ \ n\in\mathbb{Z}\end{aligned}

Problems solved in full

  1. Two brackets with a minus sign 2 steps

    Expand (2x − 1)(3x + 4).

    Open this problem in the tool

    1. Multiply each term of the first bracket by each term of the second. The −1 keeps its sign in both of its products.

      (2x)(3x)+(2x)(4)+(−1)(3x)+(−1)(4)=6x2+8x−3x−4\begin{aligned}&(2x)(3x)+(2x)(4)+(-1)(3x)+(-1)(4)\\&=6x^{2}+8x-3x-4\end{aligned}
    2. The two middle products are both multiples of x, so they collect into one term.

      6x2+(8−3)x−4=6x2+5x−46x^{2}+(8-3)x-4=6x^{2}+5x-4

    Answer

    6x² + 5x − 4.

    (2x−1)(3x+4)=6x2+5x−4(2x-1)(3x+4)=6x^{2}+5x-4
  2. A bracket squared 4 steps

    Expand (2x − 3)². Then say how you would know that 4x² − 12x + 9 is a square if you met it first.

    Open this problem in the tool

    Show solution
    1. A square is a bracket times itself, so it has a middle term like any other product: twice the product of the two terms.

      (2x−3)2=(2x)2+2(2x)(−3)+(−3)2=4x2−12x+9\begin{aligned}(2x-3)^{2}&=(2x)^{2}+2(2x)(-3)+(-3)^{2}\\&=4x^{2}-12x+9\end{aligned}
    2. The commonest wrong answer leaves that middle term out. One value of x is enough to expose it.

      (2x−3)2≠4x2+9:x=1: (2−3)2=1,4+9=13(2x-3)^{2}\ne4x^{2}+9:\qquad x=1:\ (2-3)^{2}=1,\quad4+9=13
    3. Read backwards, the first and last terms are squares, and the middle term is twice the product of their square roots with a sign: here −12x = −2(2x)(3), so the bracket carries a minus.

      4x2=(2x)2,9=32,12x=2(2x)(3)4x^{2}=(2x)^{2},\quad9=3^{2},\quad12x=2(2x)(3)
    4. The discriminant gives the same verdict without any guessing. It is 0, so the two roots coincide and the two brackets are the same bracket.

      b2−4ac=(−12)2−4(4)(9)=144−144=0b^{2}-4ac=(-12)^{2}-4(4)(9)=144-144=0

    Answer

    4x² − 12x + 9 = (2x − 3)². It is not 4x² + 9: at x = 1 the square is 1 and 4x² + 9 is 13.

    (2x−3)2=4x2−12x+9(2x-3)^{2}=4x^{2}-12x+9
  3. Three brackets 4 steps

    Expand (x + 2)(x − 1)(2x + 3).

    Open this problem in the tool

    Show solution
    1. Multiply two of the brackets first. This step is the one the tool does.

      (x+2)(x−1)=x2−x+2x−2=x2+x−2(x+2)(x-1)=x^{2}-x+2x-2=x^{2}+x-2
    2. Then multiply that trinomial by the third bracket: each of its three terms by both terms of 2x + 3, six products.

      (x2+x−2)(2x+3)=2x3+3x2+2x2+3x−4x−6\begin{aligned}&(x^{2}+x-2)(2x+3)\\&=2x^{3}+3x^{2}+2x^{2}+3x-4x-6\end{aligned}
    3. Collect: 3x² and 2x² make 5x², and 3x and −4x make −x.

      =2x3+5x2−x−6=2x^{3}+5x^{2}-x-6
    4. Check at a value that makes the work easy. At x = 1 the middle bracket is 0, so the product is 0, and the expansion must give 0 as well.

      x=1:(3)(0)(5)=0,2+5−1−6=0x=1:\quad(3)(0)(5)=0,\qquad2+5-1-6=0

    Answer

    2x³ + 5x² − x − 6.

    (x+2)(x−1)(2x+3)=2x3+5x2−x−6(x+2)(x-1)(2x+3)=2x^{3}+5x^{2}-x-6
  4. Factorising when a = 1 4 steps

    Factorise x² − 2x − 15.

    Open this problem in the tool

    Show solution
    1. Expanding (x + m)(x + n) shows what to look for: two numbers with product −15 and sum −2.

      (x+m)(x+n)=x2+(m+n)x+mnmn=−15,m+n=−2\begin{aligned}&(x+m)(x+n)=x^{2}+(m+n)x+mn\\&mn=-15,\quad m+n=-2\end{aligned}
    2. List the factor pairs of −15. The product is negative, so the two numbers have opposite signs.

      −15=1×(−15)=(−1)×15=3×(−5)=(−3)×5\begin{aligned}-15&=1\times(-15)=(-1)\times15\\&=3\times(-5)=(-3)\times5\end{aligned}
    3. Only 3 and −5 add to −2.

      m=−5, n=3:(−5)(3)=−15,−5+3=−2m=-5,\ n=3:\qquad(-5)(3)=-15,\quad-5+3=-2
    4. Multiply back.

      (x−5)(x+3)=x2+3x−5x−15=x2−2x−15(x-5)(x+3)=x^{2}+3x-5x-15=x^{2}-2x-15

    Answer

    (x − 5)(x + 3).

    x2−2x−15=(x−5)(x+3)x^{2}-2x-15=(x-5)(x+3)
  5. Factorising 6x² + 5x − 4 to say if it works 7 steps

    Factorise 6x² + 5x − 4, and say in advance whether it was going to work.

    Open this problem in the tool

    Show solution
    1. Compute the discriminant first. It costs one line and it decides whether there is anything to find.

      b2−4ac=52−4(6)(−4)=25+96=121b^2 - 4ac = 5^2 - 4(6)(-4) = 25 + 96 = 121
    2. One hundred and twenty-one is 11², so a factorisation over the integers exists. Now the search is worth doing.

      121=112121 = 11^2
    3. The roots follow from the same number, and because the discriminant is a perfect square they are rational.

      x=−5±1112=12,  −43x = \frac{-5 \pm 11}{12} = \tfrac{1}{2}, \; -\tfrac{4}{3}
    4. A root of 1/2 means a factor of (2x − 1); a root of −4/3 means a factor of (3x + 4). Clearing each denominator is what turns a root into a bracket.

      (2x−1)(3x+4)(2x - 1)(3x + 4)
    5. Multiply back, always. The two middle strips are 8x and −3x, and they combine to the 5x that was asked for.

      6x2+8x−3x−4=6x2+5x−4  ✓6x^2 + 8x - 3x - 4 = 6x^2 + 5x - 4 \;\checkmark
    6. Now change the constant to −5 and repeat the first step. The discriminant becomes 25 + 120 = 145, which is not a perfect square, so there is no rectangle with integer sides and no point searching for one.

      52−4(6)(−5)=25+120=145  ≠  k25^2 - 4(6)(-5) = 25 + 120 = 145 \;\neq\; k^2
    7. Which is where the tool stops and a distinction begins. 6x² + 5x − 5 factorises perfectly well over the real numbers, into brackets containing √145. "Does not factorise" always means "not over the numbers we agreed to use", and the agreement is usually left unsaid.

      6x2+5x−5=6(x−−5+14512)(x−−5−14512)6x^2 + 5x - 5 = 6\left(x - \tfrac{-5 + \sqrt{145}}{12}\right)\left(x - \tfrac{-5 - \sqrt{145}}{12}\right)

    Answer

    (2x − 1)(3x + 4), and the discriminant of 121 = 11² said so before any searching. Change the −4 to a −5 and the discriminant becomes 145, not a square, and the same trinomial stops factorising over the integers while remaining perfectly factorable over the reals.

  6. The common factor first 4 steps

    Factorise 3x² − 12x − 36 completely.

    Open this problem in the tool

    Show solution
    1. 3 divides all three coefficients, so it comes out first.

      3x2−12x−36=3(x2−4x−12)3x^{2}-12x-36=3(x^{2}-4x-12)
    2. Inside, a = 1, and the two numbers with product −12 and sum −4 are −6 and 2.

      mn=−12,m+n=−4:m=−6, n=2mn=-12,\quad m+n=-4:\qquad m=-6,\ n=2
    3. Put the 3 back in front.

      3x2−12x−36=3(x−6)(x+2)3x^{2}-12x-36=3(x-6)(x+2)
    4. The brackets (3x − 18)(x + 2) multiply back to the same trinomial, but 3 still divides the first of them, so the factorisation is incomplete and an exam that asks for it completely marks it down.

      (3x−18)(x+2)=3(x−6)(x+2)(3x-18)(x+2)=3(x-6)(x+2)

    Answer

    3(x − 6)(x + 2).

    3x2−12x−36=3(x−6)(x+2)3x^{2}-12x-36=3(x-6)(x+2)
  7. A negative x² term 4 steps

    Factorise 12 + 4x − x².

    Open this problem in the tool

    Show solution
    1. Write it in descending powers and take out −1, so the x² term inside is positive.

      12+4x−x2=−(x2−4x−12)12+4x-x^{2}=-(x^{2}-4x-12)
    2. Inside, the product is −12 and the sum −4, so the numbers are −6 and 2.

      x2−4x−12=(x−6)(x+2)x^{2}-4x-12=(x-6)(x+2)
    3. The minus sign can go into the first bracket instead, which is how most mark schemes write it.

      −(x−6)(x+2)=(6−x)(x+2)-(x-6)(x+2)=(6-x)(x+2)
    4. Check at x = 0: the original is 12, and (6)(2) is 12.

      x=0:(6)(2)=12x=0:\quad(6)(2)=12

    Answer

    −(x − 6)(x + 2), which is the same as (6 − x)(x + 2).

    12+4x−x2=(6−x)(x+2)12+4x-x^{2}=(6-x)(x+2)
  8. The difference of two squares, and the number 8,051 7 steps

    Expand (x − 5)(x + 5) and say why the middle term disappears. Then multiply 95 × 105 in your head, and decide whether the same picture can take a plain number apart.

    Open this problem in the tool

    Show solution
    1. The four pieces of the rectangle, in reading order: the corner carrying x², the two strips, and the constant corner.

      x⋅x  +  x⋅5  +  (−5)⋅x  +  (−5)⋅5x\cdot x \;+\; x\cdot 5 \;+\; (-5)\cdot x \;+\; (-5)\cdot 5
    2. The two strips are 5x and −5x. They cancel, and the trinomial the panel prints has no middle term at all.

      =x2+5x−5x−25=x2+0x−25= x^{2} + 5x - 5x - 25 = x^{2} + 0x - 25
    3. The discriminant row reads 100, which is 10², a perfect square, so brackets with whole numbers in them exist. Here we already know they do, having built them.

      b2−4ac=02−4(1)(−25)=100=102b^{2}-4ac = 0^{2} - 4(1)(-25) = 100 = 10^{2}
    4. The cancellation was not luck. Put the same number in both brackets with opposite signs and the strips are the same rectangle counted twice, once added and once taken away, whatever the number.

      (x+q)(x−q)=x2+qx−qx−q2=x2−q2(x+q)(x-q) = x^{2} + qx - qx - q^{2} = x^{2} - q^{2}
    5. Nothing in that argument needs x to be a letter. Put 100 into it and a multiplication becomes a subtraction.

      95×105=(100−5)(100+5)=1002−52=10,000−25=9,97595 \times 105 = (100-5)(100+5) = 100^{2} - 5^{2} = 10{,}000 - 25 = 9{,}975
    6. Any two numbers can be written as a midpoint and a gap either side, so this works on any pair whose average is easy.

      47×53=(50−3)(50+3)=2,500−9=2,49147 \times 53 = (50-3)(50+3) = 2{,}500 - 9 = 2{,}491
    7. Read backwards it does the harder job. To factorise 8,051, hunt for a square that beats it by another square: 90² is the first that does, and the two brackets are the factors. This is Fermat’s method, and it is quick exactly when the two factors sit close together, as 83 and 97 do.

      902−8,051=8,100−8,051=49=72  ⟹  8,051=83×9790^{2} - 8{,}051 = 8{,}100 - 8{,}051 = 49 = 7^{2} \;\Longrightarrow\; 8{,}051 = 83 \times 97

    Answer

    x² − 25, and 95 × 105 = 9,975. The middle term goes because the two strips are equal and opposite, which leaves x² − q². Run the identity backwards and it factorises numbers rather than expressions: 8,051 = 90² − 7² = 83 × 97.

    a2−b2=(a−b)(a+b)⟺N=m2−d2=(m−d)(m+d)a^{2}-b^{2} = (a-b)(a+b) \qquad\Longleftrightarrow\qquad N = m^{2}-d^{2} = (m-d)(m+d)

Supplementary problems, answers only

  1. Expand (3x − 2)(x + 5).

    Show answer

    3x² + 13x − 10

    3x2+13x−103x^{2}+13x-10
  2. Expand (x − 4)(x + 1)(x + 3).

    Show answer

    x³ − 13x − 12

    x3−13x−12x^{3}-13x-12
  3. Factorise x² + x − 20.

    Show answer

    (x + 5)(x − 4)

    (x+5)(x−4)(x+5)(x-4)
  4. Factorise 10x² − 11x − 6.

    Show answer

    (2x − 3)(5x + 2)

    (2x−3)(5x+2)(2x-3)(5x+2)
  5. Factorise 2x² − 18 completely.

    Show answer

    2(x − 3)(x + 3)

    2(x−3)(x+3)2(x-3)(x+3)
  6. Factorise x² − 7x.

    Show answer

    x(x − 7)

    x(x−7)x(x-7)
  7. Does 2x² + 3x − 4 factorise with whole numbers?

    Show answer

    No. Its discriminant is 41, which is not a perfect square.

    b2−4ac=41b^{2}-4ac=41

The four letters of FOIL are four rectangles

Put a rectangle with sides x + 2 and x + 3 next to the expansion. It splits into four pieces because each side splits into two: x², two strips of 3x and 2x, and a 6 in the corner. Those four areas are the four terms, and their total is the total area — which is what "multiplying out" means. The order you visit them in does not matter, which is why every mnemonic for this works and why none of them is necessary. Make a coefficient negative and the pieces it touches turn pale with a dashed edge: a negative area is a subtraction, and the picture keeps working, which is more than can be said for the mnemonic.

Factorising is the same picture, and that is why it is harder

Switch to Factorise and the question turns around: here is the area, what were the sides? Nothing new is involved. What changed is that expanding is a calculation and factorising is a search — the four pieces are given as a total and you have to find an arrangement that is a rectangle. That asymmetry is why one direction is taught as a procedure and the other as a knack, and it is the same asymmetry that makes multiplying two primes easy and factoring their product the basis of RSA.

One test says whether the search is worth starting

Before hunting for factors, compute b² − 4ac. If it is a perfect square the trinomial factorises over the integers, and if it is not, no arrangement exists and no amount of trying will find one. Press One that will not: x² + x + 1 has a discriminant of −3, and the rectangle simply is not there. This is the same discriminant that decides how many roots a quadratic has, which is not a coincidence — the sides of the rectangle are the roots in disguise, and asking for integer sides is asking for rational roots. Sweeping every trinomial with a between 1 and 8 and b, c between −12 and 12 gives 733 with a square discriminant, and all 733 factorise.

Learning path

Beyond the quadratic