Everyone knows the right triangle with sides 3, 4, and 5. But how can we systematically generate other right triangles whose three sides are integers? And can we prove that our method finds every possible primitive example?
A surprisingly complete answer comes from a simple operation: squaring a complex number with integer coordinates. This connects a familiar geometry problem to number theory and gives us a way to manufacture Pythagorean triples almost at will.
1. From one triangle to a general question
A Pythagorean triple is a triple of positive integers (a,b,c) satisfying
For example, (3,4,5), (5,12,13), and (8,15,17) are Pythagorean triples. A triple is called primitive when \gcd(a,b,c)=1. Thus (6,8,10) is not primitive: it is twice (3,4,5).
Multiplying an existing triple by an integer is easy. The more interesting problem is to construct genuinely new ones.
2. Square a complex number
Take two positive integers m>n and form the complex number
Since i^2=-1, squaring gives
The real and imaginary parts are therefore the two integers m^2-n^2 and 2mn. Meanwhile, the squared length of z is m^2+n^2. Squaring a complex number squares its length, so the length of z^2 is m^2+n^2. Consequently,
We have discovered Euclid’s formula for Pythagorean triples:
Unlike an isolated numerical trick, this formula works for every pair of integers m>n>0.
3. Try a few pairs of integers
| m | n | m^2-n^2 | 2mn | m^2+n^2 |
|---|---|---|---|---|
| 2 | 1 | 3 | 4 | 5 |
| 3 | 2 | 5 | 12 | 13 |
| 4 | 1 | 15 | 8 | 17 |
| 4 | 3 | 7 | 24 | 25 |
| 3 | 1 | 8 | 6 | 10 |
Notice the last row: (6,8,10) is not primitive. The formula produces a Pythagorean triple every time, but not necessarily a primitive one.
4. When is the triple primitive?
Two simple conditions do the job:
Why? Let a=m^2-n^2, b=2mn, and c=m^2+n^2. Opposite parity makes a and c odd. Suppose an odd prime p divides both a and c. Then it divides their sum 2m^2 and difference 2n^2, forcing p to divide both m and n—a contradiction. Since a and c are odd, they have no common prime factor at all. Thus \gcd(a,c)=1, and the triple is primitive.
Conversely, if m,n share a factor r>1, all three sides share r^2. If they are both odd, all three sides are even. These conditions are therefore necessary as well.
5. Does Euclid’s formula find every primitive triple?
Yes, up to exchanging the two legs. Here is an elementary proof. It is the most important reason to study the formula: it is not merely a way to produce examples, but a complete description.
Start with a primitive triple a^2+b^2=c^2. Exactly one leg is even. Indeed, two odd squares add to 2 modulo 4, which is not a square, and both legs cannot be even in a primitive triple. Relabel the legs so that b is even and a is odd. Then c is also odd.
Rearrange the equation:
Since a and c are odd, the numbers
are positive integers, with
Moreover, \gcd(u,v)=1: a common divisor of u,v would divide both u+v=c and u-v=a, contradicting primitivity.
Now use a basic fact from prime factorization: if two coprime positive integers have a square product, each is itself a square. Thus u=m^2 and v=n^2 for some integers m>n>0. Substituting back yields
That proves the claim. Every primitive integer right triangle arises from squaring m+ni, with coprime m,n of opposite parity.
6. A second trick: multiply two triples
Complex multiplication also combines two known triples into a third. For example, the triples (3,4,5) and (5,12,13) correspond to complex numbers 3+4i and 5+12i. Their product is
The lengths multiply: 5\cdot13=65. Therefore, without guessing any squares, we obtain
This is a different operation from Euclid’s parametrization. Squaring a complex number generates triples from two parameters; multiplying two complex numbers combines existing triples. Both are useful, but the complete classification in Section 5 is what makes Euclid’s formula especially powerful.
7. What is special about the complex-number viewpoint?
One could verify Euclid’s formula simply by expanding squares. Complex numbers explain why these particular expressions appear: m^2-n^2 and 2mn are exactly the coordinates of the square of m+ni.
There is also a geometric interpretation. A nonzero complex number has a length and an angle. Squaring doubles its angle and squares its length. Thus Euclid’s formula is simultaneously an algebraic construction, a geometric operation, and a number-theoretic classification.

The broader two-square multiplication identity also appears in the study of sums of squares. We will leave the four-square and eight-square stories for other articles; here the central question is which integer right triangles exist and how to find all primitive ones.
8. Exercises
Try each problem before opening its solution.
Exercise 1. Construct a triple using m=5,n=2.
Euclid’s formula gives a=25-4=21, b=20, and c=29. Thus 20^2+21^2=29^2. It is primitive because 5 and 2 are coprime and of opposite parity.
Exercise 2. Why does m=5,n=3 give a nonprimitive triple?
Both numbers are odd. The formula gives (16,30,34), whose sides are all even. Dividing by 2 produces (8,15,17).
Exercise 3. Recover m,n from the primitive triple (20,21,29).
Take the odd leg a=21 and hypotenuse c=29. Then m^2=(29+21)/2=25 and n^2=(29-21)/2=4. Hence m=5,n=2.
Exercise 4. Show that the area of a primitive integer right triangle is divisible by 6.
One leg is 2mn and the other is m^2-n^2, so the area is mn(m^2-n^2)=mn(m-n)(m+n). Of m,n,m-n,m+n, at least one is divisible by 3: if neither m nor n is, they are congruent or opposite modulo 3. Also m,n have opposite parity, so one of them is even. Thus the area is divisible by 6.
Further reading
Olga Taussky, “Sums of Squares,” The American Mathematical Monthly, vol. 77, no. 8 (1970), pp. 805–830, especially Section 2. JSTOR article.
For a broader look at how sums-of-squares identities extend to quaternions and octonions, see our article Why Are 1, 2, 4, and 8 Special?
Continue exploring: The same complex multiplication gives exact angle formulas in Arctangent Identities, Gaussian Integers, and Number Theory. For which numbers c can be a sum of two squares at all, see Which Integers Are Sums of Two, Three, or Four Squares? For right triangles beyond integer sides, see The Hidden Mathematics of Right Triangles.

Leave a Reply