Skip to main content

Pythagorean Triples Calculator

Free Pythagorean triples Calculator for triangle. Enter values to get step-by-step solutions with formulas and graphs.

Skip to calculator
Mathematics

Pythagorean Triples Calculator

Generate all Pythagorean triples up to any limit. Check if numbers form a triple, identify primitive triples, and explore integer right triangle relationships.

Last updated: December 2025Reviewed by NovaCalculator Mathematics Team

Calculator

Adjust values & calculate
Check a Pythagorean Triple
({3, 4, 5}) is a primitive Pythagorean triple! Area = 6, Perimeter = 12
100
Triples Found (hypotenuse up to 100)
52
16 primitive + 36 non-primitive
Primitive Triples
16
Total Triples
52

All Pythagorean Triples

(3, 4, 5)
Primitive
(6, 8, 10)
k = 2
(5, 12, 13)
Primitive
(9, 12, 15)
k = 3
(8, 15, 17)
Primitive
(12, 16, 20)
k = 4
(7, 24, 25)
Primitive
(15, 20, 25)
k = 5
(10, 24, 26)
k = 2
(20, 21, 29)
Primitive
(18, 24, 30)
k = 6
(16, 30, 34)
k = 2
(21, 28, 35)
k = 7
(12, 35, 37)
Primitive
(15, 36, 39)
k = 3
(24, 32, 40)
k = 8
(9, 40, 41)
Primitive
(27, 36, 45)
k = 9
(14, 48, 50)
k = 2
(30, 40, 50)
k = 10
(24, 45, 51)
k = 3
(20, 48, 52)
k = 4
(28, 45, 53)
Primitive
(33, 44, 55)
k = 11
(40, 42, 58)
k = 2
(36, 48, 60)
k = 12
(11, 60, 61)
Primitive
(16, 63, 65)
Primitive
(25, 60, 65)
k = 5
(33, 56, 65)
Primitive
(39, 52, 65)
k = 13
(32, 60, 68)
k = 4
(42, 56, 70)
k = 14
(48, 55, 73)
Primitive
(24, 70, 74)
k = 2
(21, 72, 75)
k = 3
(45, 60, 75)
k = 15
(30, 72, 78)
k = 6
(48, 64, 80)
k = 16
(18, 80, 82)
k = 2
(13, 84, 85)
Primitive
(36, 77, 85)
Primitive
(40, 75, 85)
k = 5
(51, 68, 85)
k = 17
(60, 63, 87)
k = 3
(39, 80, 89)
Primitive
(54, 72, 90)
k = 18
(35, 84, 91)
k = 7
(57, 76, 95)
k = 19
(65, 72, 97)
Primitive
... and 2 more triples
Your Result
16 primitive triples and 52 total triples with hypotenuse up to 100
Share Your Result
Understand the Math

Formula

a = m^2 - n^2, b = 2mn, c = m^2 + n^2 (Euclid's formula)

Euclid's formula generates all primitive Pythagorean triples using integers m > n > 0 where gcd(m,n) = 1 and m - n is odd. Non-primitive triples are obtained by multiplying a primitive triple by a positive integer k.

Last reviewed: December 2025

Worked Examples

Example 1: Verify and Analyze a Triple

Check if (5, 12, 13) is a Pythagorean triple and determine if it is primitive.
Solution:
Check: 5^2 + 12^2 = 25 + 144 = 169 = 13^2. Yes, it is a triple. GCD(5, 12, 13) = 1, so it is primitive. Generated by Euclid's formula: m=3, n=2 a = 9-4 = 5, b = 2*3*2 = 12, c = 9+4 = 13 Area = (1/2)(5)(12) = 30 Perimeter = 5 + 12 + 13 = 30
Result: (5, 12, 13) is a primitive Pythagorean triple. Area = 30, Perimeter = 30. Notably, area equals perimeter numerically.

Example 2: Find All Triples up to 50

List all primitive Pythagorean triples with hypotenuse up to 50.
Solution:
Using Euclid's formula for all valid (m, n) pairs: m=2,n=1: (3,4,5) m=3,n=2: (5,12,13) m=4,n=1: (8,15,17) m=4,n=3: (7,24,25) m=5,n=2: (20,21,29) m=5,n=4: (9,40,41) m=6,n=1: (12,35,37) m=6,n=5: (11,60,61) - exceeds 50 m=7,n=2: (45,28,53) - exceeds 50
Result: 7 primitive triples with hypotenuse up to 50: (3,4,5), (5,12,13), (8,15,17), (7,24,25), (20,21,29), (9,40,41), (12,35,37).
Expert Insights

Background & Theory

The Pythagorean Triples Calculator applies the following established principles and formulas. Mathematics rests on a hierarchy of number systems, each extending the previous. The natural numbers (1, 2, 3, ...) support counting and ordering. The integers add negative values and zero, enabling subtraction without restriction. The rational numbers, expressible as p/q where p and q are integers and q is nonzero, close the system under division. The real numbers fill the gaps left by irrationals such as the square root of 2 or pi, forming a complete ordered field. The complex numbers, written as a + bi where i is the square root of negative one, complete the algebraic closure of the reals and allow every polynomial to have a root. Prime factorization states that every integer greater than one is uniquely expressible as a product of primes, a result known as the Fundamental Theorem of Arithmetic. Computing the greatest common divisor (GCD) of two integers relies most efficiently on the Euclidean algorithm: repeatedly replace the larger number with the remainder when it is divided by the smaller, until the remainder is zero. The last nonzero remainder is the GCD. The least common multiple (LCM) follows from the identity LCM(a, b) = |a * b| / GCD(a, b). Modular arithmetic defines equivalence classes of integers that share the same remainder under division by a modulus n. Fermat's Little Theorem and Euler's Theorem arise from this structure and underpin modern cryptography. Logarithms are the inverses of exponential functions. If b raised to the power x equals y, then the logarithm base b of y equals x. The natural logarithm uses base e, approximately 2.71828. Combinatorics counts arrangements and selections. The number of ordered arrangements (permutations) of r objects from n distinct objects is nPr = n! / (n - r)!. The number of unordered selections (combinations) is nCr = n! / (r! * (n - r)!). Pascal's triangle arranges these binomial coefficients so that each entry equals the sum of the two entries directly above it. The Fibonacci sequence, defined by F(1) = 1, F(2) = 1, and F(n) = F(n-1) + F(n-2), appears throughout nature and connects deeply to the golden ratio via Binet's formula.

History

The history behind the Pythagorean Triples Calculator traces back through the following developments. Mathematics as a systematic discipline traces to ancient Mesopotamia. Babylonian clay tablets dating to around 1800 BCE demonstrate knowledge of quadratic equations, Pythagorean triples, and base-60 arithmetic, suggesting a practical mathematical tradition far preceding Greek formalism. Euclid of Alexandria compiled the Elements around 300 BCE, establishing the axiomatic method that would define rigorous mathematics for over two thousand years. His work organized plane geometry, number theory, and proportion into logically chained propositions derived from a small set of postulates. The algorithm bearing his name for computing GCDs appears in Book VII and remains in use today. In the 9th century, the Persian scholar Muhammad ibn Musa Al-Khwarizmi wrote Al-Kitab al-mukhtasar fi hisab al-jabr wal-muqabala, the treatise whose title gave algebra its name. He systematized the solution of linear and quadratic equations and described procedures that operated on unknowns as objects, a conceptual leap away from purely numerical calculation. Rene Descartes introduced coordinate geometry in 1637 by uniting algebra and Euclidean geometry, allowing curves to be studied through equations. This synthesis set the stage for calculus. Isaac Newton and Gottfried Wilhelm Leibniz independently developed calculus during the 1660s and 1670s, triggering a priority dispute that lasted decades and divided British and Continental mathematicians. Carl Friedrich Gauss proved the Fundamental Theorem of Algebra in 1799, showing that every nonconstant polynomial has at least one complex root. His Disquisitiones Arithmeticae of 1801 established modern number theory. David Hilbert's formalist program at the turn of the 20th century sought to place all of mathematics on an explicit axiomatic foundation, a project that Kurt Godel's incompleteness theorems of 1931 showed to be fundamentally limited. Alan Turing's work in the 1930s on computability introduced the theoretical model of the stored-program computer and linked mathematical logic directly to the limits of algorithmic calculation. His proof that no algorithm can decide in general whether an arbitrary program will halt or run forever placed fundamental boundaries on what mathematics can mechanically determine, and it opened the discipline now known as theoretical computer science.

Share this calculator

Explore More

Frequently Asked Questions

A primitive Pythagorean triple is one where the three numbers share no common factor greater than 1, meaning gcd(a, b, c) = 1. For example, (3, 4, 5) is primitive because the greatest common divisor of 3, 4, and 5 is 1. However, (6, 8, 10) is not primitive because all three numbers are divisible by 2, making it simply a scaled version of (3, 4, 5). Every non-primitive Pythagorean triple is a multiple of some primitive triple. Primitive triples are the building blocks from which all other Pythagorean triples can be generated. There are infinitely many primitive triples, and they have special properties: exactly one of a or b is even, the even number is always divisible by 4, and exactly one of a, b, c is divisible by 5.
Euclid's formula generates all primitive Pythagorean triples using two positive integers m and n where m > n. The triple is: a = m^2 - n^2, b = 2mn, c = m^2 + n^2. For the triple to be primitive, m and n must be coprime (gcd(m,n) = 1) and m - n must be odd. For example, m=2, n=1 gives a=3, b=4, c=5. And m=3, n=2 gives a=5, b=12, c=13. Every primitive Pythagorean triple can be generated this way (up to swapping a and b). Non-primitive triples are obtained by multiplying a primitive triple by a positive integer k: (ka, kb, kc). This formula was known to the ancient Greeks and provides a systematic way to enumerate all possible integer-sided right triangles.
There are infinitely many Pythagorean triples and infinitely many primitive Pythagorean triples. The number of primitive triples with hypotenuse up to N grows approximately as N / (2 times pi), while the total number of triples (including non-primitive) up to N grows approximately as N / (2 times pi) times ln(N). For example, there are 16 primitive triples with hypotenuse up to 100, and 52 total triples. The density of primitive triples decreases as numbers get larger, but they never stop appearing. This was proven rigorously using Euclid's formula which shows that for every pair of suitable m and n values, a new primitive triple is generated. The study of how Pythagorean triples are distributed among the integers is an active area of number theory.
Pythagorean triples exhibit fascinating numerical patterns. In every primitive triple, exactly one leg is even and one is odd, and the hypotenuse is always odd. The even leg is always divisible by 4, and exactly one of the three numbers is divisible by 3 and exactly one by 5. Consecutive integers sometimes form triples: (3,4,5), (5,12,13), (7,24,25), (9,40,41) follow the pattern (2n+1, 2n^2+2n, 2n^2+2n+1). Another family has b = a+1: these triples include (3,4,5), (20,21,29), (119,120,169). A tree structure connects all primitive triples: starting from (3,4,5), three matrix transformations generate all other primitive triples, forming an infinite ternary tree discovered by Berggren in 1934.
Pythagorean triples are invaluable in construction because they provide exact right angles using only a measuring tape, no special tools needed. The most common method uses the 3-4-5 triple: measure 3 units along one wall, 4 units along the perpendicular wall, and if the diagonal is exactly 5 units, the corner is perfectly square. Larger multiples provide greater accuracy: 6-8-10, 9-12-15, or 12-16-20 are commonly used on construction sites. The 5-12-13 triple is popular for longer walls. Carpenters use these triples to square foundations, frame walls, lay out decks, and install cabinets. The beauty of using integer triples is that measurements are exact without rounding errors, unlike using a protractor or speed square which may introduce small angular errors.
Pythagorean triples solve the equation a^n + b^n = c^n for n=2 with positive integers. Fermat's Last Theorem, proved by Andrew Wiles in 1995, states that no positive integer solutions exist for any n greater than 2. This means while there are infinitely many integer solutions for squares (Pythagorean triples), there are zero solutions for cubes, fourth powers, or any higher power. Fermat wrote in 1637 that he had a proof too large for the margin of his book, but the actual proof required over 350 years of mathematical development. The contrast between the abundance of Pythagorean triples and the complete absence of solutions for higher powers is one of the most beautiful results in number theory.
Educational Note: This calculator is provided for educational and informational purposes. Results are based on the formulas and inputs provided. Always verify important calculations independently. NovaCalculator processes calculator inputs client-side; optional analytics follow visitor consent settings.Reviewed by: NovaCalculator Mathematics Team โ€” Verified against standard mathematical and scientific references. Last reviewed: December 2025. ยฉ 2024โ€“2026 NovaCalculator.

Share this calculator

Formula

a = m^2 - n^2, b = 2mn, c = m^2 + n^2 (Euclid's formula)

Euclid's formula generates all primitive Pythagorean triples using integers m > n > 0 where gcd(m,n) = 1 and m - n is odd. Non-primitive triples are obtained by multiplying a primitive triple by a positive integer k.

Worked Examples

Example 1: Verify and Analyze a Triple

Problem: Check if (5, 12, 13) is a Pythagorean triple and determine if it is primitive.

Solution: Check: 5^2 + 12^2 = 25 + 144 = 169 = 13^2. Yes, it is a triple.\nGCD(5, 12, 13) = 1, so it is primitive.\nGenerated by Euclid's formula: m=3, n=2\na = 9-4 = 5, b = 2*3*2 = 12, c = 9+4 = 13\nArea = (1/2)(5)(12) = 30\nPerimeter = 5 + 12 + 13 = 30

Result: (5, 12, 13) is a primitive Pythagorean triple. Area = 30, Perimeter = 30. Notably, area equals perimeter numerically.

Example 2: Find All Triples up to 50

Problem: List all primitive Pythagorean triples with hypotenuse up to 50.

Solution: Using Euclid's formula for all valid (m, n) pairs:\nm=2,n=1: (3,4,5)\nm=3,n=2: (5,12,13)\nm=4,n=1: (8,15,17)\nm=4,n=3: (7,24,25)\nm=5,n=2: (20,21,29)\nm=5,n=4: (9,40,41)\nm=6,n=1: (12,35,37)\nm=6,n=5: (11,60,61) - exceeds 50\nm=7,n=2: (45,28,53) - exceeds 50

Result: 7 primitive triples with hypotenuse up to 50: (3,4,5), (5,12,13), (8,15,17), (7,24,25), (20,21,29), (9,40,41), (12,35,37).

Frequently Asked Questions

What is a primitive Pythagorean triple?

A primitive Pythagorean triple is one where the three numbers share no common factor greater than 1, meaning gcd(a, b, c) = 1. For example, (3, 4, 5) is primitive because the greatest common divisor of 3, 4, and 5 is 1. However, (6, 8, 10) is not primitive because all three numbers are divisible by 2, making it simply a scaled version of (3, 4, 5). Every non-primitive Pythagorean triple is a multiple of some primitive triple. Primitive triples are the building blocks from which all other Pythagorean triples can be generated. There are infinitely many primitive triples, and they have special properties: exactly one of a or b is even, the even number is always divisible by 4, and exactly one of a, b, c is divisible by 5.

How does Euclid's formula generate Pythagorean triples?

Euclid's formula generates all primitive Pythagorean triples using two positive integers m and n where m > n. The triple is: a = m^2 - n^2, b = 2mn, c = m^2 + n^2. For the triple to be primitive, m and n must be coprime (gcd(m,n) = 1) and m - n must be odd. For example, m=2, n=1 gives a=3, b=4, c=5. And m=3, n=2 gives a=5, b=12, c=13. Every primitive Pythagorean triple can be generated this way (up to swapping a and b). Non-primitive triples are obtained by multiplying a primitive triple by a positive integer k: (ka, kb, kc). This formula was known to the ancient Greeks and provides a systematic way to enumerate all possible integer-sided right triangles.

How many Pythagorean triples exist?

There are infinitely many Pythagorean triples and infinitely many primitive Pythagorean triples. The number of primitive triples with hypotenuse up to N grows approximately as N / (2 times pi), while the total number of triples (including non-primitive) up to N grows approximately as N / (2 times pi) times ln(N). For example, there are 16 primitive triples with hypotenuse up to 100, and 52 total triples. The density of primitive triples decreases as numbers get larger, but they never stop appearing. This was proven rigorously using Euclid's formula which shows that for every pair of suitable m and n values, a new primitive triple is generated. The study of how Pythagorean triples are distributed among the integers is an active area of number theory.

What patterns exist in Pythagorean triples?

Pythagorean triples exhibit fascinating numerical patterns. In every primitive triple, exactly one leg is even and one is odd, and the hypotenuse is always odd. The even leg is always divisible by 4, and exactly one of the three numbers is divisible by 3 and exactly one by 5. Consecutive integers sometimes form triples: (3,4,5), (5,12,13), (7,24,25), (9,40,41) follow the pattern (2n+1, 2n^2+2n, 2n^2+2n+1). Another family has b = a+1: these triples include (3,4,5), (20,21,29), (119,120,169). A tree structure connects all primitive triples: starting from (3,4,5), three matrix transformations generate all other primitive triples, forming an infinite ternary tree discovered by Berggren in 1934.

How are Pythagorean triples used in construction?

Pythagorean triples are invaluable in construction because they provide exact right angles using only a measuring tape, no special tools needed. The most common method uses the 3-4-5 triple: measure 3 units along one wall, 4 units along the perpendicular wall, and if the diagonal is exactly 5 units, the corner is perfectly square. Larger multiples provide greater accuracy: 6-8-10, 9-12-15, or 12-16-20 are commonly used on construction sites. The 5-12-13 triple is popular for longer walls. Carpenters use these triples to square foundations, frame walls, lay out decks, and install cabinets. The beauty of using integer triples is that measurements are exact without rounding errors, unlike using a protractor or speed square which may introduce small angular errors.

What is the connection between Pythagorean triples and Fermat's Last Theorem?

Pythagorean triples solve the equation a^n + b^n = c^n for n=2 with positive integers. Fermat's Last Theorem, proved by Andrew Wiles in 1995, states that no positive integer solutions exist for any n greater than 2. This means while there are infinitely many integer solutions for squares (Pythagorean triples), there are zero solutions for cubes, fourth powers, or any higher power. Fermat wrote in 1637 that he had a proof too large for the margin of his book, but the actual proof required over 350 years of mathematical development. The contrast between the abundance of Pythagorean triples and the complete absence of solutions for higher powers is one of the most beautiful results in number theory.

References

Reviewed by Manoj Kumar, Mathematics Educator ยท Editorial policy