Algebra

Difference of two squares formula and examples

The difference of two squares states that a² - b² factors directly into (a - b)(a + b). You can use this algebraic identity to factor polynomials instantly or simplify arithmetic calculations without a calculator.

Formula

D=a^{2} - b^{2}

a² and b² are perfect square terms, and (a - b)(a + b) is their factored conjugate pair.

How to Factor the Difference of Two Squares

To use the formula, first verify that you have two terms separated by a subtraction sign and that both terms are perfect squares. Take the square root of the first term to find a, and take the square root of the second term to find b.

Write your solution as two sets of parentheses: one containing the sum (a + b) and the other containing the difference (a - b). Multiply these binomials together to get your final factored expression.

For arithmetic evaluation such as 15² - 5², substitute the values directly into (15 - 5)(15 + 5). This simplifies to 10 multiplied by 20, giving an answer of 200 without calculating large squares individually.

Where You Use This in Algebra and Tests

In school algebra courses like GCSE, SAT, and high school Algebra 1 and 2, factoring expressions like x² - 49 or 4x² - 81 into linear factors is a core requirement for solving quadratic equations.

You also rely on this rule when simplifying rational algebraic fractions and when rationalizing denominators containing square roots by multiplying by the conjugate pair.

Outside the classroom, mental math practitioners use the difference of two squares to multiply two numbers quickly by finding their midpoint, such as calculating 29 · 31 as 30² - 1² = 899.

Common Mistakes to Avoid

Do not confuse the difference of squares a² - b² with the square of a binomial (a - b)². The expression (a - b)² expands to a² - 2ab + b², which includes a middle term.

Do not attempt to factor the sum of two squares, such as a² + b², into real binomials. A plus sign between two squared terms cannot be factored using real numbers.

Always look for a greatest common factor (GCF) before applying the formula. An expression like 2x² - 18 is not immediately in standard form, but factoring out 2 gives 2(x² - 9), which factors completely to 2(x - 3)(x + 3).

Quick Mental Trick and Verification

You can check any answer instantly using the FOIL method (First, Outside, Inside, Last). Expanding (a - b)(a + b) yields a² + ab - ab - b², where the two middle terms always cancel each other out to leave a² - b².

To multiply numbers near each other in your head, identify their average and distance from the average. To multiply 42 by 38, recognize them as (40 + 2)(40 - 2), which is simply 40² - 2² = 1600 - 4 = 1596.

Worked examples

Example 1Factor the difference between the squares of a and b. a=15,\;b=5. Find D.

  1. Write the relationship for the requested quantity.

    D=a^{2} - b^{2}
  2. Substitute each value, keeping its sign.

    \left(\left(15\right)^{2}-\left(5\right)^{2}\right)
  3. Simplify the expression to obtain the exact result.

    200
Answer200Verified by computation

Example 2Factor the difference between the squares of a and b. a=31,\;b=29. Find D.

  1. Write the relationship for the requested quantity.

    D=a^{2} - b^{2}
  2. Substitute each value, keeping its sign.

    \left(\left(31\right)^{2}-\left(29\right)^{2}\right)
  3. Simplify the expression to obtain the exact result.

    120
Answer120Verified by computation

Example 3Factor the difference between the squares of a and b. a=12,\;b=7. Find D.

  1. Write the relationship for the requested quantity.

    D=a^{2} - b^{2}
  2. Substitute each value, keeping its sign.

    \left(\left(12\right)^{2}-\left(7\right)^{2}\right)
  3. Simplify the expression to obtain the exact result.

    95
Answer95Verified by computation

Questions and answers

Can you factor the sum of two squares like a² + b²?

No, a² + b² cannot be factored over real numbers. It only factors in advanced algebra using imaginary numbers as (a + bi)(a - bi).

What is the difference between a² - b² and (a - b)²?

The expression a² - b² factors into (a - b)(a + b). The expression (a - b)² is a squared binomial that expands into a² - 2ab + b².

How do you solve a quadratic equation using the difference of squares?

Set the equation to zero, factor it into (a - b)(a + b) = 0, and set each individual factor to zero to find the two solutions: a = b and a = -b.

How do you identify if an algebraic term is a perfect square?

A term is a perfect square if its numerical coefficient has an integer square root and all variable exponents are even numbers, such as 25x^4 being (5x²².

Solve your own problem

Different numbers or a harder variant? Type it in and get the steps.

Enter solves, Shift+Enter adds a line