# Triples and quadruples: from Pythagoras to Fermat

### by Chandrahas Halai

Pythagoras' theorem. Image: Wapkaplet.

If there’s one bit of maths you remember from school it’s probably Pythagoras’ theorem. For a right-angled triangle with sides , , , where is the side opposite the right angle, we have

If three positive whole numbers , and satisfy this equation — if they form the sides of a right-angled triangle — they are said to form a *Pythagorean triple*.

One question that intrigued Pythagoras himself, as well as other ancient Greek mathematicians, is how to generate Pythagorean triples. If I give you a positive number , can you find two numbers and so that , and form a Pythagorean triple? In this article we’ll explore this question, and we’ll also see how the idea extends to sets of four numbers, called *Pythagorean quadruples*.

### Pythagorean triples

First of all, here are some examples of Pythagorean triples:

Some Pythagorean triples.

The triples written in red are multiples of each other and so are the triples written in blue: you get and by multiplying the components of by 2, 3 and 4 respectively, and you get by multiplying the components of by 2.

In general, if is a positive whole number and is a Pythagorean triple, then so is , since

Geometrically, if one Pythagorean triple is a multiple of another, then the corresponding triangles are similar.

Pythagoras as depicted by Raffaello Sanzio in his painting *The school of Athens*.

If a Pythagorean triple isn’t a multiple of another Pythagorean triple, then we say that it is a *primitive triple*. You can recognise a primitive Pythagorean triple by the fact that the numbers and do not have a common divisor. In our example is a primitive Pythagorean triple while and are not. Similarly is a primitive triple whereas is not.

then

Now consider the two expressions

and

They differ by exactly so the two expressions

and

differ by

Plato (left) with Aristotle (right) as depicted by Raffaello Sanzio in his painting *The school of Athens*.

Therefore, if we choose

and

we have

For the numbers , and to represent a Pythagorean triple we need

and

to be whole numbers. This means that both

and

need to be even, which in turn implies that needs to be odd. But the square of a number is odd only if the number itself is odd, so this method only works for odd .

There is however an easy way to derive a formula for even values from the above. If , and form a Pythagorean triple of the form described above, then so do

This method for generating triples from even numbers has been attributed to Plato. Here is a list of Pythagorean triples generated from both even and odd numbers using these two methods:

Since the methods give us a triple for every positive whole number we see that there are infinitely many Pythagorean triples. But can these methods generate all of them? The answer is no. For example, the triple is absent from the list above. A general formula was described by Euclid in his famous book *The Elements*. Take any two positive whole numbers and with . Similarly to our reasoning above, notice that

and

differ by So setting

gives

Since and are positive whole numbers and all three numbers , and are also positive whole numbers, so we have a Pythagorean triple. Every primitive Pythagorean triple can be generated from a unique pair of numbers and , one of which is even. And once you have the primitive ones you can generate all Pythagorean triples simply by multiplying. So Euclid’s formula really does give you all the triples there are.

### Pythagorean quadruples

Now let’s look at *Pythagorean quadruples* which consist of four positive whole numbers instead of three. In a Pythagorean quadruple the sum of squares of first three numbers gives us the square of the fourth:

*Pythagorean boxes*. As before, if is a Pythagorean quadruple, then so is for any positive whole number . If the greatest common divisor of , and is 1 then the quadruple is called

*primitive*. Here are some examples of Pythagorean quadruples with members that are multiples of each other in the same colour (red, blue or green):

Some Pythagorean quadruples.

We can generate a Pythagorean quadruple from any two numbers and simply by noting that

Thus, setting

and gives us a Pythagorean quadruple.

This also gives us a way of generating a Pythagorean quadruple from a single even number . Firstly, note that if is even, then is even. Now find two numbers and so that Set

and

Then

gives us our Pythagorean quadruple. For example, if , then so choose and We get the quadruple with

For we have We now have two choices as and The first choice gives the quadruple with

The second choice gives the quadruple with

You can continue to generate quadruples from even numbers in this way.

### Can we generate all Pythagorean quadruples?

Not all Pythagorean quadruples are of the form

so not all of them can be generated using the method we just described — we need to be a little cleverer. Suppose that you’re given two numbers and Now find a number which divides but so that If and are both even, then we also require that itself is even.

Euclid (the man with the compass) as depicted by Raffaello Sanzio in his painting *The school of Athens*.

So letting

we have

But are , , and positive whole numbers? This is why we’ve imposed conditions on You can show that as long as and are either both even, or if one is even and one is odd, then the conditions ensure that , , and are positive whole numbers.

(Click here to see why.)

If and are both odd it is impossible to generate a Pythagorean quadruple from them by this method.

But the important point is that you can construct every primitive Pythagorean quadruple from two numbers and in the way we’ve just shown. And again, once you have the primitive ones, you can get all the others just by multiplying.

### Generating a series of squares

Another nice thing to notice is that using our mechanism for generating triples, we can make sums of squares of any length. Let’s start with the triple We can generate another triple starting with the number 5: it’s Thus we have

and

Rearranging the second equation gives

Substituting this into the first equation and rearranging gives

so we have the quadruple Proceeding in a similar way, always using the biggest of the current set of numbers to generate a new triple, we can construct the *quintuple* and the *sextuple* and so on, ad infinitum.

### Cubes and beyond

Pythagorean quadruples consist of a sum of squares, but what if we look at sums of cubes of the form

These are called *cubic quadruples*. Here are a few examples (again, quadruples written in red, blue or green are multiples of each other).

Some cubic quadruples.

We won’t explore how to generate them here, but instead ask a question that turns out to be more interesting: are there also cubic *triples*? This question is the subject of one of the most famous results in mathematics: *Fermat’s last theorem*. The theorem says that there are no three positive whole numbers , and such that

In fact, the theorem says more than that: for *any* positive whole number greater than two it is impossible to find three positive whole numbers , and such that

The result was made famous by the French mathematician Pierre de Fermat in 1637. Fermat wrote in the margin of his book that he had "discovered a truly marvelous proof of this, which this margin is too narrow to contain". For over 300 years mathematicians desperately tried to reconstruct this marvellous proof, but they didn't succeed. It was not until 1995 that the mathematician Andrew Wiles proved the result, using sophisticated mathematics Fermat could not possibly have known about.

### Further reading

You can read more about Fermat's last theorem on *Plus*.

### About the author

Chandrahas Halai is a mathematics enthusiast from the land of the Shulba sutras, the Bakhshali manuscript, and mathematicians like Aryabhatt, Brahmagupta, Bhaskaracharya, Ramanujan and many more. He is a consultant in the field of computer aided engineering, engineering optimisation, computer science and operations research. He writes research papers, articles and books on mathematics, physics, engineering, computer science and operations research. In his spare time he likes doing nature photography and painting.

## Comments

## Typos

I am confused by:

Thus, setting $a = m^2, b = 2mn, c= n^2$ and $d=(m+n)^2$ gives us a Pythagorean quadruple.

I think it should actually be

Thus, setting $a^2 = m^2, b^2 = 2mn, c^2= n^2$ and $d^2=(m+n)^2$ gives us a Pythagorean quadruple.

It should be noted that $b^2= 2 m n$ does not give us an integer $b$ unless $2 m n$ is a perfect square. In the following set of equations $ d=m+n$ and not $d=(m+n)^2$.

The section on extending to longer sequences is very interesting.

## Nice article!

I very much enjoyed your article. I have an interest in Euler bricks which are related to your quadruples in that a "perfect" one (as yet undiscovered; perhaps impossible) would not only have an integer body diagonal, but all the face diagonals would be integers as well.

Enjoy thinking about it. OEIS Sequence A211133 is also related.

Best wishes, Alan

## Thanks, and a small error

Very belatedly catching up on Plus articles. I enjoy these articles - although as a Masters student the maths is familiar to me already, the authors are clearly very interested in their topics and that enthusiasm comes through! Thank-you for your enthusiasm.

In the section where Pythagorean quadruples are introduced, your geometrical explanation is slightly incorrect - the diagonal of the box is of course sqrt(a^2+b^2+c^2) and not simply a^2+b^2+c^2 as written. Similarly for the diagonal of the bottom face in the diagram.

## Thank you for pointing the

Thank you for pointing the error! We've corrected it.

## Pythagorean Triples

Pythagorean triples can be easily identified by expressing the equation as (p+q)^2-(p-q)^2 = 4pq which clearly has an integer square root if both p and q have integer square roots.

## Can you elaborate on

Can you elaborate on this?

And can you kindly introduce yourself.

## Thanks

Thank you Chandrahas Halai for such a story.

Mohammad Abul Hosein

O-A Level Maths Teacher

Bangladesh

e-mail: ahossain69@yahoo.com

## You are welcome, Sir! This is

You are welcome, Sir!

This is encouraging me to write more such articles.

## Pythagoras to Fermat by Chandrahas Halai

Quite interesting.. Chandrahas has a passion for mathematics.He attributes this to great teachers of his early years.Compliments to Chandrahas.......Prof.V.H. iyer, Ph.D., Dean, We School,Mumbai.

## Thank you for the words of

Thank you for the words of encouragement, Sir!

## Very Interesting article

This is truly an interesting article and gives a newer insight to theorems that we have been using for years. The method shown to generate quadruple from triplets is mind-boggling. I am wondering about similar triplets and quadruples for non-integers. atul-Mumbai

## Mr. Atul, Thank you for

Mr. Atul,

Thank you for liking the article. The article is on number theory, which deals with properties of integers.

As it is for real numbers you can have infinite solutions for triples and quadruples.