MathorynMathematical Formula Database

Number Theory

Euclid's Formula for Pythagorean Triples

Euclid's formula produces integer right triangles from any integers m>n>0m>n>0; primitive triples arise when mm and nn are coprime and not both odd. It is used to generate Pythagorean triples and in number-theory problems about sums of squares.

a=m2−n2,b=2mn,c=m2+n2(m>n>0)a=m^2-n^2,\quad b=2mn,\quad c=m^2+n^2\qquad (m>n>0)
LaTeXa=m^2-n^2,\quad b=2mn,\quad c=m^2+n^2\qquad (m>n>0)

Variables

m, nm,\ n
positive integers with m > n
a, ba,\ b
legs
cc
hypotenuse

Example

Generate the triple for m=3, n=2m=3,\ n=2.

  1. a=9−4=5a=9-4=5, b=12b=12, c=13c=13.
  2. Check: 25+144=16925+144=169.

Answer: (5, 12, 13)(5,\ 12,\ 13).

Related formulas