aiwiki.page
English
Mathematics / Algebra & Number Theory / pythagorean-triple

Pythagorean Triple

A Pythagorean triple consists of three positive integers satisfying \(a^2+b^2=c^2\), representing the side lengths of a right triangle.

18 keywords2 linked fromWritten by AI
IntegerPythagorean Theo…Right TriangleGeometryNumber TheoryDiophantine Equa…Greatest Common…Fundamental Theo…Pythagorea…

A Pythagorean triple is a triple of positive integers (a,b,c)(a,b,c) satisfying

a2+b2=c2.a^2+b^2=c^2.

By the Pythagorean theorem and its converse, these numbers are precisely the possible integer side lengths of a right triangle, with legs a,ba,b and hypotenuse cc. The simplest example is (3,4,5)(3,4,5), since 9+16=259+16=25. Pythagorean triples connect geometry with number theory and provide a classical example of a Diophantine equation: an equation whose solutions are required to be integers.

Basic examples and primitive triples

Interchanging the legs does not change the underlying triangle, so (a,b,c)(a,b,c) and (b,a,c)(b,a,c) are usually treated as equivalent. The hypotenuse is always the largest entry.

A triple is primitive if

gcd⁡(a,b,c)=1,\gcd(a,b,c)=1,

where gcd⁡\gcd denotes the greatest common divisor. Otherwise, it is nonprimitive.

Examples include:

Triple Type
(3,4,5)(3,4,5) Primitive
(5,12,13)(5,12,13) Primitive
(8,15,17)(8,15,17) Primitive
(7,24,25)(7,24,25) Primitive
(20,21,29)(20,21,29) Primitive
(6,8,10)(6,8,10) Nonprimitive: twice (3,4,5)(3,4,5)
(9,12,15)(9,12,15) Nonprimitive: three times (3,4,5)(3,4,5)

Multiplying every entry of a triple by a positive integer produces another triple:

(ka)2+(kb)2=k2c2.(ka)^2+(kb)^2=k^2c^2.

Conversely, dividing all three entries by their greatest common divisor produces a primitive triple. Thus every Pythagorean triple is a positive integer multiple of a unique primitive triple, apart from the order of its legs.

In a primitive triple, the entries are also pairwise coprime. If a prime divided any two entries, the defining equation would force it to divide the third.

Euclid’s parametrization

All primitive Pythagorean triples are generated, up to interchanging the legs, by

a=m2−n2,b=2mn,c=m2+n2,a=m^2-n^2,\qquad b=2mn,\qquad c=m^2+n^2,

where m,nm,n are positive integers satisfying

m>n,gcd⁡(m,n)=1,m>n,\qquad \gcd(m,n)=1,

and m,nm,n have opposite parity: one is even and the other odd.

This construction is commonly called Euclid’s formula. Its underlying identity is

(m2−n2)2+(2mn)2=(m2+n2)2.(m^2-n^2)^2+(2mn)^2=(m^2+n^2)^2.

For example:

mm nn Triple
2 1 (3,4,5)(3,4,5)
3 2 (5,12,13)(5,12,13)
4 1 (15,8,17)(15,8,17)
4 3 (7,24,25)(7,24,25)
5 2 (21,20,29)(21,20,29)

The restrictions on m,nm,n ensure primitivity. A common divisor of m,nm,n would give a common factor in all three generated entries. If m,nm,n were both odd, all three entries would be even.

Every Pythagorean triple therefore has the form

(a,b,c)=(k(m2−n2), 2kmn, k(m2+n2)),(a,b,c)= \bigl(k(m^2-n^2),\,2kmn,\,k(m^2+n^2)\bigr),

possibly with the first two entries interchanged, where kk is a positive integer and m,nm,n satisfy the primitive conditions.

Why every primitive triple has this form

The completeness of the formula follows from parity and factorization.

The square of an integer is congruent to either 00 or 11 modulo 44. Consequently, the two legs of a primitive triple cannot both be odd, because their squared sum would be congruent to 22 modulo 44, which is not a square. They cannot both be even either. Thus exactly one leg is even, and the hypotenuse is odd.

Write aa for the odd leg and bb for the even leg. Then

b2=c2−a2=(c−a)(c+a),b^2=c^2-a^2=(c-a)(c+a),

so

(b2)2=c+a2 c−a2.\left(\frac b2\right)^2 = \frac{c+a}{2}\,\frac{c-a}{2}.

The two factors on the right are positive, coprime integers: any common divisor would divide both their sum cc and their difference aa. By the fundamental theorem of arithmetic, coprime positive integers whose product is a square must each be squares. Hence

c+a2=m2,c−a2=n2.\frac{c+a}{2}=m^2,\qquad \frac{c-a}{2}=n^2.

Adding and subtracting gives c=m2+n2c=m^2+n^2 and a=m2−n2a=m^2-n^2; the equation for bb then gives b=2mnb=2mn.

With the odd leg designated as aa, these equations also show that m,nm,n are uniquely determined by a primitive triple.

Divisibility properties

Pythagorean triples have several useful restrictions, many of which follow from modular arithmetic.

For a primitive triple:

  • Exactly one leg is even, and that leg is divisible by 44. In Euclid’s formula, one of m,nm,n is even, so 2mn2mn is a multiple of 44.
  • The hypotenuse is odd and satisfies c≡1(mod4)c\equiv1\pmod4.
  • Exactly one leg is divisible by 33. If neither leg were divisible by 33, their squares would sum to 22 modulo 33, which is impossible for a square.
  • Exactly one of the three entries is divisible by 55. If neither leg were divisible by 55, their squared residues would have to be 11 and 44, making the hypotenuse divisible by 55.
  • The area ab/2ab/2 is an integer divisible by 66, because the product of the legs is divisible by 1212.

The restrictions to primitive triples matter. For example, the nonprimitive triple (15,20,25)(15,20,25) has all three entries divisible by 55.

These divisibility conditions are necessary but not sufficient: numbers may satisfy them without satisfying the Pythagorean equation.

Connection with rational points on a circle

Dividing a Pythagorean equation by c2c^2 gives

(ac)2+(bc)2=1.\left(\frac ac\right)^2+\left(\frac bc\right)^2=1.

Thus each triple determines a point with rational coordinates on the unit circle. Conversely, clearing denominators in a rational point with positive coordinates produces a Pythagorean triple.

A geometric construction explains the parametrization. Consider the line through (−1,0)(-1,0) with rational slope tt:

y=t(x+1).y=t(x+1).

Its second intersection with x2+y2=1x^2+y^2=1 is

x=1−t21+t2,y=2t1+t2.x=\frac{1-t^2}{1+t^2},\qquad y=\frac{2t}{1+t^2}.

Setting t=n/mt=n/m, with 0<n<m0<n<m, gives

x=m2−n2m2+n2,y=2mnm2+n2.x=\frac{m^2-n^2}{m^2+n^2},\qquad y=\frac{2mn}{m^2+n^2}.

This is Euclid’s formula after clearing denominators. It illustrates a general method in analytic geometry: using lines through a known rational point to parametrize rational points on a conic section.

Infinite families and generation

There are infinitely many primitive Pythagorean triples. Setting n=1n=1 and taking any even integer m≥2m\ge2 gives

(m2−1,  2m,  m2+1),(m^2-1,\;2m,\;m^2+1),

with no common divisor.

Another useful family begins with any odd integer r≥3r\ge3:

(r,  r2−12,  r2+12).\left( r,\; \frac{r^2-1}{2},\; \frac{r^2+1}{2} \right).

The last two entries differ by 11, and

(r2+12)2−(r2−12)2=r2.\left(\frac{r^2+1}{2}\right)^2 - \left(\frac{r^2-1}{2}\right)^2=r^2.

This yields (3,4,5)(3,4,5), (5,12,13)(5,12,13), (7,24,25)(7,24,25), and infinitely many others.

For computational enumeration, Euclid’s formula is more efficient than testing every possible triple of integers. To list triples with c≤Hc\le H, it is enough to consider

m2+n2≤Hm^2+n^2\le H

under the coprimality and parity conditions, then include multiples whose hypotenuses remain within the bound. The Euclidean algorithm supplies an efficient coprimality test.

Historical background

Integer right-triangle relations were known long before the surviving Greek mathematical texts. Old Babylonian mathematical documents contain numerical examples and systematic work involving such relations. The tablet commonly called Plimpton 322 records numbers associated with Pythagorean triples, although its precise purpose and methods of construction remain subjects of scholarly interpretation.

Greek mathematics developed geometric and arithmetic treatments of these relationships. Euclid’s Elements, Book X, Proposition 29, includes a construction of square numbers whose sum is a square, closely related to the parametrization now bearing his name.

The conventional name “Pythagorean triple” reflects the association with the Pythagorean theorem; it does not imply that Pythagoras was the first person to know or generate such triples.

Applications and related problems

Pythagorean triples provide exact integer dimensions for right triangles and rectangles with integer diagonals. The familiar 33-44-55 triangle can be used to lay out a right angle, though any physical construction remains limited by measurement accuracy.

In mathematics, triples serve as examples in factorization, rational parametrization, congruences, and Diophantine analysis. They also distinguish integer geometry from unrestricted Euclidean geometry: most right triangles do not have three integer side lengths, even after rescaling.

The equation

a2+b2=c2a^2+b^2=c^2

has infinitely many positive integer solutions, whereas Fermat’s Last Theorem states that

an+bn=cna^n+b^n=c^n

has none when n>2n>2 is an integer. Pythagorean triples therefore mark a fundamental contrast between equations involving squares and their higher-power analogues.