This is one of the special products of binomials, and it is the fastest factoring pattern in algebra because it needs no guessing. The pattern is picky, though: it needs two perfect squares and a subtraction sign, and most lost points come from disguised versions or from forcing the pattern onto a sum.
Why does the difference of squares formula work?

Multiply the two brackets with the FOIL method and watch the middle:
The two middle terms are opposites, so they cancel. That cancellation is the entire mechanism. Factoring is just this multiplication read backward, and the brackets and are called conjugates because they differ only in one sign.
There is also a picture. Start with a square of side and cut a smaller square of side out of one corner. The leftover L-shape has area . Slice the L into two strips, one measuring by and the other measuring by , and slide them together. They form a rectangle with length and width , and the area is the same. The algebra is area bookkeeping.
Quick check
Answer:
How do you factor a difference of squares step by step?
The method is short, and the order matters more than it looks.
- Pull out any common factor first.
- Confirm there are exactly two terms with a minus sign between them.
- Check that each term is a perfect square: a square coefficient and only even exponents.
- Take the square root of each term to get and , then write .
- Ask whether either bracket factors again.
Example 1. Factor . Rewrite each term as a square by halving the exponents and taking square roots of the coefficients:
So and , which gives
A term is a perfect square when its coefficient is a square (1, 4, 9, 16, 25, 36, 49, 64, 81, 100) and every exponent is even. So and qualify, but and do not.
A difference of squares is really a trinomial with a zero middle term: . Factoring trinomials asks for two numbers with product and sum , which gives and . That explains why the brackets differ only in sign: the only way to get a zero sum is to use opposites.
Difference of squares with negatives, fractions and hidden squares
When the square comes second and the subtraction is hidden, reorder the terms. For , rewrite it as , which is , so
Pulling out instead gives . Both answers are correct because . The slip to avoid is writing and dropping the minus sign, which gives , the opposite of what was asked.
Fractions follow the same rule, because a fraction is a square when its numerator and denominator are both squares:
The sneakiest case is a whole expression acting as one of the squares.
Example 2. Factor . Here and , so
Check by expanding both sides. The original is , and . They match. The trap is to expand first and then hunt for a pattern; keeping the bracket intact is faster and safer.
How to factor a difference of squares completely

Most problems that lose points here are not wrong, just unfinished. Two habits fix that: take out the GCF first, and re-inspect every bracket afterward. A common factor can hide the pattern entirely, as in , so factoring out the GCF always comes first.
Example 3. Factor completely: .
Now , so
The second bracket is itself a difference of squares, , so
The bracket is a sum and stays. To verify, , then , and multiplying by 3 returns .
The pattern also surfaces after factoring by grouping. Take . Group it as , which equals , and the second bracket finishes as . The full answer is .
Why can’t you factor a sum of squares?
Try building from two real brackets. The product gives , and gives . A middle term either survives or cancels, and cancelling leaves a minus sign. No sign choice produces a plus.
A sharper argument uses roots. If had a real factor , then would make the expression zero. But is at least for every real , so it never touches zero. No real factor exists, which is why textbooks call it prime.
| Expression | Over the integers | Over the reals | Over the complex numbers |
|---|---|---|---|
| prime | same as reals | ||
| prime | prime |
The table shows where the method fails and what “fails” means: it depends on which numbers you allow. In a typical Algebra 1 or 2 course, integers or reals are the default, so is the answer “prime” or “cannot be factored.”
Because , a sum of squares does factor with imaginary numbers: . Check: .
One more wrinkle: a sum of squares with a common factor is still only partly factored until the factor is removed. Write , and stop there.
Quick check
Answer: prime
Difference of squares vs perfect square trinomial vs cubes
Three patterns look alike on a quick glance, and mixing them up is the classic error. A quick way to tell them apart:
- has two terms and a minus sign: difference of squares, .
- has three terms with the middle equal to twice the product of the roots: a perfect square trinomial, .
- has two terms but cubes: a difference of cubes, covered in factoring sum and difference of cubes, .
Count the terms first, then check the exponents. The exponent test settles most confusion: even exponents suggest squares, multiples of 3 suggest cubes.
Some expressions are both. Consider , which is and also . Use squares first:
Starting with cubes gives , which hides further factoring, since . The squares-first route reaches the full answer with less work.
Using the difference of squares for mental math
The formula works on plain numbers whenever two factors sit equally far from a round midpoint. To compute , note that and :
Try this: Compute in your head by writing it as . Then confirm with ordinary multiplication.
The same idea factors large numbers. Take , which sits just below . Since , it equals . This is Fermat’s factorization method, and it is why cryptographic systems avoid using two primes that are close together.
Differences of squares also reveal which whole numbers can be written that way. Every odd number equals , and every multiple of four, , equals . For example and . Numbers leaving remainder on division by , like and , can never be written this way, because the two factors and always have the same parity.
Where does the difference of squares show up in real problems?
The most common use is solving equations without the quadratic formula. For , write , so or . This links to the factor theorem: each root corresponds to a factor, and each factor to an -intercept on the graph. When a problem has this shape, factoring beats the heavy machinery in quadratic formula practice problems.
It also simplifies rational expressions. In
the factor cancels, with the restriction and kept from the original denominator.
Conjugates also remove roots from denominators. To rationalize , multiply the top and bottom by :
The same trick turns into the real number . In geometry, a washer with outer radius and inner radius has area .
Quick check
Answer:
How do you check a difference of squares factorization?
Multiply back. If the brackets are right, the middle terms cancel and you recover the original. If a middle term survives, the signs are wrong, which usually means both brackets carry the same sign.
A faster check substitutes a number. For , try . The original gives , and the factored form gives . Pick a value other than or , since those can hide errors.
The most expensive habit to catch is writing when the answer is . Squaring a difference gives , so , not . If the original has no middle term, the factored form must have opposite signs. For more mixed problems, work through factoring practice problems and test each answer by multiplying back.
Practice problems
0 of 5 solved
- Factor .
Answer:
Both terms are squares: and . Use with and . The result is . - Factor .
Answer:
Write and . So and . The result is . - Factor .
Answer:
Write and . So and . The result is . - Factor completely: .
Answer:
Pull out the GCF : . Now . So the full factorization is . - Factor completely: .
Answer:
Write . Then . The sum cannot be factored over the reals.
Common questions
What is the difference of squares formula?
It is . Any expression made of one perfect square minus another perfect square factors into the sum of the square roots times the difference of the square roots.
Can you factor a sum of squares like ?
Not with real numbers. Over the complex numbers it factors as , but in most algebra courses the answer for is simply prime.
Does equal ?
No. Squaring a difference gives , which has a middle term. The difference of squares has no middle term, because the cross terms cancel in .
How do you factor , where 7 is not a perfect square?
Over the integers it does not factor. Over the real numbers it does, because , giving .
Do you take out the GCF before using the difference of squares?
Yes. A common factor often hides the pattern, as in . Pulling it out first also keeps the numbers small.
Which whole numbers can be written as a difference of two squares?
Every odd number and every multiple of 4 can. Numbers that leave a remainder of 2 when divided by 4, such as 6 and 10, never can.