Put two expansions side by side. (a+b)(a-b) collapses to just two terms, a^2 - b^2. (a+b)(a+b) refuses to collapse — it stays at three terms, a^2 + 2ab + b^2. Both start with two brackets, each containing the same two letters, multiplied out the same way. What could possibly be different?
Exactly one thing: the sign between a and b in the second bracket. In the first product it is a minus; in the second it is a plus. That one sign change routes the arithmetic through two completely different endings. To see why, you have to look past the final answers and watch the middle — the cross terms — do their work.
Full expansion of (a+b)(a-b)
FOIL the product. Four pieces come out: First, Outer, Inner, Last.
- First: a \cdot a = a^2.
- Outer: a \cdot (-b) = -ab.
- Inner: b \cdot a = +ab.
- Last: b \cdot (-b) = -b^2.
Line them up:
Now stare at the middle two terms. One is -ab, the other is +ab. They are the same number wearing opposite signs, and a number plus its opposite is zero. The middle collapses:
Four terms went in, two came out. The cross terms cancelled.
Full expansion of (a+b)(a+b)
Do the same FOIL on the plus-plus version.
- First: a \cdot a = a^2.
- Outer: a \cdot b = +ab.
- Inner: b \cdot a = +ab.
- Last: b \cdot b = +b^2.
Line them up:
Now stare at the middle two terms again. Both are +ab. They are the same number wearing the same sign, and a number plus itself is double. The middle does not collapse — it combines:
Four terms went in, three came out. The cross terms added.
The key — signs of the cross terms
Strip everything away and look only at the Outer and Inner pieces. Those are the cross terms, and they are the entire story.
- In (a+b)(a-b): Outer is +ab, Inner is -ab. Opposite signs. They cancel.
- In (a+b)(a+b): Outer is +ab, Inner is +ab. Same signs. They add to 2ab.
- In (a-b)(a-b): Outer is -ab, Inner is -ab. Same signs. They add to -2ab.
The first and last terms (a^2 and b^2 in one form or another) do not care about the sign experiment — they always survive. It is only the middle pair that is sensitive, and the sign between a and b decides their fate.
The three identities, all useful
Out of this single observation pop the three most famous algebraic identities of your school career.
The first two are twin squares — same terms, only the sign on the cross term flips. The third is the special case where the cross terms kill each other off completely, leaving a difference of two squares. Memorising these three is not optional; they will appear in every chapter of algebra you meet from now until JEE Advanced.
Why the "difference of squares" is so useful
The third identity has a superpower the other two do not. It lets you go backwards — from an expression with two terms to a product with two brackets. That is factoring.
If you see x^2 - 9, you can rewrite it instantly as x^2 - 3^2, which is a difference of squares. So it must be (x-3)(x+3). No long division, no guessing, no quadratic formula. Just pattern recognition.
Even irrational squares work. x^2 - 5 is x^2 - (\sqrt{5})^2, so (x - \sqrt{5})(x + \sqrt{5}). That factoring trick is how you solve equations like x^2 = 5 without memorising a formula.
The pattern appears everywhere: simplifying fractions, rationalising denominators, solving equations, evaluating trigonometric expressions, proving identities. You will meet it again and again.
Worked factoring examples
Here are three standard factorings using the difference of squares. In each case, you identify which two perfect squares are being subtracted, then write the pair of brackets.
- a^2 - 4 = a^2 - 2^2 = (a-2)(a+2).
- 9x^2 - 16 = (3x)^2 - 4^2 = (3x - 4)(3x + 4). The trick is to see 9x^2 as (3x)^2 — both the coefficient and the variable get squared.
- x^4 - 1 = (x^2)^2 - 1^2 = (x^2 - 1)(x^2 + 1). And now the first factor is itself a difference of squares, so (x^2 - 1) = (x-1)(x+1), giving x^4 - 1 = (x-1)(x+1)(x^2 + 1). The identity applied twice.
Why the perfect-square doesn't collapse the same way
You might ask: if (a+b)(a-b) collapses from four terms to two, and (a+b)(a+b) collapses from four terms to three, can we push the perfect square down to two terms as well? No. It is already as simple as it will get.
a^2 + 2ab + b^2 can be folded back into (a+b)^2 — one bracket, one exponent — but once you expand it out, three terms is the minimum. There is no pair of opposite-signed terms hiding inside to cancel, because both cross terms came out positive.
Same story for (a-b)^2 = a^2 - 2ab + b^2. Compact form has one bracket; expanded form has three terms. The middle term -2ab is just as essential as the a^2 and the b^2.
You cannot "save a term" by dropping the middle. Writing (a+b)^2 = a^2 + b^2 — the freshman's dream — loses exactly that missing 2ab, which is usually a large chunk of the answer. See the (a+b)^2 tiles widget if you want to see the missing term as an actual shape.
Pattern recognition
When you meet an expression and want to factor it, the shape of the expanded form tells you which identity to reach for.
- Two terms of the form X^2 - Y^2 — a difference of squares. Factor as (X - Y)(X + Y).
- Three terms of the form X^2 + 2XY + Y^2 — a perfect square. Factor as (X + Y)^2.
- Three terms of the form X^2 - 2XY + Y^2 — a perfect square with a minus. Factor as (X - Y)^2.
Count the terms first, check the signs second, identify X and Y third. The whole process takes two seconds once the patterns are in your eye.
Quick drill
Read each of these from left to right, then cover the answer and read it from right to left. Both directions should feel automatic.
- x^2 - 25 = (x - 5)(x + 5).
- x^2 + 10x + 25 = (x + 5)^2.
- x^2 - 10x + 25 = (x - 5)^2.
- (x + 3)(x - 3) = x^2 - 9.
- (x + 3)^2 = x^2 + 6x + 9.
Notice how x^2 + 25 is missing from the list. It is not a difference of squares — it is a sum of squares, and over the real numbers it does not factor at all. The minus sign between the two squares is essential; plus signs between squares do not open up this trick.
Common confusions
Three mistakes show up over and over in school copybooks.
- "(a+b)^2 = a^2 + b^2." Wrong, and off by 2ab. The two cross terms are both +ab and they add, not cancel.
- "(a+b)(a-b) = a^2 + b^2." Wrong, and off by sign. For the formula to give +b^2 at the end, the Last term would need to be b \cdot b, not b \cdot (-b). The minus in the second bracket forces -b^2.
- "I can use difference-of-squares whenever I see a minus sign." Wrong — both terms must be perfect squares. x^2 - 7x has a minus, but 7x is not a square of anything simple; you factor it as x(x - 7) instead.
Beyond simple variables
The identity (X+Y)(X-Y) = X^2 - Y^2 does not care what X and Y are, as long as whatever they are behaves like ordinary numbers under multiplication. They can be variables, products, square roots, trig functions — anything.
- (3x + 2y)(3x - 2y) = (3x)^2 - (2y)^2 = 9x^2 - 4y^2.
- (\sin \theta + \cos \theta)(\sin \theta - \cos \theta) = \sin^2 \theta - \cos^2 \theta, which you will meet again in double-angle formulas.
- (\sqrt{a} + \sqrt{b})(\sqrt{a} - \sqrt{b}) = (\sqrt{a})^2 - (\sqrt{b})^2 = a - b, for a, b \geq 0. This is the trick behind rationalising denominators — you multiply top and bottom by the conjugate, and the irrational parts cancel via difference of squares.
Closing
One sign between two letters is all it takes. If the two brackets carry opposite signs between a and b, the Outer and Inner terms come out with opposite signs too, they cancel, and only two terms survive — the difference of squares. If the two brackets carry the same sign, the Outer and Inner come out matching, they add, and three terms survive — the perfect square.
Same four FOIL pieces in both cases. Same two letters. One flipped sign, two completely different destinies. Two identities for the price of one structural observation.