Right-angled triangles with whole number sides have fascinated both professional mathematicians and number-enthusiasts since well before 300 BC when Pythagoras wrote about his famous "theorem". The oldest mathematical document in the world, a little slab of clay that would fit in your hand, is a list of such triangles. So what is so fascinating about them? This page starts from scratch and has lots of facts and figures with several online calculators to help in your own investigations.

Right-angled Triangles and Pythagoras' Theorem

Pythagoras and Pythagoras' Theorem

Pythagoras was a mathematician born in Greece in about 570 BC. He was interested in mathematics, science and philosophy. He is known to most people because of the Pythagoras Theorem that is about a property of all triangles with a right-angle (an angle of 90°):
If a triangle has one angle which is a right-angle (i.e. 90°) then there is a special relationship between the lengths of its three sides:
If the longest side (called the hypotenuse) is h and the other two sides (next to the right angle) are called a and b, then:
a2 + b2 = h2     Pythagoras' Theorem
or,
the square of the longest side is the same as the sum of the squares of the other two sides.
a2 + b2 = h2 is only true for right-angled triangles.
• If all the angles of a triangle are less than 90° then the square of the longest side is less than the sum of the squares of the other two sides;
• If one the angles of a triangle is greater than 90° then the square of the longest side is greater than the sum of the squares of the other two sides.
For example, if the two shorter sides of a right-angled triangle are 2 cm and 3 cm, what is the length of the longest side?
If the longest side is h, then, by Pythagoras' Theorem, we have:
 h2 = 22 + 32 = 13 h = 13 = 3·60555

The 3-4-5 Triangle

In the example above, we chose two whole-number sides and found the longest side, which was not a whole number.

It is perhaps surprising that there are some right-angled triangles where all three sides are whole numbers called Pythagorean Triangles. The three whole number side-lengths are called a Pythagorean triple or triad.
An example is a = 3, b = 4 and h = 5, called "the 3-4-5 triangle". We can check it as follows:
32+42 = 9 + 16 = 25 = 52 so a2 + b2 = h2.

This triple was known to the Babylonians (who lived in the area of present-day Iraq and Iran) even as long as 5000 years ago! Perhaps they used it to make a right-angled triangle so they could make true right-angles when constructing buildings - we do not know for certain.
It is very easy to use this to get a right-angle using equally-spaced knots in a piece of rope, with the help of two friends. If you hold the ends of the rope together together and one friend holds the 4-th knot and and the other the 7-th knot and you all then tug to stretch the rope into a triangle, you will have the 3-4-5 triangle that has a true right-angle in it.
The rope can be as long as you like so you could lay out an accurate right-angle of any size.

Test a Triangle - is it Pythagorean?

Here is a little calculator that, given any two sides of a right-angled triangle will compute the third. Or you can give it all three sides to check. It will check that it is right-angled and, if so, if it is Pythagorean (all the sides are integers).
Here a and b are the two legs - the sides surrounding the right-angle and h is the longest side, the hypotenuse:
C A L C U L A T O R
a: b: h:

More Pythagorean Triples

Is the 3-4-5 the only Pythagorean Triple?
No, because we can double the length of the sides of the 3-4-5 triangle to and still have a right-angled triangle e.g Its sides will be 6-8-10 and we can check that 102 = 62 + 82.

Continuing this process by tripling 3-4-5 and quadrupling and so on we have an infinite number of Pythagorean triples:

 3 4 5 6 8 10 12 16 20 15 20 25 18 24 30
or we can take the serires of multiples 1, 11, 111, 1111, etc and get a pattern:
 3 4 5 33 44 55 333 444 555 3333 4444 5555 ...
All of these will have the same shape (have the same angles) but differ in size.

Are there any differently-shaped right-angled triangles with whole number sides?
Yes; one is 5, 12, 13 and another is 7, 24, 25.
How do we find these? Is there a systematic method? In the next section we answer the question
Is there is a formula for generating Pythagorean triples?

The m-n Formula for Pythagorean Triples

Yes - we can generate Pythagorean Triples by supplying two different positive integer values for m and n in this diagram. You can multiply out these terms and check that
( m2 – n2 )2 + (2 m n)2 = ( m2 + n2 )2

Once we have found one triple, we have seen that we can generate many others by just scaling up all the sides by the same factor. A Pythagorean triple which is not a multiple of a smaller one is called a primitive Pythagorean triple.

Are all the Pythagorean triples of this m-n form?

The bad news is that the answer is "No", but the good news is that all primitive Pythagorean triples are generated by some m and n values in the formula above!
The formula using m and n will not give all triples since it misses some of the non-primitive ones, such as 9-12-15. This is a Pythagorean triple since, as a triangle, is it just 3 times the 3-4-5 triangle (by which we mean that we just triple the lengths of each side of a 3-4-5 triangle, which we already know is right-angled).

But 9, 12, 15 is missed by our m,n formula because:
Our formula said m and n were positive whole numbers and the Pythagorean triple was

m2 - n2 , 2mn , m2 + n2
and, since we want (positive) whole number values in our triple, then m>n (otherwise the first number in the triple is negative).
The 2mn value is one of the sides and the only even side in 9-12-15 is 12, so 12 = 2mn.
Hence mn = 6 and m>n, so we can only have two cases:
1. m = 6 with n = 1 OR
2. m = 3 and so n = 2
The first case gives the triple 35, 12, 37 and the second case gives 5, 12, 13, neither of which is the 9, 12, 15 triple.

A m-n Pythagorean Triple generator

Here is a calculator to compute the sides of a triangle using the formula above - just type in the values for m and n. Remember that the formula will find all the Primitive Triples but it will NOT find all the multiple ones. The calculator will tell you if your values of m and n generate a Primitive triple or a multiple of a primitive triple.
Using just the primitive triples generated by the formula, the Calculator will find all triples with a longest side (hypotenuse) of a particular value or within a range of values.
C A L C U L A T O R
 with m= n= allprimitive triangles with m= up to m=

The m-n formula and a proof are given as Theorem 225 in The Theory of Numbers by G Hardy and E M Wright, (5th edition, 1980) OUP, 442 pages. This is a classic book that is well worth studying but it does tend to be at university undergraduate level some of the time.

Pythagorean Triples

Now we have a generator for all primitive triples, we can use it to compute Pythagorean Triples in lots of different ways. This calculator generates primitive triangles from m and n values (and the multiples of each if required) so will be slower for larger values of the hypotenuse.
C A L C U L A T O R
 allprimitive triangles with hypotenuse h= up to

We can use the Calculator here to find all Pythagorean triangles with longest side up to 100, together with the length of the perimeter P (the sum of all three sides) and its area A which, since they are all right-angled triangles, is just half the product of the two sides (those that form the right-angle):

All Pythagorean Triples with sides up to 100
arranged in order of hypotenuse (longest side):
with Perimeter (a+b+h) and Area (ab)/2
 Triad P A Primitive? 3, 4, 5 primitive 12 6 6, 8, 10 2x 3, 4, 5 24 24 5, 12, 13 primitive 30 30 9, 12, 15 3x 3, 4, 5 36 54 8, 15, 17 primitive 40 60 12, 16, 20 4x 3, 4, 5 48 96 15, 20, 25 5x 3, 4, 5 60 150 7, 24, 25 primitive 56 84 10, 24, 26 2x 5, 12, 13 60 120 20, 21, 29 primitive 70 210 18, 24, 30 6x 3, 4, 5 72 216 16, 30, 34 2x 8, 15, 17 80 240 21, 28, 35 7x 3, 4, 5 84 294 12, 35, 37 primitive 84 210 15, 36, 39 3x 5, 12, 13 90 270 24, 32, 40 8x 3, 4, 5 96 384 9, 40, 41 primitive 90 180 27, 36, 45 9x 3, 4, 5 108 486 30, 40, 50 10x 3, 4, 5 120 600 14, 48, 50 2x 7, 24, 25 112 336 24, 45, 51 3x 8, 15, 17 120 540 20, 48, 52 4x 5, 12, 13 120 480 28, 45, 53 primitive 126 630 33, 44, 55 11x 3, 4, 5 132 726 40, 42, 58 2x 20, 21, 29 140 840 36, 48, 60 12x 3, 4, 5 144 864
11, 60, 61primitive132330
39, 52, 6513x 3, 4, 51561014
25, 60, 655x 5, 12, 13150750
33, 56, 65primitive154924
16, 63, 65primitive144504
32, 60, 684x 8, 15, 17160960
42, 56, 7014x 3, 4, 51681176
48, 55, 73primitive1761320
24, 70, 742x 12, 35, 37168840
45, 60, 7515x 3, 4, 51801350
21, 72, 753x 7, 24, 25168756
30, 72, 786x 5, 12, 131801080
48, 64, 8016x 3, 4, 51921536
18, 80, 822x 9, 40, 41180720
51, 68, 8517x 3, 4, 52041734
40, 75, 855x 8, 15, 172001500
36, 77, 85primitive1981386
13, 84, 85primitive182546
60, 63, 873x 20, 21, 292101890
39, 80, 89primitive2081560
54, 72, 9018x 3, 4, 52161944
35, 84, 917x 5, 12, 132101470
57, 76, 9519x 3, 4, 52282166
65, 72, 97primitive2342340
60, 80, 10020x 3, 4, 52402400
28, 96, 1004x 7, 24, 252241344
See also Douglas Butler's web page with a list of 2098 triples with hypotenuse up to 2100.

Patterns in Pythagorean Triples

Let's call the two sides of the triangle that form the right-angle, its legs and use the letters a and b. The hypotenuse is the longest side opposite the right-angle and we will often use h for it.
The two legs and the hypotenuse are the three sides of the triangle, triple or triad a,b,h.

Different authors use different ways of writing triads such as a-b-h but we will use a,b,h on this page.

The series of lengths of the hypotenuse of primitive Pythagorean triangles begins 5, 13, 17, 25, 29, 37, 41 and is A020882 in Sloane's Online Encyclopedia of Integer Sequences. It will contain 65 twice - the smallest number that can be the hypotenuse of more than one primitive Pythagorean triangle. The series of numbers that are the hypotenuse of more than one primitive Pythagorean triangle is 65, 85, 145, 185, 205, 221, 265, 305,... A024409

There are lots of patterns in the list of Pythagorean Triples above. To start off your investigations here are a few.

Hypotenuse and Longest side are consecutive

The first and simplest Pythagorean triangle is the 3, 4, 5 triangle. Also near the top of the list is 5, 12, 13. In both of these the longest side and the hypotenuse are consecutive integers.
Are there any more like this?
The list tells us there are and we have the following:
 3, 4, 5 5, 12, 13 7, 24, 25 9, 40, 41 11, 60, 61
Can you spot the pattern?
It is not immediately obvious, but you will have noticed that the smallest sides are the odd numbers 3, 5, 7, 9,... So the smallest sides are of the form 2i+1.
The other sides, as a series are 4, 12, 24, 40, 60... Can we find a formula here?
We notice they are all multiples of 4: 4x1, 4x3, 4x6, 4x10, 4x15,.. . The series of multiples: 1, 3, 6, 10, 15,... is the Triangle Numbers (look them up in Neil Sloane's Online Encyclopedia of Integer Sequences) with a formula i(i+1)/2.
So our second sides are 4 times each of these, or, simply, just 2i(i+1).
The third side is just one more than the second side: 2i(i+1)+1, so our formula is as follows:
Hypotenuse is one more than the longest side:
shortest side = 2i+1; longest side = 2i(i+1); hypotenuse = 1+2i(i+1)
Check now that the sum of the squares of the two sides is the same as the square of the hypotenuse (Pythagoras's Theorem).
ia:2i+1b:2i(i+1)h=b+1
132x1x2=45
252x2x3=1213
372x3x4=2425
492x4x5=4041
5112x5x6=6061
6132x6x7=8485
7152x7x8=112113
Alternatively, let's look at the m-n values for each of these triples. Since the hypotenuse is one more than a leg, the 3 sides have no common factor so are primitive and therefore all of them do have m-n values:
Triplemn
3, 4, 521
5, 12, 1332
7, 24, 2543
9, 40, 4154
11, 60, 6165
It is easy to see that m = n+1.
The m-n formula in this case gives
a = m2 – n2 = (n+1)2 – n2 = 2 n + 1
b = 2 m n = 2 (n+1) n = 2 n2 + 2 n
h = m2 + n2 = (n+1)2 + n2 = 2 n2 + 2 n + 1
So h is b+1 and the pattern is always true:
if m = n+1 in the m-n formula then it generates a (primitive) triple with hypotenuse = 1 + the longest leg.
Are these all there are? Perhaps there are other m-n values with a leg and hypotenuse consecutive numbers. In fact, they are all given by the formula above because:
The triangles must be primitive so we know they have an m-n form.
h = m2 + n2 could be either one more than either m2 – n2 or 2 m n:
• If h = m2 + n2 = (m2 – n2) + 1
then, taking m2 from both sides: n2 = – n2 + 1
2 n2 = 1
or n2 = 1/2 and this is not possible for a whole number n
So h is never a + 1.
• If h = m2 + n2 = 2 m n + 1 then
m2 – 2 m n + n2 = 1 which is the same as
(m – n)2 = 1. Therefore
m – n = 1 or m – n = –1
But the hypotenuse is a positive number and is m2 – n2 so we must have so m>n and so m – n cannot be –1
The only condition we can have is that m – n = 1 or m = n + 1 - there are no other triangles with hypotenuse one more than a leg except those generated by consecutive m n values in the m-n formula.

• Shortest legs: 3, 5, 7, 9, 11, 13,... A081874
• Longest legs: 4, 12, 24, 40, 60, 84,... A046092
• Hypotenuses: 5, 13, 25, 41, 61,... A001844

An easy method of writing down a series of Triples

Look at the following series of Pythagorean triples. It is easy to spot the pattern and to remember it. If you then write it down to show your friends it will look as if you have impressive calculating skills!
 21 220 221 201 20200 20201 2001 2002000 2002001 20001 200020000 200020001
It uses n+1 for m in the formula and then lets n be powers of 10. This simplifies the triples to be 2n+1, 2n(n+1), 2n2+2n+1.

Can you find another simple method like this that always produces Pythagorean Triangles (not necessarily with consecutive sides)?
 Solution to Problem: Find a Scheme for writing mechanically an unlimited number of Pythagorean Triangles M Willey, E C Kennedy, American Mathematical Monthly vol 41 (1934) page 330.
There is a Calculator below that you can use to generate many more simple patterns like this one.

The two legs are consecutive

Also in the 3, 4, 5 triple, the two legs of the triangle a and b are consecutive, b = a+1. Are there any more like this?
Yes! 20, 21, 29.
Although the list above does not contain any more, there are larger examples:
3, 4, 5     20, 21, 29     119, 120, 169     696, 697, 985
Because the two legs are consecutive numbers, they will have no common factor so all of these will be primitive. We can therefore find certain special values for m and n in the m-n formula above. Here is the same list with their m-n values:
mna=m2-n2 b=a+1=2mn h=m2+n2
21345
52212029
125119120169
2912697696985
This already suggests a way that we can use the generators m and n for one triple to find generators for the next.
See if you can find how and also find a formula for this pattern of triples.

Kayne Johnston aged 13 has also found the neat pattern to compute this table without using the m and n generators, each row being computed simply from the two rows before:
the next row in the table has a smallest side that is 6 times the previous smallest side minus the smallest side before that plus 2.
For instance, after the first two rows:

ab=a+1 h=(a2+b2)
345
212029
the left hand column (the smallest side) is six times 21 minus the one before (3) plus 2: 6x20-3+2 = 120-3+2 = 119.
The other side is just one more than the smallest, so here is it 120.
Can you find a similar method to compute the hypotenuse but without using Pythagoras Theorem on the two sides?

The series here are:

• The shortest sides are 3, 20, 119, 696,... A001652
• The second legs are 4, 21, 120, 697,... A046090
• The hypotenuses are 5, 29, 169, 985,... A001653
Beiler (see references at the foot of this page) gives a formula for these triples so that the rth triple in this list is given directly in terms of r.

More patterns

There are more patterns in the Pythagorean Triples Table above.
For instance there are primitive triangles whose longest side and hypotenuse differ by 2, such as 8, 15, 17 and 12, 35, 37 and many more. What is the mathematical pattern in these triples?

Another idea is to take the formula and find special cases, remembering that the formula does not generate all Pythagorean triples.
For instance, let n=1. We then have triples m2–1, 2m, m2+1, although we have to make the restriction that m>1 for the hypotenuse to be a positive number:

mm2–12mm2+1
2345
38610
417819
5241026
6351237
Notice that not all of these are primitive and also that there are other triples with a side two less than the hypotenuse that are not in this list.

Can any number be a side in some Pythagorean Triangle?

Note that here we use the terms leg, side, hypotenuse as follows: there are two legs and a hypotenuse making the 3 sides of each Pythagorean triangle.

The Number of Pythagorean Triangles having a side n

These sequences are the counts for n=1, 2, 3,... in each of the 6 categories:
so that 0, 0, 1, 1, 2,.. means 0 triangles for n=1, 0 for n=2, 1 for n=3, 1 for n=4, 2 for n=5 etc
PrimitiveAll
as a legA024361
0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 2, 1, 0, 2, 1,..
A046079
0, 0, 1, 1, 1, 1, 1, 2, 2, 1, 1, 4, 1, 1, 4, 3,...
as a hypotenuse A024362
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,...
A046080
0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0,...
total A024363
0, 0, 1, 1, 2, 0, 1, 1, 1, 0, 1, 2, 2, 0, 2, 1,...
A046081
0, 0, 1, 1, 2, 1, 1, 2, 2, 2, 1, 4, 2, 1, 5, 3,...
It looks like every fourth number after 2, namely 6, 10, 14, 28,... cannot be the side of a primitive triangle.
Also you might guess that there are no gaps in the list of numbers that can be a side of at least one triple.
These are indeed true but not proved here.
From the table above, we can make an ordered list of the numbers themselves that can appear as sides in each category.

The Possible Sides of Pythagorean Triangles

Here the actual sides are listed. If there is more than one possible Pythagorean triangle with a given side, the side is repeated in these sequences. The sequence of possible side lengths without repetitions is given in brackets.
PrimitiveAll
Legs 3, 4, 5, 7, 8, 9, 11, 12, 12, 13, 15, 15, 16,...
A024355 (A042965)
3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 11, 12, 12, 12, 12, 13, 14,...
A009041 (every integer>2)
Hypotenuses 5, 13, 17, 25, 29, 37, 41, 53, 61, 65, 65,...
A020882 (A008846)
5, 10, 13, 15, 17, 20, 25, 25, 26,...
A009000 (A009003)
Sides 3, 4, 5, 5, 7, 8, 9, 11, 12, 12, 13, 13,...
A024357 (A042965)
3, 4, 5, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 12, 12, 12, 12, 13, 13,...
A009070 (every integer>2)

Number Series in Pythagorean Triangles

Other series of interest here are:
• A020883 Longest legs in primitive triples: 4, 12, 15, 21, 24, 35, 40, 45, 55, 56,... (or A024354 without duplicates or A024360 as a count of the number of triangles with longest side n or A0244410 longest legs in more than one primitive triangle)
• A020884 Shortest legs in primitive triples: 3, 5, 7, 8, 9, 11, 12, 13, 15, 16, 17, 19, 20, 20,... (A024352 without repetitions or A024359 as a list of counts of the number of triangles with each shortest side n or A0244411 shortest legs in more than one primitive triangle)
Except for 0 and 1, these are all the numbers that are the difference of two squares or, equivalently, every number that when divided by 4 has a remainder of 0, 1 or 3 A042965).
• A024409 Hypotenuse of more than one primitive triangle
• A024406 Area of primitive triangles: 6, 30, 60, 84, 180, 210, 210, 330,... ( A020885 is areas divided by 6, A024407 areas of mroe than one primitive triangle since all such areas are a multiple of 6)
• A024364 The perimeters of primitive triangles: 12, 30, 40, 56, 70, 84, 90,... (A024408 primeters of more than one primitibe triangle); also A099829 Smallest perimeter of n Pythagorean triangles
• A006593 the smallest number that occurs as a side in n triads: 3, 5, 16, 12, 15, 125, 24,... (so 3 is the smallest side in just 1 triad, 5 is the smallest that occurs in exactly 2 triads, 16 in 3 triads, etc)
Pythagorean Triangles with Equal Perimeters
• If I have a piece of string of length n, how many right-angled triangles can I make from it if the sides have integer lengths? The diagram here shows the only configuration if the rope has length 3+4+5=12. The length of the rope is the perimeter of the triangle. A009096 lists the perimeters of all Pythagorean triangles in order: 12, 24, 30, 36, 40, 48, 56, 60, 60, 70,... (A010814 without repetitions)
• The same problem but this time we want the smallest length of string that makes exactly n different right-angled triangles. It is 12 for a unique triangle: 3, 4, 5 whereas a length of 60 can make 2 different triangles: 5x 3, 4, 5 and 2x 5, 12, 13 but it has to be 120 for 3 triangles: 10x 3, 4, 5, 4x 5, 12, 13, 24, 45, 5, so the series is 12, 60, 120,... A099830
• A099831 Perimeters of exactly 2 Pythagorean triangles: the length of the rope if we can form exactly 2 different Pythagorean triangles using it. We saw in the previous problem that the smallest is 60, so what are the other values? They are 60, 84, 90, 132, 144, 210,..
since 84=7x 3, 4, 5 and 12, 35, 37, the next is 90 and so on.
• A099832 Perimeters of exactly 3 Pythagorean triangles: 120 is the smallest and also,in order, we have 120, 168, 180, 252, 280, ...
• A099833 Perimeters of exactly 4 Pythagorean triangles: 240, 360, 480, 504, 630,...

We can draw a circle touching all 3 sides of any triangle, called the incircle with radius the inradius usually denoted by r and centre the incentre.
From the symmetry of the circle, a line from its centre to each vertex of the triangle will halve each of the angles in the triangle.

Lines from the incentre to the vertices (shown in blue here) divide the triangle into three smaller ones, each having the same height, r on a base of one side of the whole triangle.
The area of a triangle is one half of the base of the triangle times its height. So the three separate areas sum to the whole area:

 area  = a r + b r + c r = r a + b + c 2 2 2 2
The sum of the sides of a triangle is the length of its perimeter.
We now have a simple formula for the inradius, r of any triangle:
 r  = 2 area perimeter

In a right-angled triangle, the area is just half the product of the two legs, a b / 2 or 2 area = a b so the formula for r is even simpler:
 r = a b a + b + h
in a right-angled triangle
Since all primitive right-angled Pythagorean triangles can be derived using the m-n formula above, then, in terms of m and n we have
 r  = (m2–n2) 2mn = (m2–n2) 2mn = (m–n)(m+n)2mn = (m–n)n m2–n2 + 2mn + m2+n2 2m2 + 2mn 2m(m+n)
In primitive right-angled triangles, the inradius, r is therefore always an integer because m and n are.
Non-primitive triangles are just multiples of primitives, so their inradius is an integer too. We now have the general rule that:
the inradius is always a whole number in all Pythagorean triangles!

A more general Pythagorean Triple Calculator

This calculator will find Pythagorean triples for you, either primitive or all with any combination of sides with a fixed value or in a given range of values. You can find the actual triples or else just count the number found.
If you give a range of values, the total in that range can be counted (Total count of) or else a separate count with one count for each value in the range is given if you select Separately count. Sizes gives a list of those values in the range for which the requested type of triangle (all or primitive) exist. Values are repeated where there are different triples of the same size.
For example:
• The total count of triples with a hypotenuse in the range 20-30 is 6
• In a List they are:
1: 12, 16, 20 =4x[3, 4, 5] P=48 A=96 r=4 m=4 n=2
2: 15, 20, 25 =5x[3, 4, 5] P=60 A=150 r=5 m=. n=.
3: 7, 24, 25 primitive P=56 A=84 r=3 m=4 n=3
4: 10, 24, 26 =2x[5, 12, 13] P=60 A=120 r=4 m=5 n=1
5: 20, 21, 29 primitive P=70 A=210 r=6 m=5 n=2
6: 18, 24, 30 =6x[3, 4, 5] P=72 A=216 r=6 m=. n=.
• Counted separately, there is one of size 20, 2 of size 25, and one each of 26, 29 and 30 so the separate counts are reported as 1, 0, 0, 0, 0, 2, 1, 0, 0, 1, 1: a count for each of the values from 20 to 30.
• The sizes of the 6 triples are 20, 25, 25, 26, 29, 30.

(*) There are very fast algorithms for counting the number of triangles (primitive or all) given the size of a leg, or a hypotenuse or a side, marked (*) in the list in the Calculator here. Otherwise, the triangles are generated and then counted, a process that takes some time for large sides.
Sizes reports the sizes (of the side/perimeter/area requested) in the given range, so that if a side/perimeter/area is found in more than one triple, it is reported once for each separate triple.
List lists all the triples found but if you want just one example use List one of.
The results are printed in the Results box, triples being given with their area, perimeter and inradius. This data can easily be selected and copied to be used in other applications or as text.
Here is the triple generator which can search for various conditions on its sides and has some very fast counting algorithms for some cases:

C A L C U L A T O R
 Total count of Separately count Sizes of List all List one of all only primitive triangles with the shortest leg : a the longest leg : b (*) a leg : a or b both legs : a & b (*) hypotenuse : h (*) a side : a or b or h all sides: a & b & h perimeter: a + b + h area: a b / 2 (*) = fast Count = up to

Finding a Pythagorean Triangle approximating a given Angle

Can we find a Pythagorean triangle with a given angle? Sometimes this may not be possible with small numbers but we will always be able to find some Pythagorean triangles with an angle almost equal to any angle you require.

Here is a Calculator to find a primitive triangle with better and better approximations to a given angle. It only generates primitive triangles since all its multiples have identical angles but bigger sides.

You can use Pi in the input box e.g. for the angle Pi/3 (radians).
If you want Pythagorean triangles with a specific ratio of sides, e.g. 1/3, then use the angle with that sine or cosine or tangent: e.g.

• asin(1/3) is the angle (radians) whose sine is 1/3, i.e. the ratio of the leg opposite the angle to the hypotenuse;
• acos( (sqrt(5)-1)/2 ) for the ratio of the leg next to the angle to the hypotenuse;
• atan(3/4) for the ratio of the leg opposite to the leg next to the angle.
Calculations are slightly more accurate if radian measure is used.
C A L C U L A T O R
 a primitive triangle with an angle of degrees radians

Further Triple Patterns

The Angle-in-Triple Calculator above finds some interesting number patterns too.
For instance, there is no Pythagorean triangle with an angle of 45° (type in 45 into the "angle of..." box, make sure degrees is on and then click on the Find button) and if we ask the Calculator to find approximations it finds the sequence with legs differing by one that we found above.
If we try it on a series of angles such as 0.1, 0.01 and 0.001 radians, we discover two series of easily-remembered and visually striking patterns as in An easy method of writing down a series of triples above:
 399 40 401 180 19 181 39999 400 40001 19800 199 19801 3999999 4000 4000001 1998000 1999 1998001 399999999 40000 400000001 199980000 19999 199980001
Try it with 0.2, 0.02, 0.002 radians and you'll find at least two more patterns like this!
 40 9 41 99 20 101 4900 99 4901 9999 200 10001 499000 999 499001 999999 2000 1000001 49990000 9999 49990001 99999999 20000 100000001
There are some more complicated patterns here too:
 88501 17940 90301 - 899850001 17999400 900030001 446930400 8939801 447019801 8999985000001 17999994000 9000003000001 4496993004000 8993998001 4497001998001
With 0.3, 0, 03 and 0,.003 there are patterns in the first four approximations:
 12 5 13 24 7 25 2112 65 2113 2244 67 2245 221112 665 221113 222444 667 222445 22211112 6665 22211113 22224444 6667 22224445

 532 165 557 391 120 409 55432 1665 55457 39991 1200 40009 5554432 16665 5554457 3999991 12000 4000009 555544432 166665 555544457 399999991 120000 400000009

The first triple in the final series is the one suggested by the rest of the pattern. It is indeed a Pythagorean triple -- check it with the Test a Triangle - is it Pythagorean? calculator above.

The series of angles 0.4, 0.04, 0.004 and 0.0004 radians generates:

 12 5 13 24 10 26 1200 49 1201 2499 100 2501 124500 499 124501 249999 1000 250001 12495000 4999 12495001 24999999 10000 25000001
 - 15 8 17 760 39 761 1599 80 1601 79600 399 79601 159999 800 160001 7996000 3999 7996001 15999999 8000 16000001
and with 0.6 radiansand its tenths:
 4 3 5 91 60 109 544 33 545 9991 600 10009 55444 333 55445 999991 6000 1000009 5554444 3333 5554445 99999991 60000 100000009

 380 261 461 5436800 326601 5446601 55443668000 332666001 55444666001 555444366680000 333266660001 555444466660001

0.7 radians seems to give only one simple pattern:
 351 280 449 39951 2800 40049 3999951 28000 4000049 399999951 280000 400000049
but 0.8 gives two:
 - 624 50 626 31000 249 31001 62499 500 62501 3122500 2499 3122501 6249999 5000 6250001 312475000 24999 312475001 624999999 50000 625000001
and 0.9 gives several:
 4 3 5 4 3 5 3 4 5 220 21 221 264 23 265 483 44 485 24420 221 24421 24864 223 24865 49283 444 49285 2466420 2221 2466421 2470864 2223 2470865 4937283 4444 4937285 246886420 22221 246886421 246930864 22223 246930865 493817283 44444 493817285

 20 21 29 48 55 73 319 360 481 2240 201 2249 6148 555 6173 39919 3600 40081 222440 2001 222449 617148 5555 617173 3999919 36000 4000081 22224440 20001 22224449 61727148 55555 61727173 399999919 360000 400000081 2222244440 200001 2222244449 6172827148 555555 6172827173 39999999919 3600000 40000000081
0.010 will again give the first example above for 0.1.
However, do use the Calculator above and repeat the experiment. This time you will probably notice at least two more pattern series to add to your collection! How about 0.11, 0.011, 0.0011, ...
and then 0.12, 0.012, 0.0012, ...
and so on?
Also try 2/3, 2/30, 2/300, etc (the Calculator handles expressions as input) or you can input it as 0.6666, 0.06666, 0.006666, etc which has a one very simple pattern in particular.
You can also do this with any other (small) sequence of numbers making a decimal. Remember though that the biggest angle is 90° which is 1.57079632679489 radians.

The reason the patterns are so "obvious" above is that our numbers are written in base 10 and we are taking angles one-tenth as large each time.
An interesting mathematical Project is to find formulae for each of these series. It will then be easy to verify that all the triples in the series are Pythagorean by summing squares of the two legs and checking it equals the square on the hypotenuse.
You might even be able to find a formula that encompasses several of the series above.

What else can you find?

The Shapes and Sizes of Pythagorean Triangles P Shiu, Mathematical Gazette vol 67 (1983) pages 33-38. This describes the algorithm behind the angle-finder calculator above. To find a Pythagorean triangle with angles close to θ let u = tan(θ)+ sec(θ) and find its continued fraction. If the successive convergents to it are mk/nk then a suitable Pythagorean triangle is x = 2 mk nk, y = mk2 – nk2, z = mk2 + nk2.

More Curious Number Facts about Pythagorean Triangles

In every Pythagorean triangle the following 6 facts are always true:
1. one side is a multiple of 3
2. one side is a multiple of 4
3. one side is a multiple of 5
4. the product of the two legs is always a multiple of 12
5. the area is always a multiple of 6
6. the product of all three sides is always a multiple of 60
We can always find a Pythagorean triangle with a side of any given length (bigger than 2).

Pythagorean Triangles and Egyptian Fractions

Egyptian Fractions (also called Babylonian fractions) is the method of writing fractional values as used by the ancient Egyptians who built the Pyramids and before them the ancient Babylonians from whom we get our time measurements of seconds, minutes and hours and also our 360° in a full turn. They did not use the ratio of two whole numbers as we do, e.g. 4/5 (the ratio of 4 to 5 is "four-fifths" and is also 4 divided by 5. Instead they used a sum if unit fractions, so that 3/4 would be 1/2 + 1/4, a sum of two unit different fractions, that is fractions that we would write as 1/n but without repeating any fraction in a sum! Every fraction a/b can be written as a sum of distinct unit fractions, often in several ways and these are called Egyptian Fractions or Babylonian Fractions.
So the simplest kinds of fractions are those that can be written as a sum of two unit fractions.

The number of ways we can write 2/n as a sum of two different unit fractions gives the series 1, 1, 1, 1, 1, 2, 2, 1, 1, 4, 1,... for n=3 onwards since 2/3=1/2+1/6 is the only way for 2/3, 2/8=1/4=1/12+1/6 = 1/20+1/5, two ways, so the first entry (for n=3) is 1 and the entry for n=8 is 2.
Surprisingly this series is just the number of Pythagorean triangles having n as a leg, series A046079 in the table above!

Pythagorean Triples and Fibonacci Numbers

The Fibonacci Numbers are a simple series of numbers that appear in lots of places in nature: 1, 2, 3, 5, 8, ... where each number is the sum of the previous two in the series.
Often mathematicians start tis series with 0 and 1 and we get the series: 0, 1, 1, 2, 3, 5, 8, 13, 21, ... .
To make a Pythagorean Triangle, take any 4 consecutive numbers in this series, such as 1, 1, 2, 3:
• Multiply the middle two numbers and double the result, here 1 and 2 multiply to 2 and double to 4 - this is one side of our Pythagorean Triangle
• Multiply the two outer numbers, here 1 and 3 giving 3 - the second side of the Pythagorean triangle
• Add the squares of the inner two numbers to get the third side: here 12 + 22 gives 5, the hypotenuse
So we have found the 3, 4, 5 triangle.

In fact you can start with any two starting numbers and use the Fibonacci-Rule (add the latest two to get the next) to generate two more and those 4 numbers will always generate a Pythagorean Triangle. Try it!

Is there a Pythagorean Triangle of Fibonacci Numbers?

It is easy to see that no triangle can exist with all 3 sides being different Fibonacci numbers:
If the sides are a<b<c then c is at least a + b by the Fibonacci rule. However, in any triangle the two shorter sides must add to more than the longest side or else the sides will not meet (think of the longest side as the base and the two shorter sides hinged at the ends of the base).
We know of two Pythagorean triangles with 2 Fibonacci numbers as sides:
3 4 5
5 12 13
It is thought that there are no more but this remains an open question.

Pythagorean Triples Containing Fibonacci Numbers: Solutions for Fn2 ± Fk2 = K2 by M Bicknell-Johnson, Fibonacci Quarterly 17 (1979) pages 1-12, (Addenda: page 293).

Pythagorean Triples and Pi

While there does not appear to be any simple formula known for the number of Pythagorean triangles up to a given size (the methods used in the Calculators on this page depend on the factors of a number), there are a couple of simple approximations discovered by D H Lehmer in 1900 and they both involve pi ().
The number of primitive Pythagorean triangles with hypotenuse less that N is approximately N/2
For example, in the Table of Triples with sides up to 100 above, there were 16 primitive triples with a hypotenuse less than 100. Lehmer's approximation gives 100 / (2x3·14159) = 15·91.
The number of primitive triangles with a perimeter less than N is approximately N ln(2)/2
ln(2) is the natural log of 2 = that power of e which gives 2.
Since e0·693147...=2 then ln(2)= 0·693147... .
For example, the same Table above shows all 14 primitive triangles with perimeter less than 200; whereas Lehmer's formula says this is approximately (200 x 0·693147...) / 2 = 14.04.

It seems remarkable that should appear in this context, but it does have an amazing tendency to appear in many such formulae for approximations.

D H Lehmer, American Journal of Mathematics 1900, vol 22, page 38.

Pythagorean Triples or Babylonian?

A tiny block of clay, about the size of a postcard (5 inches x 3.5 inches or 12cm x 9cm) with 15 rows of 4 columns of "numbers" is dated to about 1800 BC and so is probably the world's oldest surviving mathematical artifact. Plimpton 322 is one of 600 such tablets donated to Columbia University's Rare Book and Manuscript Library by George Plimpton and was item 322 in his catalogue, hence its name. (Have a look at their other treasures too.)

Bill Casselman's page on The Babylonian tablet Plimpton 322 from University of British Columbia has the best image of the tablet and an excellent explanation of how to read Babylonian numbers and what the tablet contains.

And what does it contain? A list of Pythagorean Triangles arranged in order of triangles which are approximately 1 degree apart! They are written in their base 60 scale, and involve base 60 "fractions" and they were probably used in surveying.

Words and Pictures: New Light on Plimpton 322 by Eleanor Robson in American Mathematical Monthly vol 109 (2002), pages 105-120 explores three theories as to the meaning of the numbers on Plimpton 322, one of which is that it is a trigonometric table.
The Exact Sciences in Antiquity by Otto Neugebauer, Dover, (1969) 240 pages argues that the Plimpton 322 tablet contains Pythagorean triples for triangles for each degree from 30 to 45 and so detects several simple errors in the tablet's table.

Puzzles and Problems

1. Find the only two Pythagorean triangles with an area equal to their perimeter.
2. Find three consecutive numbers which can be the hypotenuses of Pythagorean triangles.
Can you find four consecutive numbers which are hypotenuses?
3. Find a few Pythagorean triangles whose smallest side is a square number
e.g. 9=32, 12, 15, and 25=52, 312, 313.
Of the primitive ones in your list, what is special about their m and n values?
4. What about Pythagorean triples having a smallest side which is a cube number?
e.g. 27=33, 36, 45.
What is special about their m and n values?
5. How many Pythagorean triangles have a side of length 48?
Find a number that can be the side of even more Pythagorean triangles. (Hint: there is 3 others less than 100)
6. What is the highest number of triples you can find with the same side in each?
7. What is the smallest number that is the hypotenuse of more than one triple?
What is the greatest number of triples you can find with the same hypotenuse?
(*) Can you find one that is not a multiple of 5?
8. 4/3/05 is a date and also a Pythagorean triple. There is another one this year ('05) - when is it?
Assuming that the years are in this century, how many other days will have a Pythagorean Triple date if the year is the hypotenuse?
If the date is any set of 3 numbers that are Pythagorean triples, how many dates are there in one century?
9. How about a special Pythagorean Triple Time in hours:minutes:seconds? How many are there in a whole day if we use a 24-hour clock with hours from 0 to 23?
10. In the Easy method of writing down a series of Triples section, we found a formula for the pattern given there and used it with n = 10, 100, 1000, ....
What pattern do you get with n = 20, 200, 2000, ...?
... and with n = 30, 300, 3000, ...?
11. Find your own Pythagorean Triple Pattern not already mentioned in Further Triple Patterns above.
Here is another way to do this.
Think of a series of numbers that are like those in the lists above, e.g. from the 399, 40, 401 pattern we might think of hypotenuses that are in the series 901, 90001, 900001, ... . Plug these numbers into the Triples generator and see if any patterns emerge. The hypotenuse searches on 901 and 90001 give:
• Triples with hypotenuse=901:
1: 476, 765, 901 =17x[45, 28, 53] P=2142 A=182070 r=170 m=. n=.
2: 424, 795, 901 =53x[15, 8, 17] P=2120 A=168540 r=159 m=. n=.
3: 451, 780, 901 primitive P=2132 A=175890 r=165 m=26 n=15
4: 60, 899, 901 primitive P=1860 A=26970 r=29 m=30 n=1
• Triples with hypotenuse=90001:
1: 600, 89999, 90001 primitive P=180600 A=26999700 r=299 m=300 n=1
and another pattern jumps out:
899, 60, 901
89999, 600, 90001
12. Find a formula for one of the patterns in the Further Triple Patterns.