Expand or Factor Special Products: (a±b)², a²−b²
Special products link a factored form — a product — to its expanded form — a sum of terms — without redoing the algebra every time. Pick the identity, enter two numbers a and b: the page expands it term by term, works out the factored form, and checks that both give the same result.
The identity and its two numbers
An asterisk after a term points to the glossary below.
Spotting (a±b)² and a²−b² in a mess of terms
Special products* are the three identities that turn up so often they are worth knowing in both directions: expand a product into a sum, or factor a sum back into a product, without redistributing every time.
(a + b)² = a² + 2ab + b²
(a − b)² = a² − 2ab + b²
a² − b² = (a + b)(a − b)
The first is the square of a sum, the second the square of a difference, the third the difference of squares*. Left-hand sides are products (or a square, which is a product). Right-hand sides are sums of terms. The same pair of numbers a and b can be letters, monomials, or whole expressions: a = 3x and b = 4 is a legal substitution in every line.
(3x + 4)² matches the first pattern. (5y − 2)² matches the second. (4t + 9)(4t − 9) matches the third. Factoring looks the other way: a three-term trinomial that is two squares plus or minus twice the product, or a two-term difference of squares.
These three live in algebra next to the quadratic solver, because completing the square is exactly the first identity, run backwards.
Why the middle term is there: distribution, not a slogan
Each identity is the distributive property, applied twice. For the square of a sum:
(a + b)² = (a + b)(a + b) = a·a + a·b + b·a + b·b = a² + 2ab + b²
US Algebra 1 often names that four-term expansion FOIL*: First, Outer, Inner, Last. It is a mnemonic for (a + b)(c + d), not a fifth operation. On (a + b)(a + b) the First is a², the Last is b², and Outer + Inner is ab + ba = 2ab. That is the whole middle term. Drop FOIL and distribution does the same job; keep it if the four labels help the four products stay visible.
(a − b)² is the same expansion with b replaced by −b. Then 2a(−b) = −2ab, and (−b)² is b² all the same. The difference of squares cancels its own middle: a·(−b) + b·a = 0, leaving a² − b². Three identities, one mechanism.
Area pictures that prove the identities
A square of side a + b has area (a + b)². Cut it into a square of side a, a square of side b, and two a-by-b rectangles. The areas add: a² + b² + 2ab. That is the first identity, drawn. The diagram on this page is that cutting, with the four regions labelled.
For (a − b)² the picture starts from a large square of side a and carves out a border of width b. What remains is a square of side a − b. Accounting for the two rectangles that were removed, and putting back the corner b² that was counted twice, yields a² − 2ab + b².
The difference of squares is an L-shaped leftover: square a² minus corner b². Slide the leftover into a rectangle of sides a + b and a − b. Same area, hence a² − b² = (a + b)(a − b). Euclid already had a version of this; the algebra is shorter, the picture is why the algebra is believed.
Factoring in the other direction
Expanding is mechanical. Factoring asks whether a given polynomial is one of the three patterns.
- a² + 2ab + b² → (a + b)². Two squares, plus twice the product, all positive relative to a and b.
- a² − 2ab + b² → (a − b)². Same squares, minus the double product.
- a² − b² → (a − b)(a + b). Two terms, both squares, minus in the middle.
16x² − 24x + 9 is (4x)² − 2·(4x)·3 + 3², so (4x − 3)². 49y² − 64 is (7y)² − 8², so (7y − 8)(7y + 8). A trinomial x² + 5x + 6 is not a special product of this family: the middle term is not twice a product of square roots of the ends. It factors, as (x + 2)(x + 3), but that is ordinary factoring, not one of these three identities.
That distinction matters. Special-product factoring is a shortcut for a matching pattern. It is not a replacement for the quadratic formula when the pattern is absent.
The missing 2ab, and the sign of −2ab
The classic error is (a + b)² = a² + b². That drops the two rectangles. For a = 5, b = 3 the left side is 64 and the right side is 25 + 9 = 34. The missing 30 is exactly 2ab. The identity is not optional decoration; it is most of the value when a and b are comparable.
The second classic error is the sign in (a − b)². The expanded form is a² − 2ab + b², not a² + 2ab − b², and not a² − 2ab − b². Both square terms stay positive. Only the middle term carries the minus. Checking with numbers (a = 5, b = 3: 4 = 25 − 30 + 9) settles arguments faster than a lecture.
(a + b)² is never a² + b² for general a and b. The cross term 2ab is the one that is forgotten, and the one that does most of the work in completing the square.
Mental arithmetic: 98² and 47×53
Special products are a pocket method, not only a homework method. Squares near a round number:
98² = (100 − 2)² = 10,000 − 400 + 4 = 9,604
103² = (100 + 3)² = 10,000 + 600 + 9 = 10,609
Products that sit equally far from a midpoint use the difference of squares: 47 × 53 = (50 − 3)(50 + 3) = 2,500 − 9 = 2,491. 19 × 21 = 400 − 1 = 399. The pattern is the same for 996 × 1,004, once 1,000 is spotted as the centre.
Instead of multiplying two messy two-digit numbers, the work is one square and one small square. That is why these identities survive outside the classroom: they shorten arithmetic that would otherwise need a device.
(a+b+c)² and a few cousins
The square of a sum of three terms is not a fourth “classic” identity in the usual list, but it is the same idea:
(a + b + c)² = a² + b² + c² + 2ab + 2ac + 2bc
Squares of each term, plus twice every pairwise product. (3x + y + 2)² = 9x² + y² + 4 + 6xy + 12x + 4y. The count of cross terms grows with the number of summands: n letters produce n squares and n(n − 1) ordered pairs, halved into the 2ab-style terms.
Cubes have their own identities, (a ± b)³ = a³ ± 3a²b + 3ab² ± b³, and the difference of cubes a³ − b³ = (a − b)(a² + ab + b²). Those are no longer this page’s three, but they are the next shelf in the same cupboard. The online calculator will expand a numerical instance; it will not name the pattern.
Completing the square is a special product in disguise
To solve x² + 8x + 7 = 0 by completing the square, the first two terms are read as the start of (x + 4)², because 2 · 4 = 8. Then (x + 4)² = x² + 8x + 16, so x² + 8x + 7 = (x + 4)² − 9. The equation becomes (x + 4)² = 9, hence x + 4 = ±3, so x = −1 or x = −7.
That rewrite is (a + b)² = a² + 2ab + b², with a = x and b = 4. The quadratic formula is this move, carried out with letters instead of 8 and 7. The vertex form a(x − h)² + k on the quadratic page is the same identity, kept as a graph, not as an equation set to zero.
After all, the reason (x + p/2)² appears in every derivation is that 2 · (p/2) recovers the linear coefficient p. Special products are not a side topic. They are the engine of the quadratic.
Worked expansions and factorizations
Expand (5x − 3)². (5x)² − 2·(5x)·3 + 3² = 25x² − 30x + 9.
Factor 49y² − 64. (7y)² − 8² = (7y − 8)(7y + 8).
Simplify (x + 5)² − (x − 2)(x + 2). The first square is x² + 10x + 25. The second product is a difference of squares, x² − 4. Subtract: x² + 10x + 25 − x² + 4 = 10x + 29. The two x² terms cancel; what remains is linear. Sign of the minus in front of (x² − 4) is the usual trap: it flips both terms.
Expand (2a − b + 3)². Squares 4a² + b² + 9, cross terms 2(2a)(−b) + 2(2a)(3) + 2(−b)(3) = −4ab + 12a − 6b. Altogether 4a² + b² + 9 − 4ab + 12a − 6b.
Numerical check on this page: pick an identity, type two numbers, and read both the expanded stack and the factored value. They must match. If they do not, the identity was applied with the wrong sign, or 2ab was dropped.
What FOIL does not cover
FOIL is built for two binomials. It does not expand (a + b + c)², and it does not factor a² − b² until someone first writes (a − b)(a + b). Treating FOIL as the name of all polynomial arithmetic is a classroom bottleneck: students who can FOIL (x + 3)(x + 5) stall on (x + 3)², because they look for four different letters.
A sturdier habit is to name the pattern. Square of a sum, square of a difference, difference of squares. FOIL remains available as a check: four products, then combine like terms. If the four products are not written, the middle term is the one that goes missing — which is how a² + b² keeps being offered as a square.
In short, FOIL is a ladder. The identities are the wall. Once the three lines are recognized on sight, the ladder is optional.
Binomial squares on a number line
Another picture, without areas: a and a + b as two positions. The square of the farther one is the square of the nearer, plus twice the nearer times the step, plus the square of the step. That is (a + b)² again, read as a finite difference. It is also why a table of squares has a second difference of 2: going from n² to (n+1)² adds 2n + 1, the discrete derivative of x².
That observation is calculus in embryo. It is also a mental-math device: 41² = 40² + 2·40·1 + 1 = 1,600 + 80 + 1 = 1,681. Same identity, smaller numbers than 98², same 2ab sitting in the middle.
When a and b are not both positive
The identities hold for every real a and b, and for complex numbers too. Negative b in (a + b)² is just (a − |b|)², which is the second identity. The geometric pictures assume positive lengths, so they illustrate the signed case; they do not prove it. Algebra does the rest.
If a = −b, then (a + b)² = 0 and a² − b² = 0 as well. If a = b, the difference of squares vanishes and (a − b)² vanishes. Those are not extra identities; they are the three formulas at special values. The calculator reports both writings equal to zero, which is the correct check, not a failure.
Glossary
- Special product
- An algebraic identity used so often it is memorized in both directions. The three in play here are (a+b)², (a−b)², and a²−b². English curricula say “special products”; there is no single everyday equivalent of the French “identités remarquables.”
- Difference of squares
- The identity a² − b² = (a + b)(a − b). Two square terms with a minus between them factor as a sum times a difference. The geometric picture is a square with a smaller square cut from a corner, rearranged into a rectangle.
- FOIL
- A US school mnemonic for expanding two binomials: First, Outer, Inner, Last. On (a+b)(a+b) it produces a², ab, ba, and b², which combine to a² + 2ab + b². It is a memory aid for the distributive property, not a separate rule, and it does not by itself handle three-term squares.