On this concept: Formula

Not sure which lesson to do first? Find your level and get a plan →

Math · Algebra Fundamentals · Grade 9-12

Factoring Difference of Squares

Factoring a difference of squares rewrites a2−b2 as (a+b)(a−b).

a2−b2=(a+b)(a−b)

Quick Answer

Factoring a difference of squares rewrites a2−b2 as (a+b)(a−b). Use it when an expression has exactly two terms, both perfect squares, with a minus between them: x2−25, 9x2−16, x4−1. Find what was squared in each term, then write their sum times their difference. It works because the cross terms cancel: (a+b)(a−b)=a2−ab+ab−b2. A sum of squares such as x2+25 does not factor over the real numbers.

Why This Matters

It factors in one line what would otherwise need a search for number pairs: x2−49=0 gives x=±7 at once, and x2−9x−3 simplifies to x+3 for x≠3. It powers mental math, 31×29=302−12=899, and it is the reason conjugates clear roots from denominators: (3+2)(3−2)=9−2=7.

Intuitive Explanation

Start with a 10-by-10 square of tiles and remove a 3-by-3 square from one corner, leaving 100−9=91 tiles. Cut the leftover L-shape into two strips along the edge of the missing corner and slide one strip around: together they form a rectangle 10+3=13 long and 10−3=7 wide, and 13×7=91. That is a2−b2=(a+b)(a−b) with a=10 and b=3.

Algebra shows the same thing. Multiply (a+b)(a−b) and you get a2−ab+ab−b2. The two cross terms are +ab and −ab, so they cancel exactly, leaving a2−b2. Whenever you see a square minus a square, you can run that multiplication backward.

The squares can be disguised. 16x2−49 is (4x)2−72, so it factors as (4x+7)(4x−7): the coefficient 16 is part of the square. x4−81 is (x2)2−92=(x2+9)(x2−9), and x2−9 is again a difference of squares, so the full answer is (x2+9)(x+3)(x−3).

Two look-alikes do not fit. A sum of squares, x2+9, has no real factors: (x+3)(x−3) gives x2−9, and (x+3)2 adds a middle term 6x. And x2−6x+9 has a middle term, so it is a perfect-square trinomial, (x−3)2, not a difference of squares. Count the terms and check the sign first.

Think of it like this. Reshape a square garden into a rectangle with the same perimeter, b metres longer and b metres narrower, and you always lose exactly a b-by-b patch: (a+b)(a−b)=a2−b2. Run that backward and any square minus a square becomes such a rectangle. The trick depends on that missing patch, so it says nothing about a2+b2.

Core idea. When two perfect squares are subtracted, the expression factors into the conjugate pair (a+b)(a−b).


When to Use

Use it when you see exactly two terms, each a perfect square (like x2, 49, 16x2, x4), joined by a minus sign. Check coefficients too: 25x2 is (5x)2. After factoring, look again, since a factor like x2−4 can split further. Pull out a GCF first: 2x2−18=2(x2−9). With three terms, try a perfect-square trinomial or trinomial factoring. With a plus sign, as in x2+16, it does not factor over the reals.

Tip. Ask: Are both terms perfect squares with a minus sign between them and nothing in the middle?

How to Recognize It

Before using a2−b2=(a+b)(a−b), work out what each term is the square of, and look for a common factor or a hidden bracket first.

  1. Are the powers of x even and the coefficients square numbers, as in 49x6=(7x3)2?

    Then you can name a and b directly. An odd power such as x3, or a coefficient like 8, is not a square, so look for a common factor first or use a different method.

  2. Is a common factor hiding the squares, as in 3x2−75?

    Take it out first: 3(x2−25)=3(x+5)(x−5). Before that step neither 3 nor 75 is a perfect square, so the rule seems not to apply.

  3. After factoring, is one of the new factors another difference of squares?

    Keep going: x4−81=(x2+9)(x2−9)=(x2+9)(x+3)(x−3). The factor x2+9 stops there, because a sum of squares does not factor over the real numbers.

  4. Is one of the squares a whole expression, as in (x+1)2−16?

    The rule still works with a=x+1 and b=4: (x+1+4)(x+1−4)=(x+5)(x−3). Expanding first into a trinomial also works, but takes longer.

Factoring Difference of Squares compared with Factoring trinomials, Perfect-square trinomial, and Sum of squares

Each row involves perfect squares, so a quick look sees x2 and a square number and stops there. Ask how many terms there are and what sign joins them: two terms with a minus, three terms with a middle term, or two terms with a plus.

Factoring Difference of Squares

Meaning
Use this when you see one perfect square subtracted from another perfect square with no middle term.
Key test
Are both terms perfect squares with a minus sign between them and nothing in the middle?
Formula
a2−b2=(a+b)(a−b)
Example
Factor 9x2−25.

Factoring trinomials

Meaning
Factors a three-term ax2+bx+c that has a middle x term.
Key test
Use when there are three terms, not two, with a linear middle term.
Formula
(x+p)(x+q) with p+q=b, pq=c
Example
x2+5x+6=(x+2)(x+3)

Perfect-square trinomial

Meaning
Factors a2±2ab+b2 into (a±b)2, a repeated factor.
Key test
Use when there are three terms and the middle is twice the product of the roots.
Formula
a2+2ab+b2=(a+b)2
Example
x2+6x+9=(x+3)2

Sum of squares

Meaning
Does NOT factor over the reals; stays as a2+b2.
Key test
Recognize when the sign between the two squares is plus, so no real factoring is possible.
Example
x2+16 is prime over the reals

Formula & Notation

a2−b2=(a+b)(a−b)
∀a,b∈R:  a2−b2=(a+b)(a−b). This is an identity in R[a,b]. Note: a2+b2 is irreducible over R (factors only over C as (a+bi)(a−bi)).

How to read it: a2 and b2 are perfect squares. The minus sign between them is required. a and b can be any expression (e.g., a=2x, b=3).

Worked Examples

Example 1 — Factor a difference of squares

Easy

Factor 9x2−25.
Show the steps and the answer
  1. Check the pattern: two terms, a minus sign, and both are squares: 9x2=(3x)2 and 25=52.

    The coefficient 9 is a perfect square too, so the whole term 9x2 is the square of 3x.

  2. Name a=3x and b=5.

    The formula uses what was squared, not the squares themselves.

  3. Write (a+b)(a−b)=(3x+5)(3x−5).

    The sum of the square roots times their difference gives the two factors.

  4. Check: (3x+5)(3x−5)=9x2−15x+15x−25=9x2−25.

    The cross terms −15x and +15x cancel, which is exactly why there is no middle term.

Answer: (3x+5)(3x−5)

Takeaway: Take the square root of each term, coefficients included, then write sum times difference.

Example 2 — A trinomial in disguise

Standard

Factor x2−6x+9. Is it a difference of squares?
Show the steps and the answer
  1. Count the terms: three, including the middle term −6x.

    A difference of squares has exactly two terms, so the pattern does not apply even though x2 and 9 are squares.

  2. Test a2−2ab+b2 with a=x, b=3: 2ab=6x.

    The middle term matches −2ab, so the trinomial is the square of a single binomial.

  3. Write (x−3)2 and check: (x−3)(x−3)=x2−3x−3x+9=x2−6x+9.

    Here the cross terms add instead of cancelling, which is where the middle term comes from.

  4. Compare with x2−9=(x+3)(x−3).

    Opposite signs in the brackets make the cross terms cancel; the same sign makes them combine into −6x.

Answer: (x−3)2

Takeaway: Two squares with a minus and no middle term: difference of squares. A middle term ±2ab: perfect-square trinomial.

Example 3 — Find the mistake: stopping one step early

Application

Lin factors 2x4−32 and writes: "2(x2+4)(x2−4), done." Find the mistake and correct it.
Show the steps and the answer
  1. Check Lin's steps: the GCF 2 gives 2(x4−16), and x4−16=(x2)2−42=(x2+4)(x2−4).

    Both moves are correct; the question is whether the result is fully factored.

  2. Inspect each factor: x2−4=x2−22 is itself a difference of squares.

    A factor that still fits the pattern can be split again, so Lin stopped too soon.

  3. Factor it: x2−4=(x+2)(x−2). Leave x2+4 alone.

    x2+4 is a sum of squares, which has no real factors.

  4. Check at x=3: 2(81)−32=130, and 2(13)(5)(1)=130.

    The full factorization gives the original value, and every factor is now as small as it can go.

Answer: 2(x2+4)(x+2)(x−2)

Takeaway: After each step, test every new factor against the pattern again; stop at sums of squares and linear factors.

Where You'll See It

  • Multiplying numbers near a round number

    Write both numbers around 50: 47×53=(50−3)(50+3)=502−32=2500−9=2491. Any two numbers the same distance either side of an easy square multiply this way, which turns a two-digit multiplication into one square and one subtraction.

  • Area of a ring-shaped path

    A circular pond of radius 4 m has a path around it out to radius 5 m. The path's area is π(52−42)=π(5+4)(5−4)=9π≈28.3 m². The factored form shows the area is π times the sum of the radii times the path's width.

Common Mistakes

  1. The slip: Trying to factor a2+b2 the same way

    Instead: a sum of squares does not factor over the reals; only the difference does.

  2. The slip: Stopping after one step on x4−16

    Instead: refactor the new difference of squares: (x2−4)(x2+4)=(x−2)(x+2)(x2+4).

  3. The slip: Forgetting a coefficient is a square too

    Instead: 4x2−9 has a=2x, b=3, giving (2x+3)(2x−3), not (2x+9)(2x−1).


Mini Practice

Try these on your own. Tap Reveal when you want to check.

  1. Factor x2−81 as a difference of squares.

    Hint: 81 is the square of which number?

  2. Factor 16y2−49 as a difference of squares.

    Hint: Write 16y2 as something squared.

  3. Factor 2x2−50 completely, as far as it will go.

    Hint: Neither term is a perfect square yet. Look for a common factor.

  4. Factor x4−81 completely over the real numbers.

    Hint: After one step, check whether one factor is again a difference of squares.

  5. Which of x2+36, x2−36 and x2−12x+36 is a difference of squares? Factor that one.

    Hint: A difference of squares has exactly two terms joined by a minus.

  6. A student factors 25x2−4 as (25x+2)(x−2). Find the mistake.

    Hint: What do you square to get 25x2?

Want the full set?

50 practice questions for this concept — free to try, every one with a complete worked solution showing the why, not just the answer.

Frequently Asked Questions

Why does a2+b2 not factor, when a2−b2 does?

If x2+9x^2 + 9 split into real factors (x+p)(x+q)(x + p)(x + q), then x=−px = -p would make it zero. But x2+9x^2 + 9 is at least 9 for every real xx, so it has no real zeros and no real factors. With complex numbers it does split: x2+9=(x+3i)(x−3i)x^2 + 9 = (x + 3i)(x - 3i), since i2=−1i^2 = -1 turns the plus into the minus that the rule needs.

How does a2−b2 help multiply numbers like 31×29 in my head?

Write both numbers around their midpoint: 31×29=(30+1)(30−1)=302−12=89931 \times 29 = (30 + 1)(30 - 1) = 30^2 - 1^2 = 899. It works for any two numbers the same distance from an easy square: 47×53=502−32=2500−9=249147 \times 53 = 50^2 - 3^2 = 2500 - 9 = 2491. The further apart the numbers, the bigger the square you subtract.

Does x2−5 count as a difference of squares?

It depends on what kind of numbers the question allows. Over the real numbers, yes: 5=(5)25 = (\sqrt{5})^2, so x2−5=(x+5)(x−5)x^2 - 5 = (x + \sqrt{5})(x - \sqrt{5}), and the zeros are ±5\pm\sqrt{5}. Over the integers it does not factor, because 5 is not a perfect square. When a textbook says factor completely without saying more, it usually means with integers.

Learning Path

Factoring Difference of Squares

You are here

You need Factoring (writing an expression as a product) and Polynomials (terms and degree) first. This concept adds a one-step pattern for two-term expressions, square minus square, which comes from the cancelling cross terms in (a+b)(a−b). Next, Factoring Trinomials handles three-term quadratics, and Simplifying Rational Expressions often depends on spotting x2−9=(x+3)(x−3) in a numerator or a denominator.

See Also