Expansion takes a compact expression like (a + b)^2 and pulls it apart into four pieces: a^2, ab, ab, b^2. Factoring is exactly the same film, run in reverse. The four pieces slide back into a single square, and the compact form re-forms. If you have ever factored x^2 + 10x + 25 and felt the answer (x + 5)^2 appear as if by magic, this page is the frame-by-frame of what your intuition was doing.
Expansion and factoring are not two different skills. They are one move seen from two directions. Reading left-to-right gives expansion. Reading right-to-left gives factoring. Every algebraic identity is therefore a factoring rule in disguise, which is why memorising a small handful of identities lets you factor a huge range of expressions.
The widget
Set a and b with the sliders. Press Play and the four area tiles — a^2, ab, ab, b^2 — fly in from the edges of the canvas and snap together into the single (a + b) \times (a + b) square. Press Reverse to run the animation the other way: the square cracks into four pieces and each piece is labelled with its area. The readout on the right shows the numbers agreeing to the last digit.
Factoring is expansion, reversed
When you expand (a + b)^2, the distributive law works four times. One copy of (a + b) is multiplied by each term of the other copy, giving a \cdot a + a \cdot b + b \cdot a + b \cdot b = a^2 + 2ab + b^2. That is a forward move — you start with a compact form and end with a sum of four terms.
Factoring starts from the sum a^2 + 2ab + b^2 and asks: can this be written as a product? The answer is yes, and the product is (a + b)^2. Nothing new is happening — you are reading the same identity from right to left. The widget above makes the reversal literal: the same tiles that represent the expanded form physically slide into the square that represents the factored form.
This is the point. Every one of the expansion identities you meet in Algebraic Identities is also a factoring identity. Once you know an identity in the forward direction, you know it in the reverse direction too, for free.
Three identities worth memorising
The perfect square: a^2 + 2ab + b^2 = (a + b)^2
This is the one the widget shows. The cue is the presence of two perfect squares — a^2 and b^2 — and a middle term equal to twice the product of their square roots. If you see x^2 + 10x + 25, you check: is 25 a perfect square? Yes, 25 = 5^2. Is the middle term 10x equal to 2 \cdot x \cdot 5 = 10x? Yes. So the expression factors as (x + 5)^2.
The negative version is the same geometry with a sign: a^2 - 2ab + b^2 = (a - b)^2. Here the two ab tiles are subtracted rather than added, which corresponds to cutting them out of the big square instead of filling them in.
The difference of squares: a^2 - b^2 = (a + b)(a - b)
No middle term at all — just a square minus a smaller square. The factorisation is the most used identity in school algebra. The geometric picture is a big a \times a square with a b \times b square cut out of one corner. Rearranging the remaining L-shape into a rectangle shows its dimensions are (a + b) and (a - b), so the area is (a + b)(a - b).
This identity is why 99 \times 101 = 100^2 - 1^2 = 9999 can be done in your head: write it as (100 - 1)(100 + 1) and apply the identity backwards. It is also why x^2 - 9 = (x + 3)(x - 3) is obvious at a glance, and why x^4 - 16 = (x^2 - 4)(x^2 + 4) = (x - 2)(x + 2)(x^2 + 4) can be factored by applying the identity twice.
The sum of cubes: a^3 + b^3 = (a + b)(a^2 - ab + b^2)
This one is less visually obvious, but follows from expanding the right side and watching the middle terms cancel. (a + b)(a^2 - ab + b^2) = a^3 - a^2b + ab^2 + a^2b - ab^2 + b^3 = a^3 + b^3. Four of the six middle terms cancel in pairs. The factoring cue is exactly what it says: a cube plus a cube. If you see x^3 + 8, write it as x^3 + 2^3 and apply the identity to get (x + 2)(x^2 - 2x + 4).
There is a twin identity for differences: a^3 - b^3 = (a - b)(a^2 + ab + b^2). The signs are flipped on the linear factor and on the middle term of the quadratic factor, but the structure is the same.
The geometric picture for the first identity
The picture is the one in the widget, but it is worth stating in words. Take a square of side a + b. Draw a horizontal line at height a and a vertical line at width a. These two cuts divide the square into four regions:
- the bottom-left, a square of side a with area a^2;
- the bottom-right, a rectangle of width b and height a with area ab;
- the top-left, a rectangle of width a and height b with area ab;
- the top-right, a square of side b with area b^2.
The four areas sum to the total area of the big square: a^2 + ab + ab + b^2 = a^2 + 2ab + b^2. But the big square has side a + b, so its area is also (a + b)^2. The two expressions for the same area must be equal, which is the identity.
Factoring reverses the cut. Starting from four separate tiles, you translate them back into their positions inside the big square, and the outline of that square is the factored form (a + b)^2.
Checking with numbers
Set a = 3 and b = 5. The widget's readout says a^2 + 2ab + b^2 = 9 + 30 + 25 = 64, and (a + b)^2 = 8^2 = 64. Same total, different names. The widget does this check live whenever you move the sliders, which is the quickest way to build confidence that the identity is not a piece of magic but a statement about the same quantity counted two ways.
The same check works for the other identities. Difference of squares: a = 7, b = 3, so a^2 - b^2 = 49 - 9 = 40, and (a + b)(a - b) = 10 \cdot 4 = 40. Sum of cubes: a = 2, b = 3, so a^3 + b^3 = 8 + 27 = 35, and (a + b)(a^2 - ab + b^2) = 5 \cdot (4 - 6 + 9) = 5 \cdot 7 = 35.
Related
- Algebraic Expressions — the parent article for vocabulary and operations.
- Algebraic Identities — the forward-direction catalogue of the same rules.
- Animated Distributive Property: a(b + c) Unfolds Into ab + ac — the area model for the single-factor case.