Pythagorean Triples Calculator

Generate Pythagorean triples with Euclid’s formula from m and n, and list all triples up to a chosen hypotenuse. Example: with m 5, n 2, …, the result is Triple from m and n = (20, 21, 29); Check a² + b² = c² = 441 + 400 = 841.

Last updated · By · Runs in your browser, nothing is uploaded

Result

Step-by-Step Solution

Enter your values above to see the full working.

How do you use the Pythagorean Triples Calculator?

Enter integers m > n ≥ 1 and a limit. The calculator builds the triple with Euclid’s formula, checks a² + b² = c², tells you if it is primitive and lists every Pythagorean triple whose hypotenuse is at most the limit.

What formula does the Pythagorean Triples Calculator use?

Euclid’s formula: a = m² − n², b = 2mn, c = m² + n² gives a Pythagorean triple for any m > n ≥ 1. It is primitive (no common factor) when m and n are coprime and of opposite parity. Every triple is a multiple of a primitive one.

Worked example: m 5, n 2, List all triples with hypotenuse up to 50

With m = 5 and n = 2: a = 25 − 4 = 21, b = 2 × 5 × 2 = 20 and c = 25 + 4 = 29, so (20, 21, 29); check 400 + 441 = 841 = 29². Up to hypotenuse 50 there are 20 triples, including (3, 4, 5), (5, 12, 13), (8, 15, 17) and (20, 21, 29).

With the default values the calculator returns Triple from m and n = (20, 21, 29); Check a² + b² = c² = 441 + 400 = 841; Primitive? = Yes (m, n coprime and of opposite parity); All triples with hypotenuse ≤ 50 = (3, 4, 5) (5, 12, 13) (6, 8, 10) (7, 24, 25) (8, 15, 17) (9, 12, 15) (9, 40, 41) (10, 24, 26) (12, 16, 20) (12, 35, 37) (14, 48, 50) (15, 20, 25) (15, 36, 39) (16, 30, 34) (18, 24, 30) (20, 21, 29) (21, 28, 35) (24, 32, 40) (27, 36, 45) (30, 40, 50).

Where Is This Calculation Used?

Pythagorean triples give right triangles with whole-number sides, used in carpentry (the 3-4-5 method for square corners), surveying and puzzles. They are also linked to Gaussian integers and to the problem of rational points on a circle.

What are the most common mistakes with the Pythagorean Triples Calculator?

  • Using n larger than m, which gives a negative side.
  • Assuming every triple is primitive; (6, 8, 10) is a multiple of (3, 4, 5).
  • Swapping the roles of a and b with the hypotenuse c.

What Is the Tested Example for the Default Values?

This example is computed by the same code that powers the calculator above, so you can compare it with your own numbers or a textbook answer.

Input: m5
Input: n2
Input: List all triples with hypotenuse up to50
Triple from m and n(20, 21, 29)
Check a² + b² = c²441 + 400 = 841
Primitive?Yes (m, n coprime and of opposite parity)
All triples with hypotenuse ≤ 50(3, 4, 5) (5, 12, 13) (6, 8, 10) (7, 24, 25) (8, 15, 17) (9, 12, 15) (9, 40, 41) (10, 24, 26) (12, 16, 20) (12, 35, 37) (14, 48, 50) (15, 20, 25) (15, 36, 39) (16, 30, 34) (18, 24, 30) (20, 21, 29) (21, 28, 35) (24, 32, 40) (27, 36, 45) (30, 40, 50)
Number of triples listed20

Where Can You Verify These Formulas?

The definitions and formulas on this page follow standard references. Check them against these sources:

Built and maintained by S. Dilshan. Found a mistake? Email [email protected] with the page address.

Frequently Asked Questions

How are Pythagorean triples defined?

Three positive integers a, b, c with a² + b² = c².

How do you generate Pythagorean triples?

Use Euclid’s formula with m > n: (m² − n², 2mn, m² + n²).

What is a primitive triple?

A triple whose three numbers share no common factor, such as (3, 4, 5) but not (6, 8, 10).