Search the complete library

What do you want to learn or calculate?

Quick linksAll calculatorsMath subjectsPractice questionsFormula library
← Algebra formulas

Difference of squares

Factor a subtraction of two perfect squares.

Algebra · Factoring
$$a^2-b^2=(a-b)(a+b)$$

Difference of squares is one of 2 factoring formulas in the algebra section of this library, and it is used at high school level.

Why difference of squares works

Multiply the two brackets out and you get four terms: a squared, plus ab, minus ab, minus b squared. The two middle terms are exact opposites, so they cancel and only the squares survive. That cancellation is the entire reason the pattern is so short.

What each symbol means

$a$ and $b$ are the square roots of the two terms.

Difference of squares: when it holds

The middle operation must be subtraction; $a^2+b^2$ does not factor this way over the reals.

When it stops applying

It never applies to a sum. There are no real numbers whose product is x squared + 9, because that expression is at least 9 for every real x and so never hits zero. Only in the complex numbers does it split, into (x + 3i)(x - 3i).

Difference of squares: a worked example

$9x^2-25=(3x-5)(3x+5)$.

The mistake to avoid

What people do: Factoring a sum of squares the same way, writing x squared + 9 as (x + 3)(x - 3).

Why it goes wrong: Expanding (x + 3)(x - 3) gives x squared - 9, not plus 9. The middle terms only cancel when the two brackets have opposite signs, and that forces a minus in the result.

Do this instead: Check the operation before you factor. Over the real numbers, leave a sum of two squares exactly as it is; it is already prime.

Difference of squares: step by step

  1. Name the unknown, and the unit the answer has to come out in.
  2. Match the symbols to your values. $a$ and $b$ are the square roots of the two terms.
  3. Check the conditions before substituting. The middle operation must be subtraction; $a^2+b^2$ does not factor this way over the reals.
  4. Substitute, keep exact values to the last line, then test the sign, size, and unit against a rough estimate — the check that catches most algebra slips.

Where this formula fits

Subject
Algebra formulas — 28 entries in this library
Topic
Factoring
Level
High school

Formulas are easiest to keep when they sit inside a method rather than on a list. Use the links below to see where difference of squares comes from, to check a calculation against a tool, and to practise it until you can recall it without looking.

Questions about difference of squares

Is x squared - 5 a difference of squares?

Yes, if irrational factors are allowed, since 5 is the square of the square root of 5. It factors as (x - root 5)(x + root 5), which many courses accept only when they ask for factoring over the reals.

Can I apply the pattern more than once?

Yes. Start with x to the fourth minus 16, which becomes (x squared - 4)(x squared + 4), and the first bracket splits again into (x - 2)(x + 2). The sum in the second bracket stops there.

Does it work when the squares have coefficients?

Yes, as long as the coefficient is a perfect square. In 9x squared - 25 the first term is (3x) squared and the second is 5 squared, giving (3x - 5)(3x + 5).

Is there a mental-arithmetic use for this?

Yes, for products that straddle a round number. Since 41 times 39 is 40 squared minus 1 squared, you can do it in your head and get 1600 minus 1, which is 1599.

Stuck on a problem?

Work a difference of squares problem step by step

Type your own problem, or upload a photo of it. You get the method, the answer, and a check you can repeat yourself.