Last verified · v1.0
Calculator · math
Pythagorean Triples Calculator (Euclid's Formula)
Generate primitive and non-primitive Pythagorean triples using Euclid's formula a=k(m²−n²), b=2kmn, c=k(m²+n²). Enter m, n, and optional k for instant results.
Inputs
Selected Triple Value
—
Explain my result
Get a plain-English breakdown of your result with practical next steps.
The formula
How the
result is
computed.
What Are Pythagorean Triples?
A Pythagorean triple is a set of three positive integers (a, b, c) satisfying a² + b² = c² — the exact-integer form of the Pythagorean theorem for right triangles. The most familiar example, (3, 4, 5), was used in ancient Egyptian rope surveying and appears on Babylonian clay tablet Plimpton 322, dated to roughly 1800 BCE. Beyond history, these triples arise in architecture, computer graphics, and competitive mathematics. Euclid provided a complete parametric formula to generate every such triple, and this calculator implements it directly.
Euclid’s Formula: How It Works
Given two positive integers m and n with m > n > 0, and a positive integer multiplier k, Euclid’s formula defines a Pythagorean triple as:
- a = k(m² − n²) — one leg of the right triangle
- b = 2kmn — the second leg
- c = k(m² + n²) — the hypotenuse
Setting k = 1 yields the base triple for the chosen (m, n) pair. As Keith Conrad demonstrates in his analysis of Pythagorean descent, this parametrization is complete: every integer solution to a² + b² = c² appears when m, n, and k range over all valid values (Conrad, Pythagorean Descent, University of Connecticut).
Algebraic Proof of Correctness
The identity holds by expanding a² + b²: k²(m² − n²)² + (2kmn)² = k²[(m² − n²)² + 4m²n²] = k²(m² + n²)² = c². The step (m² − n²)² + 4m²n² = (m² + n²)² is a standard polynomial identity. This guarantees every output triple satisfies the theorem exactly, with zero floating-point error.
Primitive vs. Non-Primitive Triples
A Pythagorean triple is called primitive when gcd(a, b, c) = 1 — the three values share no common factor. To generate a primitive triple, three conditions must hold: k = 1; gcd(m, n) = 1 (m and n coprime); and m and n must have opposite parity (one even, one odd). When k > 1, every element is divisible by k, producing a non-primitive triple. For example, k = 2, m = 2, n = 1 gives (6, 8, 10) = 2 × (3, 4, 5). D. Joyce at Clark University confirms that every Pythagorean triple is either primitive or an integer multiple of a primitive triple (Joyce, Right Triangles, Clark University).
Worked Examples
Example 1: The (3, 4, 5) Triple
Set m = 2, n = 1, k = 1. Then a = 1 × (4 − 1) = 3, b = 2 × 1 × 2 × 1 = 4, c = 1 × (4 + 1) = 5. Check: 9 + 16 = 25. Since gcd(2, 1) = 1 and 2 is even while 1 is odd, this is a primitive triple.
Example 2: The (5, 12, 13) Triple
Set m = 3, n = 2, k = 1. Then a = 9 − 4 = 5, b = 2 × 3 × 2 = 12, c = 9 + 4 = 13. Check: 25 + 144 = 169. Primitive, since gcd(3, 2) = 1 and opposite parity holds.
Example 3: The (8, 15, 17) Triple
Set m = 4, n = 1, k = 1. Then a = 16 − 1 = 15, b = 2 × 4 × 1 = 8, c = 16 + 1 = 17. Check: 64 + 225 = 289 = 17². Primitive.
Example 4: A Non-Primitive Triple
Set m = 2, n = 1, k = 5. Then a = 5 × 3 = 15, b = 5 × 4 = 20, c = 5 × 5 = 25, giving (15, 20, 25) = 5 × (3, 4, 5). Check: 225 + 400 = 625. Non-primitive because k = 5.
Real-World Applications
Pythagorean triples have concrete uses well beyond the classroom:
- Construction: The 3-4-5 ratio is the fastest field method for verifying 90° corners — mark 3 units on one wall and 4 on the adjacent wall; a diagonal of exactly 5 confirms a right angle.
- Surveying: Large triples such as (20, 21, 29) and (28, 45, 53) let surveyors lay out right angles over long distances with integer measurements and no trigonometry tables.
- Computer graphics: Integer-coordinate right triangles eliminate floating-point drift in rasterized line segments and texture mapping pipelines.
- Competitive mathematics: Memorizing triples like (7, 24, 25), (9, 40, 41), and (11, 60, 61) allows instant identification of right triangles in olympiad geometry problems.
For a rigorous proof of completeness, J. Silverman’s Number Theory Unit 4 at Brown University provides an accessible yet formal treatment of why Euclid’s parametrization covers every possible case (Silverman, Number Theory Unit 4, Brown University).
Reference