Understanding the Pythagorean triples calculator — concept and principle
This calculator generates Pythagorean triples with Euclid's formula, or checks whether three whole numbers form one. It reports whether the triple is primitive, the Euclid parameters, and the perimeter, area and inradius of the right triangle. Use it for number theory, geometry homework, puzzle design and setting out right angles with whole-number lengths.
How it is calculated
- Generate mode: for whole numbers m > n > 0 and multiplier k, a = k(m² − n²), b = k·2mn, c = k(m² + n²).
- Primitive (no common factor) exactly when k = 1, m and n are coprime and one of them is even.
- Check mode: sort the three numbers, test a² + b² = c², divide by the greatest common divisor, and recover m = √((c + a)/2), n = √((c − a)/2) using the odd leg a.
- Perimeter = a + b + c; area = ab ÷ 2; inradius = (a + b − c) ÷ 2.
The principle
Euclid's formula works by algebra: (m² − n²)² + (2mn)² = m⁴ − 2m²n² + n⁴ + 4m²n² = m⁴ + 2m²n² + n⁴ = (m² + n²)². So any m > n gives a valid triple. Every primitive triple arises this way from exactly one pair of coprime m, n of opposite parity, and every other triple is a whole-number multiple of a primitive one. In a primitive triple one leg is even and the other odd, and the hypotenuse is always odd. The inradius of any right triangle is (a + b − c)/2, which is a whole number for every Pythagorean triple.
Worked example
Default inputs: generate mode, m = 4, n = 1, k = 1.
- a = 4² − 1² = 15, b = 2 × 4 × 1 = 8, c = 4² + 1² = 17.
- Sorted: (8, 15, 17). Check: 64 + 225 = 289 = 17².
- gcd(4, 1) = 1 and 4 is even, so the triple is primitive.
- Perimeter = 8 + 15 + 17 = 40; area = 8 × 15 ÷ 2 = 60.
- Inradius = (8 + 15 − 17) ÷ 2 = 3.
How to read the result
"Yes — a Pythagorean triple" means the three lengths make an exact right triangle. "Primitive" means it is not a scaled copy of a smaller triple; (6, 8, 10), for example, is 2 × (3, 4, 5). The Euclid parameters let you reproduce the triple or find related ones. In check mode, a "no" means no right triangle has exactly those whole-number sides.
Common mistakes
- Using m ≤ n, which gives zero or negative sides.
- Picking m and n both odd; the result is valid but not primitive.
- Assuming the largest input is not the hypotenuse; it always is.
- Thinking (5, 12, 13) and (10, 24, 26) are unrelated; the second is twice the first.
Frequently asked questions
What are the smallest Pythagorean triples?
(3, 4, 5), (5, 12, 13), (8, 15, 17) and (7, 24, 25) are the first primitive ones.
Are there infinitely many?
Yes. Every pair m > n gives one, so there are infinitely many, including infinitely many primitive ones.
Can all three numbers be odd?
No. If a and b were both odd, a² + b² would leave remainder 2 when divided by 4, which no square does.
Sources: Weisstein, E. W., "Pythagorean Triple", Wolfram MathWorld