Skip to content
Omnikalc

Pythagorean triples calculator: build a, b and c from m, n and k

Enter the parameters m and n and the scale factor k to build a Pythagorean triple with Euclid's formula, and get the legs, the hypotenuse, the perimeter, the area and the primitive check.

Updated on
Your inputs

Value out of range

Value out of range

Value out of range

Results

Hypotenuse c = k (m² + n²)

29

First leg a = k (m² − n²)
21
Second leg b = k × 2mn
20
Perimeter
70
Area of the triangle
210
Primitive triple (1 = yes, 0 = no)
1
Primitive: the three sides have no common factor

A Pythagorean triple is a set of three whole numbers a, b and c with a² + b² = c². The Pythagorean triples calculator builds a triple with Euclid’s formula and gives the two legs, the hypotenuse, the perimeter, the area and a check that says whether the triple is primitive.

How the calculation works

  • Enter two whole numbers m and n with m greater than n. They are the two parameters of Euclid’s formula.
  • Enter the scale factor k. With k = 1 you get the basic triple, and a larger k multiplies the three sides by the same whole number.
  • The calculator gives the legs a = k (m² − n²) and b = k × 2mn, and the hypotenuse c = k (m² + n²).
  • It also gives the perimeter, the area of the right triangle and a flag that says whether the triple is primitive. A triple is primitive when m and n have no common factor, when one of them is even and the other odd, and when k = 1.

Example

Take m = 5, n = 2 and k = 1. The first leg is 5² − 2² = 25 − 4 = 21, the second leg is 2 × 5 × 2 = 20 and the hypotenuse is 25 + 4 = 29. Check: 21² + 20² = 441 + 400 = 841 = 29². The perimeter is 21 + 20 + 29 = 70 and the area is 21 × 20 / 2 = 210. The numbers 5 and 2 have no common factor and 5 − 2 = 3 is odd, so the triple is primitive.

Why it matters

The calculator helps students, teachers and puzzle makers to find right triangles with whole-number sides, to prepare exercises with clean answers and to check a triple quickly. Carpenters and masons also use triples such as 3-4-5, 5-12-13 and 8-15-17 to set a right angle on a site without a square, and a larger k gives the same angle over a longer span.

Good to know

Euclid’s formula gives each primitive triple once, but the legs may come out in either order, since the one with m² − n² is not always the shorter one. Use a scale factor of 1 to list the primitive triples, and then multiply to get the others. For field layout, measure the three sides with the same tape and check the diagonal. A small error on a short side shows up clearly on the diagonal.

The Pythagorean theorem calculator finds a missing side from the other two, the special right triangles calculator covers the 45-45-90 and 30-60-90 shapes, the triangle solver handles any triangle, and the polygonal numbers calculator explores another family of whole-number patterns.

Frequently asked questions

What is a Pythagorean triple?

A Pythagorean triple is a set of three positive whole numbers a, b and c such that a² + b² = c². The best known examples are 3, 4, 5 and 5, 12, 13. The numbers are the sides of a right triangle whose three sides are all whole numbers, which is why builders use 3-4-5 to check a square corner.

What is Euclid's formula?

Euclid's formula says that for two whole numbers m > n > 0, the numbers m² − n², 2mn and m² + n² form a Pythagorean triple. Multiplying the three numbers by a whole number k gives another triple, a similar triangle. Every triple can be produced this way, so the formula lists all of them.

What is a primitive Pythagorean triple?

A primitive triple is a triple whose three numbers have no common factor greater than 1, such as 3, 4, 5 or 20, 21, 29. Euclid's formula gives a primitive triple when m and n have no common factor, when one is even and the other odd, and when k = 1. The triple 6, 8, 10 is not primitive, since it is 3, 4, 5 multiplied by 2.

Why do I get zero in the results?

The formula needs m greater than n. If you enter an m that is equal to or smaller than n, the triangle does not exist and the calculator shows zero. Swap the two values or increase m. Both m and n must be whole numbers, and n must be at least 1.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.