Generating Pythagorean Triples Advanced. This lesson goes beyond core Geometry. You can skip it.
Progress can't be saved in this browser, so this lesson's status can't be set.
Watch the video explainer
Learning goals
- Reduce a Pythagorean triple to its primitive triple and identify the scale factor
- Derive and use the formulas that generate Pythagorean triples
- Explain how parity and coprimality determine whether the formulas give a primitive triple
- Recover the two parameters of a primitive triple and justify why the recovery works
Reduce a triple to its smallest integer copy
A Pythagorean triple consists of positive integers , , and with
By the Pythagorean theorem and its converse, these are the lengths of a right triangle, with hypotenuse . To see that the lengths make a triangle, build a right corner with legs and . The third side has positive length by the theorem. The two leg entries can go in either order.
A triple is primitive when the greatest common factor (GCF) of its three entries is . The triangles below have the same shape. The small one has no common factor greater than , and each length of the larger one is three times its partner.
Multiplying all lengths by a positive integer multiplies both sides of the squared equation by . Dividing all lengths by their GCF reverses that operation and leaves a primitive triple. The GCF must be removed in full. Any common factor still left in the quotient would give a larger common factor of the original lengths.
Worked example 1 Find the original shape
Problem. A right triangle has side lengths , , and units. Find its primitive triple and the integer scale factor from the primitive triangle to this triangle.
Solution. The common factors of and are and . Since is also divisible by , the GCF of all three lengths is .
Divide all three entries by .
The primitive triple is . The scale factor to the given triangle is .
Check your understanding
The right triangle with sides , , and has which primitive triple?
The GCF of 170 and 264 is 2, and 314 is divisible by 2 as well.
Build a triple from two squares
A sum and difference can give two sides whose squares differ by a perfect square. Start with and . Their sum is and their difference is .
Factor the difference of the new squares. In the sum, the terms cancel. In the difference, the terms cancel.
So , , and are side lengths of a right triangle. The product became a square because both starting numbers were squares.
Why the two-parameter construction gives a right triangle#
Take integers . Write for the difference of their squares and for the sum.
Factoring uses the same sums and differences as with and .
Use as the remaining leg . The factored equation then gives . All entries are positive because . The choice of and in the numerical argument only supplied the two squares.
The three entries are called Euclid’s formulas. The second entry is always even, but it may be the shorter or the longer leg.
Worked example 2 The even leg comes second
Problem. Generate the triple for the parameter pair . Give the two legs in increasing order and name the hypotenuse.
Solution. The difference gives one leg, the doubled product gives the other, and the sum gives the hypotenuse.
The legs in increasing order are and . The hypotenuse is .
Check your understanding
For the parameter pair , which entry equals the hypotenuse?
The hypotenuse is the sum of the two parameter squares.
Tell which parameters give a primitive triple
Some pairs build a triangle whose sides have a common factor. A pair of integers is coprime if its GCF is . It has opposite parity if one integer is even and the other is odd.
Worked example 3 Two tests for the inputs
Problem. For each pair below, decide whether the output of Euclid’s formulas is primitive. When it is scaled, find the primitive triple and the scale factor.
Case A uses the parameter pair .
Case B uses the parameter pair .
Case C uses the parameter pair .
Solution. Case A gives . The GCF of and is , so the triple is primitive. The parameters are coprime and have opposite parity.
Case B gives . Both parameters are odd, so both the difference and sum of their squares are even. The GCF of all three entries is , giving primitive triple and scale factor .
Case C gives . Both parameters are multiples of , so the formulas use multiples of . The GCF of the three entries is , giving primitive triple and scale factor .
The formulas give a primitive triple exactly when the parameters are coprime and have opposite parity.
Why coprimality and opposite parity give a primitive triple#
If the parameters share a factor , each formula contains a factor , just as divided all the outputs in Case C.
If the parameters have the same parity, their square sum and square difference are even. The doubled product is already even, so divides all three outputs.
Now take coprime parameters of opposite parity. For example, with the parameter pair , both and are odd, so cannot divide the whole triple. Any odd prime dividing both and would divide their sum and difference.
That prime would have to divide both and , since it is odd and every prime factor of a square comes from its base. The two parameters are coprime.
For any coprime parameters of opposite parity, and are odd, and the same sum and difference are and . No odd prime can divide both because that prime would divide both and . So no prime divides all three outputs, and their GCF is .
Check your understanding
Why can the parameter pair produce a scaled triple even though they have opposite parity?
Write the parameters as 3 times 4 and 3 times 3. Each square and the product pick up the same factor.
Recover the parameters of a primitive triple
The formulas can be reversed. For the primitive triple with legs and and hypotenuse , use the odd leg for and the even leg for . The squares we want come from adding and subtracting the odd leg.
The two results are positive and coprime. Their product is , a square. Since a prime can appear in at most one of the two factors, each factor must contain its own primes in pairs. Here contains two copies of , and contains four copies of . Taking positive square roots gives and , which are coprime and have opposite parity.
Why every primitive triple has these parameters#
A primitive triple has exactly one even leg. Two even legs would make even and hence even, giving a common factor of . Two odd legs would make leave remainder on division by . A square has remainder or : an even square is divisible by , and an odd square has the form for some integer . With one odd and one even leg, is odd, so is odd.
Name the odd leg and the even leg . Define the positive integers
Both are integers since and are odd, and since . Factoring the difference of squares gives
Any prime shared by and would divide their sum and their difference . It would then divide , since , and so divide as well. Primitivity excludes any such prime.
Because is a square, every prime in its factorization occurs an even number of times. Since and share no primes, those even counts already occur in each factor separately. The factors are the squares of positive integers and , respectively, with . A shared prime of and would also be shared by and , so and are coprime. Their squares add to the odd integer , which means and have opposite parity.
Add and subtract the two squares to recover and . Take the positive square root of to recover half of .
The argument used the same sum, difference and prime-pairing steps as the numerical example. The odd leg and hypotenuse determine and , so they also determine the unique positive parameters with .
Worked example 4 Recover a pair from an even leg listed first
Problem. The primitive triple is . Find the positive integers in Euclid’s formulas and use them to check the even leg.
Solution. Use as the odd leg and as the hypotenuse.
Taking positive roots gives the parameter pair . The even leg checks because
Check your understanding
For the primitive triple with legs and and hypotenuse , which pair gives the parameters ?
Use the odd leg 99 in the two half-sums and differences.
Take the positive square roots.
Separate the scale factor from the parameters
For any Pythagorean triple, divide by the GCF first. The quotient is primitive, so it has a unique pair of coprime, opposite-parity parameters. Then multiply the three generated entries by the original GCF to recover the given triple. Leg order can be swapped.
Worked example 5 Recover both the scale and the shape
Problem. A right triangle has sides , , and units. Find its integer scale factor from the primitive triangle, and find the parameters of that primitive triple.
Solution. The GCF of and is . Since is divisible by , the GCF of all three is . Dividing gives primitive triple .
Use the odd leg and the hypotenuse .
The parameters are and . Their doubled product is , which matches the even leg of the primitive triple. The original triangle uses scale factor .
Check your understanding
A right triangle has sides , , and . Why should you divide by the GCF before recovering primitive parameters?
All three given lengths are even, so there is no odd leg to put into the primitive recovery formulas. Divide each length by the GCF first.