Difference of Two Squares Calculator
Factor a difference of two squares a² − b² into (a + b)(a − b). Enter the two square values to see the factored binomials and a step-by-step check.
The difference-of-squares identity
Whenever you can write an expression as one perfect square minus another, it factors immediately into the sum of their roots times the difference of their roots. This calculator takes the two square values directly (e.g. 25 and 16, for and ), finds and , and shows the factored form.
Worked example: two perfect squares
Factor .
- Identify the squares: , .
- Apply the identity: .
- Result: .
- Check: , which matches .
Worked example: when a value isn't a perfect square
Factor .
- Identify the squares: is a perfect square. is not — 5 has no whole-number square root, so it stays under the radical.
- Apply the identity anyway: the identity holds for any real and , not just whole numbers.
- Result: .
- Check: .
Quick reference
| Squares | Factored form |
|---|---|
A mental-math shortcut
The identity turns an awkward subtraction into an easy multiplication. is tedious to compute directly, but it factors as:
Any "square minus a nearby square" collapses to a sum times a small difference this way — a classic mental-arithmetic trick built entirely on this one identity.
Common mistakes
- Assuming a sum of squares factors the same way. does not factor into real binomials — the cancellation that makes work only happens for a difference, never a sum.
- Forgetting a common factor first. An expression like has a GCF of 4 to pull out — — before the difference-of-squares pattern applies to what's left. This calculator factors the two square values you give it directly; pull out any shared factor yourself first.
- Stopping too early. If the result still contains a difference of squares — like — the second factor factors again into .
The reverse of FOIL
FOIL expands two binomials into a polynomial; this calculator does the opposite for the special case where the expanded result is a pure difference of squares (no middle term). The FOIL calculator shows that forward direction — including the exact worked example that this calculator reverses.
Setting a factored difference to zero
If , then , so or — the two roots of a very simple quadratic. The Quadratic Formula calculator solves the general case , of which "difference of squares equals zero" is the special case with in the quadratic's own coefficients.
Frequently asked questions
- What is the difference of two squares?
- It is the identity : any expression that is one perfect square minus another perfect square factors into the sum of the two roots times their difference. It is the exact reverse of FOIL-ing back out, since the middle terms and cancel.
- How do I find a and b from the two square values?
- Take the square root of each value entered. For example, with 25 and 16, and , so .
- What if one of the values is not a perfect square?
- The identity still holds — or is just left as a radical instead of a whole number. For , is a perfect square but is not, so it factors as , and multiplying that back out still gives exactly .
- How is this the reverse of FOIL?
- FOIL-ing gives , and the two middle terms always cancel, leaving . This calculator undoes that: starting from , it recovers the two binomials and that FOIL back out to it. See the [FOIL calculator](/en/calculators/algebra/foil) for that forward direction.
- Can this pattern help with mental math?
- Yes — looks hard to compute directly, but it factors as , which is easy to do in your head. Any "square minus a nearby square" reduces to a sum times a small difference this way.
- Why doesn't a sum of two squares, a² + b², factor the same way?
- A sum of two squares has no real-number factorization analogous to — that identity relies on the middle terms canceling, which only happens for a *difference*. stays irreducible over the real numbers (it does factor with complex numbers, but that is outside this calculator's scope).