Difference of Squares Formula a2 - b2 with Examples

#Formula
TL;DR
The difference of squares formula factors a2−b2a^2 - b^2 into (a+b)(a−b)(a+b)(a-b). This article gives the proof, five worked examples, and why the sum of squares behaves differently.
BT
Bhanzu TeamLast updated on November 7, 20266 min read

Key Points

  • The difference of squares formula is a2−b2=(a+b)(a−b)a^2 - b^2 = (a+b)(a-b), factoring a subtraction of two squares into two brackets.

  • Expanding (a+b)(a−b)(a+b)(a-b) cancels the two middle terms, −ab-ab and +ab+ab, which is why no middle term survives.

  • The sum of squares a2+b2a^2 + b^2 does not factor over the real numbers, so the pattern works only for subtraction.

  • The formula turns awkward multiplications into easy ones, since 97×10397 \times 103 becomes 1002−32100^2 - 3^2.

  • Either aa or bb can itself be a compound expression, so x4−16x^4 - 16 factors twice by applying the pattern again.

What Is the Difference of Squares Formula?

The difference of squares formula factors any expression that is one square subtracted from another:

a2−b2=(a+b)(a−b)a^2 - b^2 = (a+b)(a-b)

It is one member of the standard family of algebraic identities. This article treats that one identity in depth; the algebraic identities page sets out the family together.

Why the Middle Terms Vanish

Multiply the two brackets out term by term and the structure becomes obvious:

(a+b)(a−b)=a2−ab+ba−b2(a+b)(a-b) = a^2 - ab + ba - b^2

The two middle terms are −ab-ab and +ba+ba. Since ab=baab = ba, they are equal in size and opposite in sign, so they cancel exactly and leave a2−b2a^2 - b^2.

That cancellation is the whole mechanism, and it is also why the sum of squares does not factor this way. To get a2+b2a^2 + b^2 the middle terms would still have to cancel while the last term came out positive, which would need −b2-b^2 to become +b2+b^2. No pair of real brackets does that.

Variable Key

Symbol

Meaning

Unit or type

Notes

aa

square root of the first term

any expression

can itself be compound

bb

square root of the second term

any expression

can itself be compound

a2−b2a^2 - b^2

the difference of squares

expression

the form to recognise

(a+b)(a−b)(a+b)(a-b)

the factored form

expression

order of brackets does not matter

Examples of the Difference of Squares Formula

Example 1

Factor x2−49x^2 - 49.

Here a=xa = x and b=7b = 7, since 49=7249 = 7^2:

x2−49=(x+7)(x−7)x^2 - 49 = (x+7)(x-7)

Final answer: (x+7)(x−7)(x+7)(x-7)

Example 2

Factor x2+25x^2 + 25.

The pattern is fresh in mind, so applying it gives (x+5)(x−5)(x+5)(x-5). Expand that to check:

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

That is x2−25x^2 - 25, not x2+25x^2 + 25. The sign of the final term came out negative, because the identity only ever produces a subtraction.

A sum of two squares has no factorisation over the real numbers, so x2+25x^2 + 25 is already in its simplest real form.

Final answer: x2+25x^2 + 25 does not factor over the reals. The difference of squares pattern requires a minus sign between the terms.

Example 3

Factor 9y2−649y^2 - 64.

Both terms are squares, with 9y2=(3y)29y^2 = (3y)^2 and 64=8264 = 8^2:

9y2−64=(3y+8)(3y−8)9y^2 - 64 = (3y+8)(3y-8)

Final answer: (3y+8)(3y−8)(3y+8)(3y-8)

Example 4

Factor x4−16x^4 - 16 completely.

First pass takes a=x2a = x^2 and b=4b = 4:

x4−16=(x2+4)(x2−4)x^4 - 16 = (x^2+4)(x^2-4)

The second bracket is itself a difference of squares, so apply the pattern again:

=(x2+4)(x+2)(x−2)= (x^2+4)(x+2)(x-2)

Final answer: (x2+4)(x+2)(x−2)(x^2+4)(x+2)(x-2)

The first bracket is a sum of squares and stops there, which is the signal that the factorisation is complete over the reals.

Example 5

Compute 97×10397 \times 103 mentally.

Both numbers sit 3 away from 100, so write them as 100−3100 - 3 and 100+3100 + 3:

97×103=(100−3)(100+3)=1002−32=10000−9=999197 \times 103 = (100-3)(100+3) = 100^2 - 3^2 = 10000 - 9 = 9991

Final answer: 9,991

Any pair of numbers equally spaced either side of a round figure multiplies this way, which turns a two-digit multiplication into a subtraction.

Don't Confuse This With the Other Square Identities

Identity

Expansion

Middle term

a2−b2a^2 - b^2

(a+b)(a−b)(a+b)(a-b)

cancels

(a+b)2(a+b)^2

a2+2ab+b2a^2 + 2ab + b^2

+2ab+2ab

(a−b)2(a-b)^2

a2−2ab+b2a^2 - 2ab + b^2

−2ab-2ab

a2+b2a^2 + b^2

no real factorisation

n/a

The first row is the only one of the four that factors a subtraction into two different brackets. The two squared-bracket rows produce a middle term rather than losing one, which is the quickest way to tell them apart.

Where Do Students Trip Up on the Difference of Squares?

Mistake 1: Applying the pattern to a sum of squares

Where it slips in: The two terms are squares and the formula is memorable, so the sign between them gets overlooked.

Don't do this: x2+25=(x+5)(x−5)x^2 + 25 = (x+5)(x-5)

The correct way: Check the sign first. Only a2−b2a^2 - b^2 factors this way, and (x+5)(x−5)(x+5)(x-5) expands back to x2−25x^2 - 25.

Students who expand their own answer before moving on catch this immediately, because the expansion returns a minus sign that was not in the question. Expanding a factorisation is a complete check, not a partial one, and it costs one line.

Mistake 2: Missing a common factor first

Where it slips in: The expression looks like a difference of squares, so the pattern gets applied before anything else.

Don't do this: Factor 2x2−182x^2 - 18 as (2x+18)(2x−18)(\sqrt{2}x+\sqrt{18})(\sqrt{2}x-\sqrt{18}).

The correct way: Take out the common factor 2 first, giving 2(x2−9)=2(x+3)(x−3)2(x^2-9) = 2(x+3)(x-3). Checking for a common factor before any identity keeps the brackets free of surds.

Mistake 3: Stopping after one application

Where it slips in: The first factorisation looks finished, and the resulting brackets are not re-examined.

Don't do this: Leave x4−16x^4 - 16 as (x2+4)(x2−4)(x^2+4)(x^2-4).

The correct way: Test every bracket again. The x2−4x^2-4 factors further into (x+2)(x−2)(x+2)(x-2), and only a sum of squares or a non-square tells you to stop.

Key Takeaways

  • The difference of squares formula is a2−b2=(a+b)(a−b)a^2 - b^2 = (a+b)(a-b).

  • The middle terms cancel because −ab-ab and +ba+ba are equal and opposite, which is the whole mechanism.

  • A sum of squares does not factor over the reals, so the minus sign is a precondition rather than a detail.

  • Check for a common factor first, then apply the pattern repeatedly until only sums of squares remain.

  • To work through algebraic identities with a teacher, explore an algebra tutor or math classes online.

A Practical Next Step

Factor 16x2−8116x^2 - 81 and x4−1x^4 - 1 completely. Then compute 48×5248 \times 52 mentally using the identity, and expand each answer to confirm it.

Want a live Bhanzu trainer to walk through more algebra problems? Book a free demo class.

Read More

Was this article helpful?

Your feedback helps us write better content

Frequently Asked Questions

What is the difference of squares formula?
a2−b2=(a+b)(a−b)a^2 - b^2 = (a+b)(a-b). One square minus another factors into their sum times their difference.
Does the difference of squares formula work for a sum of squares?
No. a2+b2a^2 + b^2 has no factorisation over the real numbers, and applying the pattern to it produces a sign error.
Why do the middle terms disappear?
Because expanding gives −ab+ba-ab + ba, two equal terms of opposite sign, which cancel exactly.
Can the difference of squares formula be used more than once on one expression?
Yes. x4−16x^4 - 16 factors to (x2+4)(x2−4)(x^2+4)(x^2-4) and then to (x2+4)(x+2)(x−2)(x^2+4)(x+2)(x-2), since the second bracket is itself a difference of squares.
✍️ Written By
BT
Bhanzu Team
Content Creator and Editor
Bhanzu’s editorial team, known as Team Bhanzu, is made up of experienced educators, curriculum experts, content strategists, and fact-checkers dedicated to making math simple and engaging for learners worldwide. Every article and resource is carefully researched, thoughtfully structured, and rigorously reviewed to ensure accuracy, clarity, and real-world relevance. We understand that building strong math foundations can raise questions for students and parents alike. That’s why Team Bhanzu focuses on delivering practical insights, concept-driven explanations, and trustworthy guidance-empowering learners to develop confidence, speed, and a lifelong love for mathematics.
Related Articles
Book a FREE Demo ClassBook Now →