Euclid's Pythagorean Triple

Also known as euclid formula · generate pythagorean triple · m n triple · 3 4 5 generator

c=m2+n2c = m^2 + n^2

Enter your known values, leave one input blank, and solves for the missing one. Try different units for next level excitement!

Learning zone

Pick two whole numbers m > n. Euclid's recipe turns them into a right triangle with legs m2n2m^2 - n^2 and 2mn2mn and hypotenuse m2+n2m^2 + n^2. It is worth checking once that the algebra closes: (m2n2)2+(2mn)2=m42m2n2+n4+4m2n2=m4+2m2n2+n4=(m2+n2)2(m^2-n^2)^2 + (2mn)^2 = m^4 - 2m^2n^2 + n^4 + 4m^2n^2 = m^4 + 2m^2n^2 + n^4 = (m^2+n^2)^2. Take m = 2, n = 1 and out comes 3, 4, 5. Take m = 3, n = 2 and you get 5, 12, 13. Take m = 7, n = 4 and you get 33, 56, 65.

The remarkable part is the converse. Every primitive triple — every one where the three sides share no common factor — comes from exactly one such pair, and the pair must satisfy two conditions: m and n coprime, and not both odd. Break either and you still get a valid triple, just not a primitive one. m = 4, n = 2 gives 12, 16, 20, which is the 3-4-5 triangle scaled by four. m = 3, n = 1 (both odd) gives 8, 6, 10, which is the same triangle doubled. So the conditions do not control correctness, they control whether you are finding something new.

This page solves for the hypotenuse and back for either generator, which is the useful direction when you know the answer you are aiming at. Given c = 65 and n = 4, m=6516=7m = \sqrt{65 - 16} = 7. But note that 65 is the smallest hypotenuse belonging to two different primitive triples — 33-56-65 and 16-63-65 — so a hypotenuse alone does not determine the triangle. The second one comes from m = 8, n = 1.

Euclid's Pythagorean Triple
c=m2+n2c = m^2 + n^2
Where
  • mm= Larger generator
  • nn= Smaller generator
  • cc= Hypotenuse