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.

Line them up:

(a+b)(a-b) = a^2 - ab + ab - b^2

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:

a^2 - ab + ab - b^2 = a^2 + 0 - b^2 = a^2 - b^2

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.

Line them up:

(a+b)(a+b) = a^2 + ab + ab + b^2

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:

a^2 + ab + ab + b^2 = a^2 + 2ab + b^2

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.

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.

(a+b)^2 = a^2 + 2ab + b^2
(a-b)^2 = a^2 - 2ab + b^2
(a+b)(a-b) = a^2 - b^2

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.

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.

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.

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.

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.

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.