Last updated: August 5, 2026
Pythagorean Triples Calculator
Creators
Dharmendra SinghReviewers

Creators
Dharmendra SinghReviewers
Quick Answer
The Pythagorean Triples Calculator generates whole-number right triangle sides using Euclid's formula (a=m²-n², b=2mn, c=m²+n²) from two integer generators, optionally scaled by a multiplier k, and checks whether the resulting triple is primitive and valid.
Euclid's formula generates a Pythagorean triple by combining two integers into three side lengths that always satisfy a squared plus b squared equals c squared.
Key Takeaways
- Euclid's formula generates a Pythagorean triple from any integers m > n > 0: a=m²-n², b=2mn, c=m²+n².
- A triple is primitive only when m and n are coprime and have opposite parity.
- Every primitive triple can be generated by Euclid's formula for some valid (m, n) pair.
- Scaling a triple by an integer k always produces a valid but non-primitive triple.
- There are infinitely many Pythagorean triples, both primitive and scaled.
Creators
Dharmendra SinghReviewers

Creators
Dharmendra SinghReviewers
Formula
a = k(m² − n²), b = k(2mn), c = k(m² + n²), for integers m > n > 0 (Euclid's formula)
Where:
- m=Larger generator integer
- n=Smaller generator integer
- k=Optional scale multiplier
Watch & Learn
An exploration of Euclid's formula for generating Pythagorean triples and why infinitely many primitive triples exist.
Worked Examples
Generate the classic 3-4-5 triple
The smallest possible generators, m=2 and n=1, produce the most famous Pythagorean triple.
- 1a = 2² − 1² = 4 − 1 = 3.
- 2b = 2 × 2 × 1 = 4.
- 3c = 2² + 1² = 4 + 1 = 5.
- 4Since gcd(2,1)=1 and m, n have different parity, the triple 3-4-5 is primitive.
Generate the 5-12-13 triple
A larger pair of generators produces a bigger primitive triple.
- 1a = 3² − 2² = 9 − 4 = 5.
- 2b = 2 × 3 × 2 = 12.
- 3c = 3² + 2² = 9 + 4 = 13.
- 4gcd(3,2)=1 and they have different parity, so 5-12-13 is primitive.
Scale a triple with the multiplier k
Using k=2 with m=2, n=1 doubles every side of the 3-4-5 triple.
- 1Base triple from m=2, n=1: (3, 4, 5).
- 2Scale every side by k=2: a=6, b=8, c=10.
- 3Since k ≠ 1, the result 6-8-10 is a valid but non-primitive triple.
Introduction
The Pythagorean Triples Calculator generates whole-number right triangle sides using Euclid's ancient formula, which produces every primitive Pythagorean triple from just two generator integers. Rather than guessing and checking combinations, this tool lets students and math enthusiasts systematically build triples like 3-4-5, 5-12-13, and beyond, while automatically checking whether the result is primitive (not a multiple of a smaller triple) and confirming it satisfies a² + b² = c².

What is a Pythagorean triple?
A Pythagorean triple is a set of three positive integers (a, b, c) that satisfy a² + b² = c², meaning they could form the sides of a right triangle with whole-number lengths. A primitive triple is one where the three numbers share no common factor greater than 1.
A triple satisfies a² + b² = c² with all whole numbers.
A primitive triple has no common factor among all three sides.
Non-primitive triples are just scaled multiples of a primitive one.
How Euclid's formula works
Euclid's formula generates a triple from any two positive integers m > n > 0: a = m² − n², b = 2mn, c = m² + n². The resulting triple is guaranteed to satisfy the Pythagorean relationship, and it is primitive exactly when m and n are coprime (share no common factor) and have opposite parity (one even, one odd).
a = m² − n² (difference of squares).
b = 2mn (twice the product).
c = m² + n² (sum of squares).
Primitivity requires gcd(m, n) = 1 and m, n of opposite parity.
Using the inputs correctly
Choose two positive integers with m strictly greater than n. An optional scale multiplier k lets you generate non-primitive multiples of the base triple, such as 6-8-10 from the 3-4-5 base.
m and n must both be positive integers with m > n.
k defaults to 1 and must be a positive integer if provided.
Larger m and n values generate larger triples.
Reading the outputs
The three sides a, b, and c form the generated triple, always satisfying a² + b² = c². The primitive flag tells you whether this triple is in its most reduced form, and the valid flag double-checks the Pythagorean relationship holds exactly.
- sideA, sideB, sideC:
the three integer sides of the triangle.
- isPrimitive:
whether the triple shares no common factor and m,n differ in parity.
- isValidTriple:
confirms a² + b² = c² holds exactly.
A dependable step-by-step workflow
These four steps mirror exactly how the calculator generates and checks each triple.
Choose generator integers m and n with m > n.
Apply Euclid's formula to get a, b, and c.
Scale by the multiplier k if provided.
Check primitivity using the gcd and parity conditions.
Common mistakes and how to avoid them
A common mistake is assuming every triple generated by Euclid's formula is automatically primitive — it is only primitive when m and n are coprime and have opposite parity. Another mistake is forgetting that m must be strictly greater than n, or the formula produces a non-positive side.
Not every (m, n) pair produces a primitive triple.
m must be strictly greater than n, both positive.
Scaling with k > 1 always produces a non-primitive triple.
Where Pythagorean triples show up
These triples appear in construction (whole-number right-angle checks), cryptographic and number theory research, computer science algorithm design, and recreational mathematics puzzles exploring number patterns.
Construction: using whole-number triangles like 3-4-5 to verify right angles.
Number theory research on Diophantine equations.
Competitive math and recreational puzzle problems.
Teaching the connection between algebra and geometry.
Reference patterns to remember
A quick reference table of small (m, n) pairs and their resulting triples helps you generate examples quickly.
(m=2, n=1) gives the smallest primitive triple, 3-4-5.
(m=3, n=2) gives 5-12-13.
(m=4, n=1) gives 15-8-17 (same triangle, sides reordered).
| m | n | Triple (a, b, c) |
|---|---|---|
| 2 | 1 | 3, 4, 5 |
| 3 | 2 | 5, 12, 13 |
| 4 | 1 | 15, 8, 17 |
| 4 | 3 | 7, 24, 25 |
Quick Reference Card
Pythagorean Triples Cheat Sheet
Quick reference • Pythagorean Triples Calculator
a=m²−n², b=2mn, c=m²+n²Valid range: Integers m > n > 0, optional integer k ≥ 1
Common Values
⚠ Watch Out
- •m must be strictly greater than n.
- •Same-parity m,n still form a valid but non-primitive triple.
- •Scaling with k always removes primitivity unless k=1.
- •Check domain restrictions before trusting the final value.
Pro Tips
- →Pick coprime m,n with opposite parity to guarantee a primitive triple.
- →Use small (m,n) pairs first to build intuition before trying larger ones.
- →Cross-check results with the Pythagoras Triangle Calculator's a²+b²=c² check.
- →Estimate the answer mentally first so large errors stand out.
FAQs
What makes a Pythagorean triple 'primitive'?
A triple is primitive when the three sides share no common factor greater than 1. Using Euclid's formula, this happens exactly when the generators m and n are coprime and have opposite parity (one even, one odd).
Why must m be greater than n?
If m were less than or equal to n, the formula a = m² − n² would produce zero or a negative value, which cannot be the length of a triangle side.
Does Euclid's formula generate every possible Pythagorean triple?
Yes, every primitive Pythagorean triple can be generated by Euclid's formula for some choice of coprime m and n with opposite parity, and every non-primitive triple is simply a scaled multiple of a primitive one.
What does the scale multiplier k do?
It multiplies every side of the base triple by the same integer, producing a similar but larger, non-primitive triangle — for example, k=2 turns the primitive triple 3-4-5 into 6-8-10.
Can (m, n) with the same parity still produce a valid triple?
Yes, the triple will still satisfy a² + b² = c², but it will not be primitive — it will actually be a multiple of a smaller primitive triple, since all three sides will share a common factor of 2.
Are there infinitely many Pythagorean triples?
Yes, since you can choose infinitely many valid (m, n) pairs, there are infinitely many primitive Pythagorean triples, and infinitely many more non-primitive multiples of each.
How is this different from the Pythagoras Triangle Calculator?
The Pythagoras Triangle Calculator finds the hypotenuse from any two given legs, which may not be whole numbers. This calculator instead generates guaranteed whole-number triples from two integer parameters using Euclid's formula.