|
Home page |
Pythagorean TriplesUpdated February 2012 - Added interactive calculator |
IntroductionPythagorean triples are sets of three integers (a,b,c) where a2 + b2 = c2. The simplest of these (where 'a', 'b' and 'c' are all greater than 0) is (3,4,5) as 9 + 16 = 25. There are clearly an unlimited number of these triples as any multiple of (3,4,5), say (33,44,55), also meets the requirements: (1089 + 1936 = 3025). Ignoring these multiples, how many of these triples are there?
I will call the triples where 'a' and 'b' have no common factors and b > a > 0 the prime triples. So how many prime triples are there? The next image shows all the triples (prime or otherwise) out to (320,320).
The prime ones are shown in light blue and their multiples darker. Each prime triple generates a line of evenly spaced multiples, which are shown in darker blue. The really obvious lines are generated by variations of (3,4). There are 57 prime triples in this diagram, repeated 8 times through reflection and permutation. They are:
Table 1. The interactive calculatorIf you have google Chrome with the native client plugin enabled you can use this application to calculate the triples in particlar ranges and generate images like those on this page. AlgorithmsThe simplest way to generate a sequence of triples is to notice that difference between consecutive square numbers [1,4,9,16,...] generates the sequence of odd numbers [3,5,7,9,...]. If the odd number is also a square [9,25,49,...] you have a triple. And because two consecutive square numbers can't have any common factors it must be prime. So we have already found a mechanism for generating an unlimited number of prime triples. The numbers in the first column of the table 1 (above) belong to this sequence. We can create a generic formula for these triples as follows;
a2 + b2 = (b + 1)2
=> a2 + b2 = b2 + 2b + 1
=> a2 = 2b + 1
(substitute a = 2k + 1)
=> (2k + 1)2 = 2b + 1
=> 4 × k2 + 4 × k + 1 = 2b + 1
=> 2 × k2 + 2 × k = b
a = 2 × k + 1
b = 2 × k × (k + 1)
c = 2 × k × (k + 1) + 1
Although the above algorithm generates an unending sequence of prime triples it doesn't generate them all. Of the 57 prime triples in table 1, only 12 follow this pattern. A more general approachStarting with c = b + n, where n is a positive integer;
a2 + b2 = (b+n)2
=> a2 + b2 = b2 + 2nb + n2
=> a2 = 2nb + n2
=> a2 = n × (2b + n)
So n × (2b + n) must be a square number. To find solutons to this equation we look at the prime factors of n and (2b + n), starting with n. Some prime factors will appear an odd number of times and others an even number. We collect all the even ones into one list and all the odd ones into another. If a prime factor appears an odd number of times more than 2, then one goes into the odd list and the remainder into the even list. The product off all the even factors will be a square number and the product off all the odd ones will have no repeated prime factors. This is a rather long winded way of demonstrating that all integers can be factorised into the product of a square and a term with no repeating factors, so long as we allow the posibility that the square number is 1.
n = x2 * k
For n × (2b + n) to be a square number, (2b + n) must be the product of 'k' and another square number (y2). So
a2 = n × (2b + n) = (x2 × k) × (k × y2) = (x × k × y)2
Giving:
a = x × k × y
b = (y2 − x2) × (k/2)
c = b + n
= (y2 − x2) × (k/2) + x2 × k
= (y2 + x2) × (k/2)
Where 'x', 'y' and 'k' are all integers. When 'n' is even, another factorisation is possible:
n = 2m
a2 = 2m × (2b + 2m) = 4m × (b + m)
Set
m = k × x2
b + m = k × y2
Giving:
a = 2 × x × k × y
b = k × (y2 − x2)
c = k × (y2 + x2)
Some examplesn = 1When 'n' is 1, 'x' is 1 and 'k' is 1. So
a = y
b = (y2 - 1) / 2
c = (y2 + 1) / 2
For integer solutions y must be odd (1,3,5,...). This generates the triples [1,0,1], [3,4,5], [5,12,13], etc. n = 2When 'n' is 2 we use the second factorisation based on, n = 2m. So 'x' is 1 and 'k' is 1, giving;
a = 2 × x × k × y = 2 × y
b = k × (y2 − x2) = (y2 − 1)
c = k × (y2 + x2) = (y2 + 1)
This generates the sequence
[ 2, 0, 2]
[ 4, 3, 5] = [3, 4, 5]
[ 6, 8, 10] = 2 × [3, 4, 5]
[ 8, 15, 17]
[10, 24, 26] = 2 × [5, 12, 13]
[12, 35, 37]
[14, 48, 50] = 2 × [7, 24, 25]
[16, 63, 65]
[18, 80, 82] = 2 × [9, 40, 41]
[20, 99, 101]
When 'y' is odd, y2±1 is even and all the terms can be divided by 2, so this formulation only generates prime triples when 'y' is even, making 'a' is a multiple of 4. Eliminating the permutation of (3,4,5), multiples of (0,1,1) and other multiples leaves the prime sequence:
[ 8, 15, 17]
[12, 35, 37]
[16, 63, 65]
[20, 99, 101]
...
n = 3For n = 3 we use the original formulation where k = 3 and x = 1.
a = x × k × y = 3 × y
b = (y2 − x2) × (k/2) = (y2 − 1) × (3/2)
c = (y2 + 1) × (3/2)
'a', 'b' and 'c' are all divisible by 3 so all triples generated are multiples of those generated by n = 1. In general when k > 1 'a', 'b' and 'c' will have 'k' as a common factor so the triple can't be prime. SummaryThe above discussions shows us that all prime triples can be generated from a2 + b2 = (b+n)2 where 'n' is either a square number or twice a square number (because for all other 'n' the generated terms will have a common factor 'k', greater than 1). Previously we calculated the series based on x = 1, (n is 1 or 2). The next set of prime triples will be generated when x = 2 (n is 4 or 8).
If we reformulate the equations with k = 1 and 'x' as the key driver rather than 'n' we get
a = x × y
b = (y2 − x2) / 2
c = (y2 + x2) / 2
and
a = 2 × x × y
b = (y2 − x2)
c = (y2 + x2)
which will generate all prime triples (and some that aren't). These equations generate none prime triples when
Source CodePythagoras.py contains code for generating the triples and the diagrams that illustrate this page. It is a bit out of date so the agorithms don't match exactly those decribed here, though they get the correct results. ImagesA plot of the prime triples out to (3200x3200). Each pixel represents a 10x10 cell. This is quite interesting as most of the points appear to lie on curves and there are 'special' points where three of these curves appear to intersect.
The same area with the non prime triples (red) included. The straight lines are generated by multiples of the smaller triples like (3,4).
And finally the prime triples shown out to (32000,32000). Each pixel now represents 100x100 points.
Complex NumbersIf we take two complex numbers (a1,b1) and (a2,b2) and multiply them together we get a third complex number (a3,b3). If these numbers are interpreted as vectors then the lengths (l) of the three vectors are related as l3 = l1 x l2. So if (a1,b1,l1) and (a2,b2,l2) are Pythagorean triples so is (a3,b3,l3). When multiplying complex numbers;
a3 = a1 × a2 − b1 × b2
b3 = a1 × b2 + b1 × a2
We can use this as another way of generating unlimited series of triples, for instance the powers of (3,4) are;
Although this series is unlimited the examples it generates are rather far apart, only the first six appear in our diagrams above. It also shows that all powers of 5 are the square root of the sum of two squares. The 'n' column allows us to identify the 'x' value associated with the new triple. The series generated by (5,12) shoots out of sight even more rapidly, but at the same time shows that all powers of 13 can also be represented as the square root of the sum of two squares.
Generally, if 'c' is the largest value in a triple, then so is ci. When multiplying two different triples together there are two possible result sets, for instance multiplying the 64 permutations of (3,4,5) and (5,12,13) generates two sets of 32 values based on (16, 63, 65) and (33, 56, 65). For instance;
(3 + 4j) x ( 5 + 12j) = (-33 + 56j)
(3 + 4j) x (12 + 5j) = ( 16 + 63j)
(4 + 3j) x (12 + 5j) = ( 33 + 56j)
(4 + 3j) x ( 5 + 12j) = (-16 + 63j)
=> 652 = 162 + 632 = 332 + 562
Generally, if 'c1' and 'c2' are the largest values in different triples, then c1 × c2 will be the largest value in two different triples. This rule doesn't work when c1 = c2 as one of the triples turns out to be (0,c,c). |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
(c) John Whitehouse 2011
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||