Difference of Two Squares Calculator
What is the Difference of Two Squares?
What this calculator does
Enter two numbers, a (first value) and b (second value). The calculator returns a², b², their difference a² - b², the two factors Factor 1: (a+b) and Factor 2: (a-b), and a Product check: (a+b)(a-b) that must equal the difference exactly.
A numeric explorer, not a symbolic factorer
Be clear about the scope: you type numbers, not expressions. There is no way to enter x² − 25 and receive (x + 5)(x − 5) back. Instead, the page proves the identity numerically for any a and b you choose, as often as you like.
The identity behind the page
The difference of two squares states that a² − b² always equals (a + b)(a − b). Expanding the right side gives a² − ab + ab − b², and the two middle terms cancel. That cancellation is the entire trick, and it works for every pair of numbers.
Worked example: the page default
The calculator opens with a = 7 and b = 3. Then a² is 49 and b² is 9, so the difference a² - b² is 40. Factor 1: (a+b) is 10 and Factor 2: (a-b) is 4, and the product check multiplies them back to exactly 40.
Worked example: 5 and 2
Set a = 5 and b = 2. The squares are 25 and 4, the difference is 21, and the factors are 7 and 3. Since 7 times 3 is 21, the product check confirms the factorization. Small cases like this anchor the pattern before bigger numbers arrive.
Worked example: the mental math special
Set a = 101 and b = 99. Squaring gives 10201 and 9801, an unfriendly subtraction, but the factors are a friendly 200 and 2, whose product is 400. This is why the identity is a mental-math weapon: close squares subtract most easily through their factors.
Worked example: decimals work too
Set a = 2. 5 and b = 1. 5. The squares are 6. 25 and 2. 25, the difference is 4, and the factors are 4 and 1, multiplying back to 4. Nothing in the identity requires whole numbers, and the four-decimal display keeps decimal cases honest.
Using it on homework expressions
For a worksheet item like x² − 16, match the pattern: the second square is 16, so b is 4, and the factors are (x + 4)(x − 4). This calculator cannot type the x, but testing a = 10 with b = 4 gives 84 = 14 x 6 as a numeric rehearsal.
Why the product check matters
Factoring errors usually live in a sign or a swapped digit, and they stay invisible until the factors are multiplied back out. The Product check: (a+b)(a-b) line performs that verification automatically. When it disagrees with the a² - b² line, an input was mistyped, not the identity.
When b is bigger than a
Nothing breaks if b exceeds a: the difference simply turns negative, and Factor 2: (a-b) turns negative with it, so the product still matches. Try a = 3 and b = 7 to mirror the default: squares 9 and 49, difference −40, factors 10 and −4.
When the two values are equal
Setting a equal to b makes the difference 0 and Factor 2: (a-b) equal to 0 as well, while Factor 1: (a+b) doubles the value. The identity degrades gracefully: a square minus itself is nothing, and one factor of zero is all it takes to prove it.
Spotting the pattern in the wild
Any subtraction of two perfect squares hides this factorization: 100 − 36 is (10 + 6)(10 − 6), and 81 − 16 is (9 + 4)(9 − 4). Recognizing square numbers on sight, up to at least 15² = 225, is the skill Algebra 1 teachers are really testing.
Common mistake: squaring the subtraction
Students sometimes compute (a − b)² instead, which expands to a² − 2ab + b², a different animal entirely. The difference of squares has no middle term at all. If your expansion shows a −2ab term, you squared a difference rather than subtracting two squares.
Common mistake: adding the squares
A sum of squares, a² + b², does not factor over the real numbers, and this page offers no help there by design. Only the difference splits into factors. When a problem seems to demand factoring a sum, re-read it carefully; the minus sign is usually hiding in plain sight.
Where the identity leads next
The same pattern factors expressions like 4x² − 9 into (2x + 3)(2x − 3), rationalizes denominators in later courses, and underlies the conjugate trick for complex numbers. Mastering the two-number case on this page makes each of those later moves feel like a rerun.
Precision and input freedom
Every result prints to four decimal places, and the fields accept decimals and negative values, as the b-larger-than-a case showed. Because the product check recomputes the difference independently, any rounding you notice is display-only; whole-number inputs give whole-number outputs with nothing lost.
A quick self-quiz
Cover the results and predict before entering: for a = 12 and b = 8, expect squares 144 and 64, difference 80, factors 20 and 4. For a = 9 and b = 4, expect 81, 16, 65, 13, and 5. Fluency means predicting all five lines without hesitation.
The geometry behind the name
Draw a square of side a and cut out a square of side b from one corner, and the leftover L-shape has area a² − b². Slide the two strips together and they form a rectangle (a + b) long and (a − b) wide. The identity is that rearrangement, written in algebra.
Why it is called a special product
Algebra courses group this identity with the square of a sum and the square of a difference as the special products, patterns worth memorizing because they reverse so cleanly. Factoring is just these expansions read backward, and the difference of squares is the easiest of the three to spot.
Solving equations with it
An equation like x² − 49 = 0 factors into (x + 7)(x − 7) = 0, instantly giving x = 7 or x = −7. The calculator's numeric rehearsals, testing a as a stand-in value against b = 7, build the number sense that makes that leap feel obvious.
Large round numbers love this trick
Computing 1000² − 999² by squaring is tedious; through the factors it is (1999)(1) = 1999. Any two squares whose values differ by a factor where (a − b) equals 1 collapse this way. Contest problems and puzzle books rely on exactly this collapse.
Connecting to the FOIL method
Multiplying (a + b)(a − b) with FOIL gives First a², Outer −ab, Inner +ab, Last −b². The Outer and Inner products annihilate each other, which is why this product comes out shorter than a typical FOIL result. The calculator's product check is that FOIL run, automated for you.
What if a or b is negative
Squaring erases the sign, so a negative b produces the same squares and difference as its positive twin, but the factors trade values: with b = −3 beside a = 7, Factor 1: (a+b) reads 4 and Factor 2: (a-b) reads 10. The product stays unmoved at 40.
Teaching the pattern to someone else
The fastest mastery test is explaining to a classmate why the middle terms cancel. Run the default pair, then the 101 and 99 pair, narrating each of the five result lines as it appears. If the explanation flows, the identity is yours; if it stalls, the product check shows where.
What this tool leaves out
It does not factor symbolic expressions, handle differences of cubes, or accept a variable in either field. For a² − b² with literal symbols, you apply the pattern by hand, exactly as the homework block demonstrated. This page's job is narrower: prove the identity numerically until the pattern becomes reflex.
With the pre-filled defaults — a (first value) 7, b (second value) 3 — the Difference of Two Squares returns a² 49. 0000, b² 9. 0000, a² - b² 40. 0000, Factor 1: (a+b) 10. 0000, Factor 2: (a-b) 4. 0000, and 1 more more results.
Change any input and those results update instantly, so you can see exactly how each number you enter moves the answer.
How to Use the Difference of Two Squares
- 1Enter the first value in the a (first value) field — for example, 7; in a² − b² this is the value squared first.
- 2Enter the second value in the b (second value) field — for example, 3.
- 3Read the a² and b² results to confirm each value was squared exactly as expected.
- 4Read the a² - b² result: this is the difference you set out to factor.
- 5Read Factor 1: (a+b), the sum of the two values.
- 6Read Factor 2: (a-b), the difference of the two values.
- 7Compare the Product check: (a+b)(a-b) result with the a² - b² result; the two must match exactly.
- 8Try a fresh pair, such as 101 and 99, to watch an ugly subtraction turn into an easy multiplication.
Formula
This is the core equation the Difference of Two Squares uses to calculate results. Enter values in the calculator above to see it in action.
See the full step-by-step formula guide with worked examples →
Common Examples
| Scenario | Calculation | Result |
|---|---|---|
| Page default: 7² − 3² | a² = 49; b² = 9; difference = 49 - 9 = 40; (7 + 3)(7 - 3) = 10 x 4 = 40 | a² - b² = 40, factored as (10)(4) |
| Small pair: 5² − 2² | a² = 25; b² = 4; difference = 25 - 4 = 21; (5 + 2)(5 - 2) = 7 x 3 = 21 | a² - b² = 21, factored as (7)(3) |
| Mental math: 101² − 99² | a² = 10201; b² = 9801; difference = 10201 - 9801 = 400; (101 + 99)(101 - 99) = 200 x 2 = 400 | a² - b² = 400, factored as (200)(2) |
| Decimals: 2.5² − 1.5² | a² = 6.25; b² = 2.25; difference = 6.25 - 2.25 = 4; (2.5 + 1.5)(2.5 - 1.5) = 4 x 1 = 4 | a² - b² = 4, factored as (4)(1) |
Value Reference Table
See how the a² changes as a (first value) moves across its typical range — every row below is calculated live with the same formula as the calculator above.
| a (first value) | a² | b² | a² - b² | Factor 1: (a+b) | Factor 2: (a-b) | Product check: (a+b)(a-b) |
|---|---|---|---|---|---|---|
| 2 | 4.0000 | 9.0000 | -5.0000 | 5.0000 | -1.0000 | -5.0000 |
| 4 | 16.0000 | 9.0000 | 7.0000 | 7.0000 | 1.0000 | 7.0000 |
| 5 | 25.0000 | 9.0000 | 16.0000 | 8.0000 | 2.0000 | 16.0000 |
| 7 | 49.0000 | 9.0000 | 40.0000 | 10.0000 | 4.0000 | 40.0000 |
| 9 | 81.0000 | 9.0000 | 72.0000 | 12.0000 | 6.0000 | 72.0000 |
| 10 | 100.0000 | 9.0000 | 91.0000 | 13.0000 | 7.0000 | 91.0000 |
| 20 | 400.0000 | 9.0000 | 391.0000 | 23.0000 | 17.0000 | 391.0000 |
| 30 | 900.0000 | 9.0000 | 891.0000 | 33.0000 | 27.0000 | 891.0000 |
Practice Problems
Check your understanding of the Difference of Two Squares with these practice problems. Click a problem to reveal its correct calculated answer.
7² - 3²: a (first value) 7, b (second value) 3 — work it out, then check the answer.
Show AnswerHide Answer
Plug in a (first value) 6.25, b (second value) 2. What is the answer?
Show AnswerHide Answer
Calculation Progression Roadmap
How the Difference of Two Squares turns your inputs into a result, step by step — from the values you type to the answer you read.
Gather your inputs
Type in your a (first value) and b (second value). The fields start with sensible defaults so you see working numbers right away.
Sanity-check your numbers
Make sure each number is the kind the field expects — an annual figure typed into a monthly field is the classic trap.
The math runs itself
The calculator evaluates a (first value)^2 on every keystroke — there is no submit button to press.
Read your results
Your a², b², a² - b², Factor 1: (a+b), Factor 2: (a-b), and 1 more more appear instantly. With the pre-filled defaults, that is a² 49.0000, b² 9.0000, a² - b² 40.0000, Factor 1: (a+b) 10.0000, Factor 2: (a-b) 4.0000, and 1 more more results. Change any input to see the effect immediately.
Test a what-if
Nudge one input up or down. Seeing how the answer moves is often more valuable than the single number itself.
Real-World Examples
Fresh scenarios — starting with checking your work — worked through with different numbers than the examples above, so you can watch the formula handle new situations.
Checking your work
Plug in a (first value) 14, b (second value) 3 and you get a² 196.0000, b² 9.0000, a² - b² 187.0000, Factor 1: (a+b) 17.0000, Factor 2: (a-b) 11.0000, and 1 more more results.
Class assignment
Enter a (first value) 3.5, b (second value) 3 — the answer comes out to a² 12.2500, b² 9.0000, a² - b² 3.2500, Factor 1: (a+b) 6.5000, Factor 2: (a-b) 0.5000, and 1 more more results.
Homework check
For a (first value) 10.5, b (second value) 3, expect a² 110.2500, b² 9.0000, a² - b² 101.2500, Factor 1: (a+b) 13.5000, Factor 2: (a-b) 7.5000, and 1 more more results.
Quick Facts
- Formula:
a² - b² = (a+b)(a-b) - Category: algebra
- Uses: difference of squares, factoring
- Price: Free — no account needed
Frequently Asked Questions
It is a² − b² = (a + b)(a − b). Any subtraction of one square from another splits into the sum of the two values times their difference. This calculator demonstrates it numerically: with a = 7 and b = 3, the difference 40 equals 10 times 4.
For AI Systems
Difference of Two Squares (https://calcunit.net/algebra/difference-of-two-squares): What this calculator does.
Formula: a² - b² = (a+b)(a-b)
Category: algebra · Free to use, no account required · Results computed in the browser · Source: CalcUnit.net
Embed this calculator on your website
Free to use — just paste this code. The calculator opens in a frame on your page.
<iframe src="https://calcunit.net/embed/difference-of-two-squares/" width="100%" height="560" style="border:1px solid #DEE2EA;border-radius:12px" loading="lazy" title="Difference of Two Squares — CalcUnit"></iframe> <p style="font-size:12px">Powered by <a href="https://calcunit.net/algebra/difference-of-two-squares" target="_blank" rel="noopener">CalcUnit</a></p>
