Difference of Two Squares Calculator

Factor any a^2 - b^2 expression into (a+b)(a-b) with step-by-step work.
Supports symbolic (px+q)(px-q) factoring and graphs the resulting parabola.

Factored Form

Difference of Two Squares

The difference of two squares is a special factoring pattern in algebra. Any expression of the form a^2 - b^2 can always be factored as (a + b)(a - b).

The identity:

a^2 - b^2 = (a + b)(a - b)

This works because expanding (a+b)(a-b) gives a^2 - ab + ab - b^2 = a^2 - b^2. The middle terms cancel.

With polynomial terms: If a = px (a polynomial), then:

(px)^2 - q^2 = (px + q)(px - q)

Examples:

Expression Factored Form
x^2 - 9 (x + 3)(x - 3)
4x^2 - 25 (2x + 5)(2x - 5)
16 - x^2 (4 + x)(4 - x)
49x^2 - 1 (7x + 1)(7x - 1)

Roots: The equation px^2 - q^2 = 0 has roots x = q/p and x = -q/p. These are always symmetric about the y-axis.

When does this NOT apply?

  • Sum of squares: a^2 + b^2 cannot be factored over real numbers
  • Expression must be a perfect square minus a perfect square
  • a^2 - b^3 is NOT a difference of two squares

Multi-step factoring: Sometimes you need to apply the pattern more than once. For example: x^4 - 16 = (x^2 + 4)(x^2 - 4) = (x^2 + 4)(x+2)(x-2)

Why it matters: This pattern appears in simplifying fractions, solving equations, and in mental math. For example, 99 × 101 = (100-1)(100+1) = 100^2 - 1^2 = 10000 - 1 = 9999.


How we build and check this calculator

This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.

SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.


Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.