Skip to main content

Interactive Math Workbooks

Practice, learn and master mathematics with interactive exercises and instant feedback.

Difference of Squares Calculator

Mathematics - Difference of Squares

Difference of Squares Calculator — Factor a² − b² Instantly

Factor expressions of the form a² − b² into (a+b)(a−b) with step-by-step explanation. Learn the formula, geometric interpretation, and how to recognize this pattern. For related tools, see our polynomial factorization calculator.

Factor a Difference of Squares

Enter two terms that are perfect squares. Enter them as expressions like x^2 and 9, or as values like 25 and 16.

Factored form will appear here.
Note: The difference of squares formula is: a² − b² = (a + b)(a − b). Both terms must be perfect squares and separated by a minus sign.

Difference of Squares – Complete Explanation

The difference of squares is one of the most recognizable and useful factoring patterns in algebra. The formula a² − b² = (a + b)(a − b) allows you to factor any expression where two perfect squares are separated by a minus sign. This pattern appears constantly in algebra, from simplifying rational expressions to solving equations.

Difference of Squares Formula

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

Both a² and b² must be perfect squares. They must be separated by a MINUS sign.

1. What Is the Difference of Squares?

The difference of squares answers: "Can I factor this expression as the product of a sum and a difference?" The pattern is specific but powerful — it works whenever you have one perfect square minus another perfect square.

Key characteristics:

  • Perfect squares only: Both terms must be perfect squares (x², 4x², 25, 9y⁶, etc.).
  • Minus sign required: The formula works only with subtraction, not addition.
  • Product of conjugates: The result is always (a + b)(a − b) — a pair of conjugate binomials.
  • Always works: If both conditions are met, the factoring is guaranteed.

2. The Formula a² − b² = (a + b)(a − b)

The formula can be verified by expanding the right side:

Expand (a + b)(a − b):

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

= a² − b² (the middle terms cancel!)

The ±ab terms cancel out, leaving exactly a² − b².

This cancellation of the middle terms is what makes the pattern work. When you multiply conjugates (expressions that differ only in the sign between terms), the "cross" terms always cancel.

3. Geometric Interpretation

Visualizing the Difference of Squares

Consider a large square of side a with a smaller
square of side b removed from one corner:

        a
   ┌─────────┐
   │         │
   │   a²    │
   │         │
   │     ┌───┼─── b
   │     │b² │
   │     │   │
   └─────┴───┘

The remaining area is a² − b².
This region can be rearranged into a rectangle:
  width = (a + b)
  height = (a − b)

Thus: a² − b² = (a + b)(a − b)

The geometric interpretation makes the formula intuitive. The difference in area between two squares can be rearranged into a single rectangle, and the dimensions of that rectangle are (a + b) and (a − b).

4. How to Recognize the Pattern

Look for these three things to identify a difference of squares:

1. Perfect square terms:

x², 4x², 9y², 16x⁴, 25, 100, 81z⁶

2. Minus sign between terms:

x² − 9, 4x² − 25, 16y⁴ − 1

3. Both terms are positive in their squared form:

Even if coefficients are negative, the squared terms themselves are positive.

Quick check: Can you take the square root of each term and get a nice expression? If yes, and there's a minus sign between them, it's a difference of squares!

5. Step-by-Step Examples

Example 1: x² − 9

Factor x² − 9.

Step 1: √(x²) = x
Step 2: √(9) = 3
Step 3: Apply the formula:
        x² − 9 = (x + 3)(x − 3)

Verification:
        (x + 3)(x − 3) = x² − 3x + 3x − 9 = x² − 9 ✓

Example 2: 4x² − 25

Factor 4x² − 25.

Step 1: √(4x²) = 2x (since (2x)² = 4x²)
Step 2: √(25) = 5
Step 3: Apply the formula:
        4x² − 25 = (2x + 5)(2x − 5)

Verification:
        (2x + 5)(2x − 5) = 4x² − 10x + 10x − 25 = 4x² − 25 ✓

6. More Factoring Examples

x² − 1: (x + 1)(x − 1)

9y² − 16: (3y + 4)(3y − 4)

x⁴ − 81: (x² + 9)(x² − 9) = (x² + 9)(x + 3)(x − 3)

100 − 49z²: (10 + 7z)(10 − 7z)

36x⁶ − 1: (6x³ + 1)(6x³ − 1)

7. Repeated Factoring

Sometimes a difference of squares can be factored further if one of the resulting factors is itself a difference of squares:

Factor x⁴ − 16:

First factoring: x⁴ − 16 = (x² + 4)(x² − 4)

Notice x² − 4 is still a difference of squares:

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

Final result: x⁴ − 16 = (x² + 4)(x + 2)(x − 2)

Tip: Always check if any resulting factor can be factored further. The sum of squares (x² + 4) does NOT factor over real numbers, but the difference of squares (x² − 4) does.

8. Why Sum of Squares Doesn't Factor

A common question: why doesn't a² + b² factor like a² − b²?

a² + b² does NOT factor over real numbers.

If you try (a + b)(a + b) = a² + 2ab + b² — that's not right.

If you try (a + b)(a − b) = a² − b² — that's the difference, not the sum.

There is no real-number factorization of a² + b².

(Over complex numbers: a² + b² = (a + bi)(a − bi), where i = √(−1).)

Key Distinction

Difference of squares: a² − b² = (a + b)(a − b) ✓
Sum of squares:        a² + b² = no real factorization ✗

9. Common Mistakes

  • Trying to factor a sum of squares: a² + b² does NOT factor over real numbers.
  • Missing the square root of coefficients: √(4x²) = 2x, not 4x. The 2 comes from √4.
  • Forgetting that odd powers can't be factored this way: x³ − 9 is NOT a difference of squares because x³ is not a perfect square.
  • Not factoring completely: After factoring x⁴ − 16 as (x²+4)(x²−4), remember to factor x²−4 further.
  • Confusing (a+b)² with a²+b²: (a+b)² = a²+2ab+b², not a²+b². They are different expressions.
  • Forgetting to check for GCF first: Always factor out the greatest common factor before applying the difference of squares pattern.

10. Real-World Applications

  • Simplifying rational expressions: Factoring numerators and denominators reveals common factors to cancel.
  • Solving polynomial equations: Factoring a²−b²=0 gives (a+b)(a−b)=0, leading to two solutions.
  • Number theory: Factoring large numbers that are differences of squares is a key technique in integer factorization.
  • Geometry: The difference of two square areas appears in problems involving nested squares.
  • Physics: The relativistic energy-momentum relation E² = (pc)² + (mc²)² can be rearranged using similar patterns.
  • Engineering: Signal processing uses difference of squares in filter design.

11. Practice Problems

Problem 1: Factor x² − 49.

Solution: (x + 7)(x − 7)

Problem 2: Factor 16x² − 9y².

Solution: (4x + 3y)(4x − 3y)

Problem 3: Factor x⁴ − 1 completely.

Solution: (x²+1)(x²−1) = (x²+1)(x+1)(x−1)

Problem 4: Factor 25a² − 4b⁴.

Solution: (5a + 2b²)(5a − 2b²)

12. Tips for Mastery

  • Memorize the formula: a² − b² = (a + b)(a − b).
  • Always check for a GCF before applying the pattern.
  • Take the square root of each term — if both roots are "nice," it's a difference of squares.
  • Remember: sum of squares does NOT factor over reals.
  • After factoring, check if any factor is itself a difference of squares.
  • Verify by expanding: (a+b)(a−b) should give back a²−b².
  • Practice recognizing perfect squares: 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225.

13. Final Thoughts

The difference of squares is one of the most elegant and frequently used factoring patterns in algebra. Its simplicity — two perfect squares separated by a minus sign — belies its power. From simplifying complex rational expressions to solving higher-degree polynomial equations, recognizing and applying this pattern is an essential algebraic skill.

The geometric interpretation provides deep intuition: the difference between two square areas can always be rearranged into a rectangle. This visual understanding, combined with the simple formula (a+b)(a−b), makes the difference of squares both memorable and practical. Use the calculator above to verify your work, but practice until you can spot the pattern instantly in any expression.

14. Frequently Asked Questions

a² − b² = (a + b)(a − b). Two perfect squares separated by a minus sign.

a² + b² has no real-number factorization. Only the difference factors: a² − b² = (a+b)(a−b).

Yes: (2x + 5)(2x − 5). √(4x²) = 2x and √(25) = 5.

Check: (1) Both terms are perfect squares. (2) They are separated by a minus sign.

No. x³ is not a perfect square (odd exponent). Only even powers work for this pattern.

Yes! Always factor out the greatest common factor first, then apply the pattern.

Yes. For x⁴−16: (x²+4)(x²−4) = (x²+4)(x+2)(x−2).

Explore Math Topics

Continue your learning journey with our other math guides

Related Calculators

Explore these other algebra tools:

Conclusion

The difference of squares is one of the most elegant factoring patterns in algebra. Master it thoroughly.

Readers who wish to continue practicing can explore the companion learning resource for guided exercises.