Education

Difference of Squares Calculator

Factor expressions in the form Ax² − B using the difference of squares pattern. The calculator checks both square roots, gives the conjugate factors, and explains when the shortcut does not apply.

difference-of-squares-calculator
Enter a binomial in the form Ax² − B. The calculator checks whether A and B are perfect squares and then factors it as a difference of squares.
Factored form
Original expression
First square
Second square
Pattern check

What makes something a difference of squares?

A difference of squares has two parts: both terms are perfect squares, and the operation between them is subtraction. That is why 9x² - 16 factors nicely, but 9x² + 16 does not use the same real-number pattern. The word “difference” is important because it means subtraction.

OpenStax explains this special product pattern in its section on factoring special products. The same pattern appears again in broader polynomial factoring lessons because it is one of the fastest shortcuts students can recognize.

Difference of squares formula

a² - b² = (a - b)(a + b)

The two factors are conjugates: the same two terms with opposite signs. When you multiply them, the middle terms cancel, leaving only the first square minus the second square.

Worked example: factor 25x² - 49

25x² - 49 25x² = (5x)² 49 = 7² Use a² - b² = (a - b)(a + b): 25x² - 49 = (5x - 7)(5x + 7)

A quick way to check the answer is to multiply the factors. The outside and inside terms cancel: 35x - 35x = 0, leaving 25x² - 49.

Why a sum of squares usually does not factor in algebra class

Students often try to factor x² + 9 as (x + 3)(x - 3), but that product is x² - 9, not x² + 9. Over the real numbers, a basic sum of squares does not factor into real linear factors. In more advanced classes with complex numbers, sums of squares can be factored using i, but that is not the usual school-level factoring pattern.

Common difference-of-squares forms

ExpressionFactored form
x² - 16(x - 4)(x + 4)
4x² - 25(2x - 5)(2x + 5)
49x² - 1(7x - 1)(7x + 1)

Common questions

  • Rewrite each term as a square and then use a² - b² = (a - b)(a + b). For example, 36x² - 25 becomes (6x)² - 5², so the factored form is (6x - 5)(6x + 5). The expression must have subtraction between the two square terms.
  • There are two main requirements. First, both terms must be perfect squares, such as x², 9x², 16, 25, or 49y². Second, the expression must be a difference, meaning subtraction. If the expression is a sum of squares, the usual real-number difference-of-squares shortcut does not apply.
  • No. x² and 9 are both perfect squares, but the expression uses addition, not subtraction. The difference-of-squares formula is a² - b², not a² + b². Over complex numbers, x² + 9 can be written as (x - 3i)(x + 3i), but that is beyond the usual real-number factoring method.
  • Yes. A coefficient like 4, 9, 16, 25, or 36 works because it has a whole-number square root. For example, 16x² is (4x)². If the coefficient is not a perfect square, the expression may still factor in another way, but it is not a clean difference-of-squares problem in this calculator.
  • The factors have opposite signs because the middle terms must cancel. When you multiply (a - b)(a + b), you get a² + ab - ab - b². The +ab and -ab cancel, leaving a² - b². That cancellation is the whole reason the pattern works.
  • Often, yes. If every term has a greatest common factor, factor it out before applying the difference of squares pattern. For example, 3x² - 27 is not immediately a clean difference of squares, but factoring out 3 gives 3(x² - 9), and x² - 9 factors as (x - 3)(x + 3).
  • Yes. The variable name does not matter. The pattern works for y² - 64, 25a² - 81, or 4m² - 49. Any expression that can be rewritten as one square minus another square can use the same conjugate-factor pattern.
  • Multiply the two factors back together. If the product matches the original expression, the factorization is correct. Checking by multiplication is especially helpful because many errors come from using the wrong square root or writing the signs incorrectly.