How to spot a difference of squares and factor it in one line. Also: using it twice on x⁴ − 1, and a mental math trick for products like 51 × 49.

What is a difference of squares?

A difference of squares is an expression of the form a² − b²: one perfect square subtracted from another. It always factors as (a − b)(a + b).

x² − 25 is a difference of squares, because x² is the square of x and 25 is the square of 5. So x² − 25 = (x − 5)(x + 5). It’s one of the few factoring patterns you can do in a single line, with no trial and error.

a² − b² = (a − b)(a + b)
(a − b)(a + b) = a² + ab − ab − b²
= a² − b²

How do you recognize a difference of squares?

Check three things: there are exactly two terms, they are separated by a minus sign, and each term is a perfect square. If all three hold, the pattern applies.

Perfect square numbers are 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 and so on. A variable term is a perfect square when its exponent is even: x², x⁴, x⁶. So 81x² − 16 qualifies, but x² − 10 and x³ − 4 don’t (at least not over the integers).

How do you factor a difference of squares with coefficients?

Take the square root of each term to find a and b, including the coefficient. Then write (a − b)(a + b).

For 4x² − 9: the square root of 4x² is 2x, and the square root of 9 is 3. So a = 2x, b = 3.

4x² − 9 = (2x)² − 3²
= (2x − 3)(2x + 3)

What if the terms aren’t perfect squares?

When factoring difference of squares problems, look for a greatest common factor first. Pulling it out often leaves a difference of squares that wasn’t visible before.

2x² − 50 doesn’t look like the pattern, since 2 and 50 aren’t perfect squares. Factor out 2 and it does. The same thing happens with x³ − 9x after taking out x.

2x² − 50 = 2(x² − 25) = 2(x − 5)(x + 5)
x³ − 9x = x(x² − 9) = x(x − 3)(x + 3)

When do you use the pattern more than once?

If one of the factors is itself a difference of squares, factor it again. This happens with fourth powers.

x⁴ − 1 is (x²)² − 1², so it factors as (x² − 1)(x² + 1). But x² − 1 is another difference of squares. Factoring it gives the complete answer:

x⁴ − 1 = (x² − 1)(x² + 1)
= (x − 1)(x + 1)(x² + 1)

Does a sum of squares factor?

No. A sum of squares like x² + 9 does not factor over the real numbers. There’s no pair of real numbers that multiply to +9 and add to 0.

You can see it another way: x² + 9 = 0 would need x² = −9, and no real number squares to a negative. Over the complex numbers it does factor, as (x − 3i)(x + 3i), but in an algebra 1 or 2 class, “prime” or “does not factor” is the expected answer.

How does the difference of squares help with mental math?

When two numbers are the same distance from a round number, their product is the round number squared minus the distance squared. That makes 51 × 49 easy.

51 × 49 = (50 + 1)(50 − 1)
= 50² − 1²
= 2500 − 1 = 2499

How do you use it to solve equations?

Factor the difference of squares, then set each factor equal to zero. For x² − 36 = 0, factoring gives (x − 6)(x + 6) = 0, so x = 6 or x = −6.

The answers always come as a positive and negative pair. x² − 49 = 0 gives x = 7 or x = −7. A common slip is writing only the positive answer, which loses half the solutions.

This is often quicker than the quadratic formula when there is no x term. The quadratic equation solver will confirm the two answers.

What are the common mistakes?

The most common mistake is writing (a − b)² instead of (a − b)(a + b). (x − 5)² expands to x² − 10x + 25, which has a middle term, so it can’t equal x² − 25.

Another slip is forgetting to take the square root of the coefficient, which turns 4x² − 9 into (4x − 3)(4x + 3). People also stop after one step on x⁴ − 1, or try to factor a sum of squares. For more patterns like this, see our article on factoring formulas and patterns.

Frequently asked questions

How do you use difference of squares for mental math?

Write the product as (n + d)(n − d), where n is a round number. Then it equals n² − d². For 51 × 49 that is 2500 − 1 = 2499.

What is the difference of squares formula?

a² − b² = (a − b)(a + b). Any expression that is one perfect square minus another factors this way.

How do you factor 4x² − 9?

The square roots of the terms are 2x and 3, so 4x² − 9 = (2x − 3)(2x + 3).

Can you factor a sum of squares?

Not over the real numbers. x² + 9 has no real factors. It only factors with complex numbers, as (x − 3i)(x + 3i).

How do you factor x⁴ − 1 completely?

Use the pattern twice. x⁴ − 1 = (x² − 1)(x² + 1), and x² − 1 = (x − 1)(x + 1), so the full answer is (x − 1)(x + 1)(x² + 1).

Is x² − 10 a difference of squares?

Not over the integers, since 10 is not a perfect square. You could write it as (x − √10)(x + √10), but in most algebra classes x² − 10 is treated as not factorable.

References and further reading