Difference of squares a² − b²

Enter a and b. The calculator evaluates a² − b² with the compact identity (a − b)(a + b). For a = 5 and b = 3 the result is 16, because 2 × 8 (check: 25 − 9). The diagram shows a frame: large square minus small square. These are numeric values — not a symbolic factorization like x² − 9.

Input

Terms for the difference of squares

Result

Enter a and b. a² − b² and the factors (a − b) and (a + b) appear here.

The square of a sum (a + b)² and one-number powers live on neighboring pages. Here you always have two fields and the product of difference and sum.

How it works

How 5² − 3² is computed
a − b2
a + b8
a² − b²16

The difference of squares is the algebraic identity a² − b² = (a − b)(a + b). It holds for every pair of real numbers a and b. The calculator uses the numbers you enter in fields a and b and multiplies the difference by the sum. For a = 5 and b = 3 you get 2 × 8 = 16 — the same as 25 − 9.

The algebraic derivation starts from the product (a − b)(a + b). Expanding gives a·a + a·b − b·a − b·b. Because multiplication is commutative, ab = ba, so the middle terms cancel and a² − b² remains. It is one of the classic compact multiplication formulas, alongside (a + b)² and (a − b)².

Geometric reading (for a ≥ b ≥ 0): a square of side a has area a². Subtracting a square of side b leaves a “frame” of area a² − b². The same area is a rectangle with sides (a − b) and (a + b). That picture appears in Euclid’s Elements (Book II).

Related identities: (a + b)² = a² + 2ab + b² and (a − b)² = a² − 2ab + b². Neither is this calculator. A power with exponent 2 raises one number; here you always have two fields. The order of a and b sets the sign of the result.

Worked examples on this page: 5 and 3 → 16; 10 and 6 → 64; 5 and 5 → 0; 3 and 5 → −16; 5 and −3 → 16; 0.5 and 0.1 → 0.24; 13 and 5 → 144; 7 and 0 → 49. The panel shows a², b², a − b, a + b, and a check a² − b² beside the product.

Formula

a2 − b2 = (a − b)(a + b)

Symbol a is the first number (field a). Symbol b is the second (field b). The left side is the difference of squares; the right side is the product of difference and sum.

Mathematical model: difference of squares / compact multiplication identity, with the geometric counterpart in Euclid’s Elements, Book II.

Theory, definition, and geometry

Definition

The difference of squares of two real numbers a and b is the algebraic identity a² − b² = (a − b)(a + b). The left-hand side is the difference of two squares; the right-hand side factors the same polynomial as a product of two linear binomials. This calculator evaluates both paths: it multiplies (a − b) by (a + b), then shows the check a·a − b·b and a geometric reading — the area of a large square minus a small square (a frame).

The identity belongs to the compact multiplication formulas (alongside (a + b)² and (a − b)²). It holds in every commutative ring, in particular in ℝ and ℂ. MathWorld (Difference of Two Squares) and classical elementary-algebra texts give the same factorization. In school it shortens algebraic fractions, solves equations of the form x² − c² = 0, and supports mental arithmetic (for example 13² − 5² = 8 · 18).

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Historical and conceptual context

Geometric “subtracting a square from a square” already appears in Euclid’s Elements (Book II — square and rectangle identities). Modern symbolic algebra wrote the same relation as a² − b² = (a − b)(a + b). In nineteenth–twentieth-century school algebra the formula entered the compact-multiplication canon; in analysis it appears when estimating (a − b)(a + b) = a² − b² in limit proofs, and in trigonometry (1 − sin² x = cos² x is a difference of squares in disguise).

Conceptually the calculator does not solve equations — it only evaluates the identity for given a, b. Do not confuse it with (a − b)² (square of a difference, three terms) or with (a + b)² (square of a sum). The difference of squares is a product, not the square of a binomial.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Formal properties

Domain: a, b ∈ ℝ (or ℂ). Identity: a² − b² − (a − b)(a + b) = 0. Antisymmetry under a ↔ b: the result changes sign. When a = b the result is zero. When b = 0 it reduces to a². Homogeneity: scaling a ↦ λa, b ↦ λb multiplies both sides by λ².

Link to the square of a sum: (a + b)² − (a − b)² = 4ab — an identity tying three compact formulas. In the polynomial ring ℝ[x], the polynomial x² − c² factors as (x − c)(x + c) by the same rule.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Full derivation

Step 1. Write the product (a − b)(a + b).

Step 2. Distributivity: a·a + a·b − b·a − b·b = a² + ab − ba − b².

Step 3. Commutativity of multiplication: ab = ba, so ab − ba = 0. Hence (a − b)(a + b) = a² − b².

Step 4 (geometry). For a ≥ b ≥ 0 a square of side a has area a². Inside it place a square of side b. The frame area is a² − b². Reshaping the frame into a rectangle with sides (a − b) and (a + b) recovers the right-hand side (the classical Elements II picture).

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Special cases

Examples: 5² − 3² = 16 = 2 · 8; 10² − 6² = 64 = 4 · 16; 13² − 5² = 144 = 8 · 18. When a = b: result 0. When b = 0: result a². When a = 0: result −b². Negative b: 5² − (−3)² = 25 − 9 = 16, and the product path is (5 − (−3))(5 + (−3)) = 8 · 2 = 16.

Swapping 3 and 5 gives −16: the sign is part of the result, not an error message. Decimals: 0.5² − 0.1² = 0.24.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Numerical notes

The calculator computes product = (a − b) * (a + b) and check = a·a − b·b in floating-point arithmetic and shows both in the panel. Extreme |a|, |b| may overflow or lose precision when subtracting close squares — the product (a − b)(a + b) is often more stable when a ≈ b. A comma and a period are equivalent.

The calculator does not factor a³ − b³ or a⁴ − b⁴ — only the difference of squares of two scalars.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Related concepts and authorities

Related: square of a sum (a + b)², square of a difference (a − b)², one-number powers, the quadratic equation x² − c² = 0. In trigonometry, 1 − sin² θ = cos² θ is a difference of squares. In higher algebra — factorization in UFD rings.

Authorities: Euclid, Elements II; elementary algebra texts; MathWorld — Difference of Two Squares; Wikipedia — Difference of two squares. Educational tool.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

How to use

  1. Enter a, for example 5.
  2. Enter b, for example 3. Use a comma or a dot for decimals.
  3. Click Calculate or wait for the live result. 5 and 3 give 16.
  4. Check the panel: a² − b², a², b², a − b, a + b, the check, and the frame diagram.
  5. Use the neighboring pages for the square of a sum and for powers.

Symbol glossary

a² − b² = (a − b)(a + b). For a = 5 and b = 3 the result is 16. Domain: ℝ.

a
First number. Field “a”. With 5 and 3: a² = 25.
b
Second number. Field “b”. With 5 and 3: b² = 9.
a − b
Difference. With 5 and 3: 2. One factor of the product.
a + b
Sum. With 5 and 3: 8. The other factor of the product.
a² − b²
Primary result. 5 and 3 → 16. 10 and 6 → 64. 5 and 5 → 0.

Examples

Example 1

  • a = 5
  • b = 3

16

What is 5² − 3²? 16 (2 × 8).

Example 2

  • a = 10
  • b = 6

64

What is 10² − 6²? 64 (4 × 16).

Example 3

  • a = 5
  • b = 5

0

What is 5² − 5²? 0.

Example 4

  • a = 3
  • b = 5

−16

What is 3² − 5²? −16.

Example 5

  • a = 5
  • b = −3

16

What is 5² − (−3)²? 16.

Example 6

  • a = 0.5
  • b = 0.1

0.24

What is 0.5² − 0.1²? 0.24.

Example 7

  • a = 13
  • b = 5

144

What is 13² − 5²? 144.

Example 8

  • a = 7
  • b = 0

49

What is 7² − 0²? 49.

Related calculators

Common questions

What does the difference-of-squares identity mean?

a² − b² = (a − b)(a + b). It is an algebraic identity: the difference of two squares equals the product of their difference and sum. For a = 5 and b = 3: (5 − 3)(5 + 3) = 2 × 8 = 16.

How do you derive a² − b² from multiplication?

(a − b)(a + b) expands by distributivity: a·a + a·b − b·a − b·b. The middle terms ab − ba cancel because ab = ba, leaving a² − b².

What is the geometric reading?

For a ≥ b ≥ 0, the area of a large square of side a minus a small square of side b is a frame of area a² − b². The same number is a rectangle with sides (a − b) and (a + b). The picture appears in Euclid’s Elements, Book II.

How does this differ from (a + b)² and from (a − b)²?

(a + b)² = a² + 2ab + b² is the square of a sum. (a − b)² = a² − 2ab + b² is the square of a difference. The difference of squares a² − b² is the product (a − b)(a + b), not a square. Neighboring calculators cover those other identities.

Does the order of a and b change the result?

Yes. Swapping a and b flips the sign, because a² − b² = −(b² − a²). With 5 and 3 the result is 16; with 3 and 5 it is −16.

Is a negative b allowed?

Yes. The domain is ℝ. For a = 5 and b = −3 the result is 16, because (5 − (−3))(5 + (−3)) = 8 × 2. With negatives the frame diagram is only a sketch using |a| and |b|.

What if a = b?

The result is zero. The difference a − b vanishes, so the product (a − b)(a + b) = 0. With 5 and 5 the result is 0 — equal squares cancel.

Does the calculator compute a·a − b·b separately?

The primary path multiplies (a − b)·(a + b). The panel also shows the check a² − b². Both paths give the same real number.

Does a decimal point in 0.5 work?

Yes. A comma and a period are the same decimal notation. For a = 0.5 and b = 0.1 the result is 0.24.

Is this the same as the power calculator?

No. A power calculator raises one number to an exponent. Here you always have two fields a and b and the product of difference and sum. You may check the result as a² − b², but the fields and diagram belong to this factoring identity.

How do I calculate a difference of squares?

Use a² − b² = (a − b)(a + b). With a = 5 and b = 3: (5 − 3)(5 + 3) = 2 × 8 = 16. Check: 25 − 9 = 16.

What is 5² − 3²?

16. Enter a = 5 and b = 3. The product (5 − 3)(5 + 3) = 2 × 8 matches 25 − 9.

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

No. (a − b)² = a² − 2ab + b² is the square of a difference. A difference of squares is the product (a − b)(a + b), without a leftover −2ab term.

Does the page factor the polynomial x² − 9?

No. The fields take numbers a and b and compute the value of a² − b². Symbolic factoring into (x − 3)(x + 3) sits outside this card.

How can I compute 13² − 5² quickly without squaring?

Compute (13 − 5)(13 + 5) = 8 × 18 = 144. Same result as 169 − 25.

For a = 5 and b = 3, a² − b² = 16 because 2 × 8. Checking 25 − 9 gives the same number. The square of a sum is on the neighboring page.

Knowledge sources

The identity, derivation, and geometric note come from standard references.

Page updated November 3, 2026.