What is the Difference of Two Squares?
A difference of two squares is any expression of the form \(a^2 - b^2\) — one perfect square subtracted from another. It is one of the most useful patterns in algebra because it always factors cleanly into a sum times a difference: $$a^2 - b^2 = (a + b)(a - b)$$ This calculator takes a binomial you type in, pulls out the greatest common factor (GCF), checks that both remaining terms are perfect squares, and returns the fully factored answer with each step shown.
How to use it
Type a two-term expression in the box, using the caret ^ for exponents, for example 4x^2 - 36y^4. The two terms must be joined by a plus or minus sign. Press calculate to get the factored form and a written solution. The tool handles a positive square minus a positive square directly, rearranges a negative-leading form like -4y^2 + 36 into 36 - 4y^2, and recurses when a resulting factor (such as \(x^2 - 4\)) is itself a difference of squares.
The formula explained
To square-root a perfect-square term, take the integer square root of the coefficient and halve every variable exponent: \(\sqrt{9y^4} = 3y^2\). Call the first root a and the second b; the identity then gives \((a + b)(a - b)\). A coefficient is a perfect square only if its exact integer root squared returns it, and a power \(v^n\) is a perfect square only when \(n\) is even.
Worked example
Factor \(4x^2 - 36y^4\). The GCF of 4 and 36 is 4, leaving \(4(x^2 - 9y^4)\). Here \(a = \sqrt{x^2} = x\) and \(b = \sqrt{9y^4} = 3y^2\). Applying the identity: $$x^2 - 9y^4 = (x + 3y^2)(x - 3y^2)$$ Re-attaching the GCF gives \(4(x + 3y^2)(x - 3y^2)\).
FAQ
Can a sum of squares be factored? No. \(a^2 + b^2\) has no real factorization, so the calculator reports it is not a difference of two squares.
What if a coefficient isn't a perfect square? After the GCF is removed, both inner coefficients must be perfect squares (like 1, 4, 9, 16). If one is not, the binomial cannot be factored by this pattern.
Why pull out the GCF first? Removing the common factor shrinks the inner terms so hidden perfect squares (such as \(x^2 - 4\) inside \(3x^2 - 12\)) become visible.