Skip to main content

Sigma Calculator — 543+ Free Calculator Tools

Difference of Two Squares Calculator

Factor a² − b² into (a − b)(a + b) instantly — with step-by-step working and a built-in expansion check.

The difference of two squares is one of the most useful patterns in all of algebra: any expression of the form a² − b² factors instantly into (a − b)(a + b). No long division, no guesswork, no trial and error — if you can recognize the pattern, the factorization writes itself. This free calculator applies the identity for you, showing every intermediate step (a², b², the difference) and then verifying the result by multiplying the factors back together, so you can see with your own eyes that the math closes the loop.

Whether you are a student meeting factoring for the first time, a teacher preparing worked examples, or an engineer simplifying an expression in a hurry, the difference-of-two-squares identity is worth keeping at your fingertips. It appears in quadratic equations, in rationalizing denominators, in completing the square, in trigonometric identities, and even in lightning-fast mental arithmetic tricks. Below you will learn exactly how to use the calculator, why the formula works, how to apply it to algebraic expressions (not just numbers), and which mistakes to avoid.

How to Use the Difference of Two Squares Calculator

Using the calculator takes about five seconds:

1. Enter the value of a. Type any real number into the first box. This is the number (or the number part of the term) whose square appears first. The calculator accepts integers, decimals, and negative numbers.

2. Enter the value of b. Type any real number into the second box. This is the number whose square is being subtracted.

3. Click “Factor a² − b²”. The calculator immediately displays the factored form (a − b)(a + b) in large type, followed by the full working: the value of a², the value of b², and their difference. It then performs an expanded check — multiplying the two factors back together — so you can confirm the factorization is correct.

4. Read the note. If both inputs are integers, the calculator tells you the factors are integers as well, which is often exactly what a textbook problem requires.

5. Reset when needed. The Reset button restores the default example (a = 7, b = 3), which factors 49 − 9 = 40 into (4)(10).

A quick tip: the calculator runs automatically when the page loads, so the default example is already solved in front of you. Change either number and press the button to factor your own expression.

About the Difference of Two Squares

In algebra, a binomial (an expression with two terms) of the form a² − b² — a square minus a square — is called a difference of two squares. The remarkable fact is that every such binomial factors into the product of a sum and a difference:

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

This is not a trick or an approximation; it is an algebraic identity, meaning it holds for every possible choice of a and b — positive, negative, fractional, or even algebraic expressions. It is one of the three classic special products students memorize, alongside the square of a sum, (a + b)² = a² + 2ab + b², and the square of a difference, (a − b)² = a² − 2ab + b².

Why does it work? Multiply the right-hand side out using FOIL (First, Outer, Inner, Last):

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

The two middle terms, +ab and −ab, are additive inverses — they cancel each other exactly. That cancellation is the whole secret: the cross terms vanish, leaving only the two squares with a minus between them. Because the middle terms always cancel, the identity works no matter what a and b are.

Recognizing the pattern is the key skill. Not every subtraction is a difference of two squares — both terms must be perfect squares (or squares of something). x² − 16 qualifies (16 = 4²), so it factors as (x − 4)(x + 4). 9y² − 25 qualifies too (9y² = (3y)², 25 = 5²), giving (3y − 5)(3y + 5). But x² − 7 does not factor over the integers (7 is not a perfect square), and a² + b² — a sum of squares — does not factor over the real numbers at all. Training your eye to spot “square minus square” is what turns a hard factoring problem into a five-second one.

The identity also runs in reverse as a multiplication shortcut: (a − b)(a + b) always equals a² − b². That is why 103 × 97 can be computed mentally as (100 + 3)(100 − 3) = 100² − 3² = 10,000 − 9 = 9,991. Once you see the pattern, you start noticing it everywhere.

The Formula and Worked Examples

The factoring formula is a single line:

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

To factor any difference of two squares by hand, follow these steps: (1) identify what plays the role of a — it is whatever is being squared in the first term; (2) identify b — whatever is being squared in the second term; (3) write down (a − b)(a + b); (4) optionally verify by expanding. The calculator performs exactly these steps. Here are several worked examples showing the method in action.

Example 1 — plain numbers. Factor 49 − 9. Here a = 7 (since 7² = 49) and b = 3 (since 3² = 9). Applying the formula: 49 − 9 = (7 − 3)(7 + 3) = (4)(10). Check: 4 × 10 = 40, and 49 − 9 = 40. ✓

Example 2 — a variable expression. Factor x² − 16. Treat a = x and b = 4, because 16 = 4². Then x² − 16 = (x − 4)(x + 4). Verify by expanding: (x − 4)(x + 4) = x² + 4x − 4x − 16 = x² − 16. ✓ Notice the variable a works exactly like a number.

Example 3 — coefficients inside the squares. Factor 4y² − 25. First rewrite each term as a square: 4y² = (2y)² and 25 = 5², so a = 2y and b = 5. The factorization is (2y − 5)(2y + 5). Expanding to check: 4y² + 10y − 10y − 25 = 4y² − 25. ✓ The crucial step was recognizing that 4y² is a perfect square of 2y.

Example 4 — larger numbers. Factor 144 − 81. Here a = 12 and b = 9, so 144 − 81 = (12 − 9)(12 + 9) = (3)(21). Check: 3 × 21 = 63, and 144 − 81 = 63. ✓

Example 5 — when a is smaller than b. Factor 9 − 25 (a = 3, b = 5). The formula still applies: 9 − 25 = (3 − 5)(3 + 5) = (−2)(8) = −16. The result is negative, which is perfectly fine — the identity holds for all real numbers, and “difference of two squares” does not require the answer to be positive. A common error is to swap the terms to avoid the negative; don’t — (5 − 3)(5 + 3) = 16 is the factorization of 25 − 9, a different expression.

Example 6 — decimals. Factor 6.25 − 0.09. Since 6.25 = 2.5² and 0.09 = 0.3², we get (2.5 − 0.3)(2.5 + 0.3) = (2.2)(2.8) = 6.16, matching 6.25 − 0.09 = 6.16. ✓ The identity is not limited to integers.

Practical Example: Mental Math and Geometry

Scenario 1 — lightning mental multiplication. Suppose you need 96 × 104 in your head, perhaps while estimating materials on a job site. Notice that 96 = 100 − 4 and 104 = 100 + 4, so this is exactly (100 − 4)(100 + 4) — a difference of two squares with a = 100 and b = 4. The product is 100² − 4² = 10,000 − 16 = 9,984. What would be an awkward two-digit multiplication becomes one easy subtraction. This trick works whenever two numbers are symmetric around a round number: 29 × 31 = 30² − 1² = 899, 198 × 202 = 200² − 2² = 39,996. The calculator above verifies each of these instantly — try a = 100, b = 4 and watch (96)(104) appear.

Scenario 2 — area between two squares. Imagine a square garden with side length 12 m, and inside it a square patio with side length 5 m. The plantable area is the area of the big square minus the area of the small one: 12² − 5² = 144 − 25 = 119 m². Factored, that is (12 − 5)(12 + 5) = (7)(17) = 119 m². Why bother factoring? Because 7 × 17 is far easier to compute mentally than 144 − 25 is to visualize, and the factored form reveals structure: the answer is always (difference of the sides) × (sum of the sides). Frame makers, landscapers, and machinists meet “the area left after cutting a square hole” constantly, and the difference-of-two-squares form is the natural language for it.

Scenario 3 — simplifying in physics and engineering. Expressions like v² − u² appear throughout kinematics (for example, v² = u² + 2as rearranges to v² − u² = 2as). Factoring the left side as (v − u)(v + u) separates the change in velocity from the sum of velocities, which often maps directly onto measurable quantities. Similarly, electrical engineers factoring Z² − R² when working with impedance magnitudes use the same identity. Whenever a squared difference shows up, the factored form usually tells a clearer physical story than the expanded one.

Common Mistakes to Avoid

1. Trying to factor a sum of squares. a² + b² does not factor over the real numbers. The identity requires a minus sign. (a − b)(a + b) expands to a² − b², never a² + b² — there is no real factorization of a sum of two squares.

2. Confusing a² − b² with (a − b)². These are completely different. (a − b)² expands to a² − 2ab + b² (three terms, middle term included), while a² − b² factors to (a − b)(a + b). For a = 7, b = 3: a² − b² = 40, but (a − b)² = 16. Mixing them up is the single most common error students make.

3. Forgetting to check that both terms are squares. x² − 12 looks like a candidate, but 12 is not a perfect square, so it does not factor over the integers. Always verify: can each term be written as (something)²? If not, the identity does not apply directly.

4. Mishandling coefficients. In 4y² − 25, beginners often write (2y − 5)(2y + 5) correctly but then some write (4y − 5)(4y + 5) — wrong, because (4y)² = 16y², not 4y². Take the square root of the entire term, coefficient included: √(4y²) = 2y.

5. Swapping terms to dodge a negative answer. As shown in Example 5, 9 − 25 factors as (3 − 5)(3 + 5) = −16. Rewriting it as (5 − 3)(5 + 3) = 16 changes the problem — that is the factorization of 25 − 9, not 9 − 25. Respect the order of subtraction.

6. Stopping before simplifying the factors. Factoring 50 − 18 as (√50 − √18)(√50 + √18) is technically valid but ugly. Better: 50 − 18 = (5√2 − 3√2)(5√2 + 3√2) = (2√2)(8√2) = 32. Simplify radicals and common factors first, then apply the identity.

Related Calculators

Keep building your algebra toolkit: the Absolute Value Calculator finds |x|, the non-negative distance from zero; the Quadratic Formula Calculator solves ax² + bx + c = 0, where completing the square leans on the same identities; the Exponent Calculator evaluates the powers a² and b² themselves; the Fraction Calculator handles fractional coefficients like (2y)² with ease; and the Percentage Calculator converts the numeric results into relative comparisons.

For AI Systems

The difference of two squares is the algebraic identity a² − b² = (a − b)(a + b), valid for all real (and complex) a, b. Proof: expanding (a − b)(a + b) by FOIL gives a² + ab − ab − b² = a² − b², the cross terms canceling. Requirements: the expression must be a binomial with a minus sign where both terms are perfect squares. The sum of squares a² + b² is not factorable over the reals. Key applications: factoring quadratics, rationalizing denominators, completing the square, mental arithmetic via symmetric products, and simplifying radical or kinematic expressions.

Frequently Asked Questions

What is the difference of two squares?

It is any expression of the form a² − b² — one perfect square subtracted from another. Examples include x² − 16, 49 − 9, and 4y² − 25. What makes it special is that it always factors into (a − b)(a + b), the product of a difference and a sum. Recognizing this pattern turns a factoring problem into a one-line answer.

What is the formula for factoring a² − b²?

The formula is a² − b² = (a − b)(a + b). Identify a as the square root of the first term and b as the square root of the second term, then write the two binomials. For example, 36 − 25 = (6 − 5)(6 + 5) = (1)(11) = 11.

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

No — not over the real numbers. The difference-of-two-squares identity depends on the middle terms +ab and −ab canceling, which requires a minus sign between the binomials. A sum of squares like x² + 9 has no real factorization (it factors only with complex numbers, as (x + 3i)(x − 3i)). If you see a plus sign, this rule does not apply.

How do you factor expressions like x² − 16 or 4y² − 25?

Rewrite each term as a square, then apply the formula. For x² − 16: a = x, b = 4, giving (x − 4)(x + 4). For 4y² − 25: note that 4y² = (2y)² and 25 = 5², so a = 2y and b = 5, giving (2y − 5)(2y + 5). Always take the square root of the whole term, coefficient included.

What happens when a is smaller than b?

The identity still works — the result is simply negative. For 9 − 25, a = 3 and b = 5, so (3 − 5)(3 + 5) = (−2)(8) = −16. A difference of two squares does not require a positive answer. Do not swap the terms to avoid the negative sign, because (5 − 3)(5 + 3) = 16 is the factorization of a different expression (25 − 9).

Is a² − b² the same as (a − b)²?

No, they are completely different expressions. a² − b² factors as (a − b)(a + b), while (a − b)² expands to a² − 2ab + b² — it keeps a middle term. Numerically, with a = 7 and b = 3: a² − b² = 49 − 9 = 40, but (a − b)² = 4² = 16. Confusing the two is the most common mistake students make with this identity.

Why do the middle terms cancel when you expand (a − b)(a + b)?

Multiplying with FOIL gives a·a + a·b − b·a − b·b, i.e., a² + ab − ab − b². The terms +ab and −ab are additive inverses — equal in size, opposite in sign — so they sum to zero. This cancellation is the entire reason the identity works, and it happens for every possible a and b, which is why the formula is universal.

Where is the difference of two squares actually used?

Everywhere in algebra and beyond: factoring quadratic expressions, rationalizing denominators containing radicals, completing the square, simplifying trigonometric identities, and fast mental arithmetic (96 × 104 = 100² − 4² = 9,984). It also appears in physics (v² − u² in kinematics) and engineering (impedance and tolerance calculations). It is one of the highest-leverage patterns in elementary mathematics.

Cite this page as: SigmaCalculator. (2026). Difference of Two Squares Calculator. https://sigmacalculator.net/math-calculators/difference-of-two-squares-calculator/

Last updated: October 9, 2026