This site is a work in progress. New lessons are added regularly. Contact us

Difference of Squares

Learning goals

  • Apply a2b2=(a+b)(ab)a^2 - b^2 = (a + b)(a - b)
  • Spot two perfect squares joined by a minus
  • Take square roots including coefficients, so 9x2\sqrt{9x^2} is 3x3x
  • Factor again when a factor is itself a difference
  • Refuse to factor a sum of squares over the reals

Why a difference of squares always factors

The claim is that a2b2a^2 - b^2 factors as (a+b)(ab)(a + b)(a - b). There is nothing to guess and nothing to memorize on faith, because you can check it directly. To test whether two factors really rebuild an expression, multiply them out and see what survives.

Why a2b2=(a+b)(ab)a^2 - b^2 = (a + b)(a - b)#

Expand the proposed factorization the way you expand any product of two binomials, multiplying every term of the first factor by every term of the second:

(a+b)(ab)=aaab+babb.(a + b)(a - b) = a\cdot a - a\cdot b + b\cdot a - b\cdot b.

The four products are a2a^2, then ab-ab, then +ba+ba, then b2-b^2. Now look hard at the two middle products. Because the order of multiplication does not matter, abab and baba are the same quantity, so ab-ab and +ba+ba are exact opposites. They add to zero and disappear:

a2ab+bab2=a2b2.a^2 - ab + ba - b^2 = a^2 - b^2.

Only the two squares are left. So (a+b)(ab)=a2b2(a + b)(a - b) = a^2 - b^2 for every aa and bb. Read from right to left, that is the factoring rule: a difference of two squares splits into the sum of the roots times the difference of the roots. The cancellation of the middle terms is the entire mechanism, and it is also why a sum of squares behaves differently. Flip one sign, expand (a+b)(a+b)(a + b)(a + b) instead, and the two middle products become +ab+ab and +ba+ba, which reinforce rather than cancel.

The same fact has a picture. Start with a square of side aa, whose area is a2a^2, and cut a smaller square of side bb out of one corner, removing area b2b^2. What is left is an L-shaped region of area a2b2a^2 - b^2. Slice that L into two rectangles and slide them together, and they line up into a single rectangle with sides a+ba + b and aba - b. No area is created or lost in the move, so the leftover a2b2a^2 - b^2 must equal the rectangle’s area (a+b)(ab)(a + b)(a - b).

Area model for the difference of two squaresA square of side a has a square of side b cut from one corner. The remaining L-shaped region, of area a squared minus b squared, is cut into two rectangles that slide together to form a single rectangle of width a plus b and height a minus b, so the two areas are equal.aabba² − b²=a + ba − b(a + b)(a − b)
Cutting a square of side b from the corner of a square of side a leaves an L of area a squared minus b squared. The L rearranges into a rectangle of sides a plus b and a minus b, so the two areas are equal.

Recognizing a difference of squares

Before you can use the pattern you have to spot it, and the test has three parts. The expression must have exactly two terms. Both terms must be perfect squares, meaning each one is something squared. Each one may be a number like 9=329 = 3^2 or 25=5225 = 5^2, a variable power like x2=(x)2x^2 = (x)^2 or x4=(x2)2x^4 = (x^2)^2, or a whole term like 9x2=(3x)29x^2 = (3x)^2. And the two squares must be joined by a minus sign, one square subtracted from the other. When all three conditions hold, the expression is a difference of squares and factors as the sum times the difference of the two roots.

The minus sign is not a formality. A sum of two squares, like x2+9x^2 + 9, passes the first two conditions but fails the third. A sum like x2+9x^2 + 9 does not factor at all over the real numbers. That is not a hole in your method; there is genuinely no pair of real factors whose product is x2+9x^2 + 9. A later chapter, once numbers beyond the real line are on the table, comes back to this case. For now, read a plus sign between two squares as a full stop and leave the expression alone.

Worked example 1 Which expressions are differences of squares?

Run each one through the three-part test: two terms, both perfect squares, joined by a minus sign.

x249x^2 - 49 qualifies. It has two terms, both are perfect squares since x2=(x)2x^2 = (x)^2 and 49=7249 = 7^2, and they are subtracted. The roots are xx and 77.

9x249x^2 - 4 qualifies too. Here 9x2=(3x)29x^2 = (3x)^2 and 4=224 = 2^2, with a minus between them, so the roots are 3x3x and 22.

x2+16x^2 + 16 fails. Both terms are perfect squares, but they are added, not subtracted. This is a sum of squares, and it does not factor over the real numbers.

x25x^2 - 5 fails as well. It does have a minus sign, but 55 is not a perfect square, since 5\sqrt{5} is not a whole number. So the second term is not a square to begin with.

Only the first two are differences of squares.

Check your understanding

Which of these is a difference of squares?

Answer choices

Factoring when the terms carry coefficients

Nothing in the pattern requires the squares to be bare variables. A term like 9x29x^2 is a perfect square because 9x2=(3x)29x^2 = (3x)^2, so a difference such as 9x2169x^2 - 16 factors exactly the way x216x^2 - 16 does. The one new skill is taking the square root of each term correctly, coefficient and all. The root of 9x29x^2 is 3x3x, not 9x9x, because you have to square both the 33 and the xx to rebuild 9x29x^2.

The routine is always the same. Take the square root of the first term to get AA, take the square root of the second to get BB, and write (A+B)(AB)(A + B)(A - B). Then expand it in your head as a check: the two outer squares should return and the middle terms should cancel.

Worked example 2 Factor 9x2169x^2 - 16 and 254x225 - 4x^2

For 9x2169x^2 - 16, take the root of each term. The first is 9x2=3x\sqrt{9x^2} = 3x and the second is 16=4\sqrt{16} = 4, so A=3xA = 3x and B=4B = 4:

9x216=(3x)242=(3x+4)(3x4).9x^2 - 16 = (3x)^2 - 4^2 = (3x + 4)(3x - 4).

Check it by expanding: (3x+4)(3x4)=9x212x+12x16=9x216(3x + 4)(3x - 4) = 9x^2 - 12x + 12x - 16 = 9x^2 - 16, with the middle terms canceling just as the pattern promises.

For 254x225 - 4x^2, the roots are 25=5\sqrt{25} = 5 and 4x2=2x\sqrt{4x^2} = 2x. This time the number comes first and the variable term second, but the pattern does not care about the order:

254x2=52(2x)2=(5+2x)(52x).25 - 4x^2 = 5^2 - (2x)^2 = (5 + 2x)(5 - 2x).

Both factors carry the same two roots, once added and once subtracted.

Worked example 3 Factor 49x264y249x^2 - 64y^2

A second variable changes nothing. Take the square root of each term, keeping each coefficient with its variable: 49x2=7x\sqrt{49x^2} = 7x and 64y2=8y\sqrt{64y^2} = 8y.

49x264y2=(7x)2(8y)2=(7x+8y)(7x8y).49x^2 - 64y^2 = (7x)^2 - (8y)^2 = (7x + 8y)(7x - 8y).

Each root captures its whole term. The check is the usual one: the cross terms 56xy-56xy and +56xy+56xy cancel, leaving 49x264y249x^2 - 64y^2.

Check your understanding

Factor 49x22549x^2 - 25.

Answer choices

Factoring more than once

Factoring is not finished until nothing that remains can be factored again. Sometimes one pass of the difference-of-squares rule leaves a factor that is itself a difference of squares, and then you apply the rule a second time. This comes up often with fourth powers, because x4=(x2)2x^4 = (x^2)^2 is a perfect square whose root x2x^2 can be a difference of squares in its own right.

Worked example 4 Factor x41x^4 - 1 completely

Read x41x^4 - 1 as (x2)212(x^2)^2 - 1^2, a difference of squares with roots x2x^2 and 11:

x41=(x2+1)(x21).x^4 - 1 = (x^2 + 1)(x^2 - 1).

Now inspect each factor. The second one, x21x^2 - 1, is again a difference of squares, (x)212(x)^2 - 1^2, so it factors further:

x21=(x+1)(x1).x^2 - 1 = (x + 1)(x - 1).

The first factor, x2+1x^2 + 1, is a sum of squares, so it does not factor over the real numbers and the work stops there. Assembling the pieces gives the complete factorization:

x41=(x2+1)(x+1)(x1).x^4 - 1 = (x^2 + 1)(x + 1)(x - 1).

Stopping at (x2+1)(x21)(x^2 + 1)(x^2 - 1) would be an error, because x21x^2 - 1 still comes apart. After every pass, look at each new factor and ask whether it is a difference of squares.

Pulling out a common factor first

An expression can hide a difference of squares behind a common factor. Take 2x282x^2 - 8. Neither 2x22x^2 nor 88 is a perfect square, so at first glance the pattern does not apply. But the two terms share a factor of 22, and once you pull it out, what is left is a clean difference of squares:

2x28=2(x24)=2(x+2)(x2).2x^2 - 8 = 2(x^2 - 4) = 2(x + 2)(x - 2).

The habit to build is to factor out the greatest common factor first, then check whether what remains fits a special pattern. Skip that step and you either miss the difference of squares entirely or leave the factoring half-done.

Worked example 5 Factor 3x312x3x^3 - 12x completely

First find the greatest common factor of 3x33x^3 and 12x12x. They share a factor of 33 and a factor of xx, so the common factor is 3x3x:

3x312x=3x(x24).3x^3 - 12x = 3x(x^2 - 4).

What is left inside is x24x^2 - 4, a difference of squares with roots xx and 22:

x24=(x+2)(x2).x^2 - 4 = (x + 2)(x - 2).

So the complete factorization keeps the common factor out front:

3x312x=3x(x+2)(x2).3x^3 - 12x = 3x(x + 2)(x - 2).

Pulling out 3x3x first is what exposed the difference of squares. There was no square to see until the common factor was gone.

Check your understanding

Factor 2x2182x^2 - 18 completely.

Answer choices

Solving equations and a mental-math shortcut

The pattern turns certain equations into one-liners. To solve x29=0x^2 - 9 = 0, factor the left side and use the zero-product property, which says a product is zero only when one of its factors is zero:

x29=0    (x+3)(x3)=0    x=3  or  x=3.x^2 - 9 = 0 \implies (x + 3)(x - 3) = 0 \implies x = -3 \ \text{ or } \ x = 3.

The same reasoning handles a2b2=0a^2 - b^2 = 0 in general. Factoring gives (a+b)(ab)=0(a + b)(a - b) = 0, so either a+b=0a + b = 0 or ab=0a - b = 0, which means a=ba = -b or a=ba = b. A difference of squares is zero exactly when the two quantities are equal or are exact opposites.

The identity is also a real arithmetic shortcut. A product of two numbers that sit the same distance on either side of a round number is a difference of squares in disguise. To multiply 51×4951 \times 49, notice that 51=50+151 = 50 + 1 and 49=50149 = 50 - 1, so the product is (50+1)(501)(50 + 1)(50 - 1):

51×49=50212=25001=2499.51 \times 49 = 50^2 - 1^2 = 2500 - 1 = 2499.

You have replaced a two-digit multiplication with a square and a subtraction. The same move gives 43×37=40232=16009=159143 \times 37 = 40^2 - 3^2 = 1600 - 9 = 1591. This pairing of a sum with a matching difference is worth holding onto for one more reason. The very same (a+b)(ab)(a + b)(a - b) trick is what later lets you clear square roots out of a denominator when you simplify radical expressions.

Common mistakes

Practice

Multiple Choice Questions (MCQ)

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

Free Response Questions (FRQ)

Longer questions in parts, to be worked out on paper. Progressive hints, the answer on its own so you can check yourself and try again, then the full worked solution, plus a rubric to mark your own work against.

Free response Work it out on paper 5 questions 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.

A bit of history (Optional)

Ask someone to multiply two large numbers and tell you only the answer. Recovering the two numbers is far harder than the multiplication ever was. Testing every possible divisor works, but on a big enough number it outlasts a lifetime.

Pierre de Fermat was a French lawyer who did mathematics in his spare time. In the sixteen hundreds he found a shortcut for a whole class of numbers. His plan was to write the target as one square minus another. The moment he had that, this lesson’s identity handed him the factors. A difference of squares always splits into a sum times a difference.

The search itself is easy to describe. Start just above the square root of the target and climb one step at a time. At each stop, square the number you are standing on and subtract the target. If the leftover is a perfect square, you are finished.

Try it on 59595959. Its square root is a little under 7878, and the first two stops give nothing. At 8080 the leftover is 441441, which is 2121 squared. So the number is 5959 times 101101.

The method is quickest when the two hidden factors sit near each other. Descendants of it still appear in factoring software today. That is a generous afterlife for a two-term identity you proved by cancelling a single pair of middle terms.