A Pythagorean triplet is a set of three natural numbers, a<b<c, for which,

a^2+b^2=c^2For example, 3^2+4^2=9+16=25=5^2.

There exists exactly one Pythagorean triplet for which a+b+c=1000. Find the product abc.

https://projecteuler.net/problem=9

Pythagorean triplets are pretty cool and useful. Carpenters use them to check if their structures are square. The Babylonians, well before Pythagoras’s time, knew of them. One piece of evidence is the Plimpton 322 cuneiform tablet, dating all the way back to 1800 BC.

Archaeologists have argued that the tablet is actually a trigonometric table, for use by scribes and engineers. The second and third columns of the tablet list the shorter leg and the hypotenuse of Pythagorean triplets written in base 60. For example, the first row lists 1,59_{60} as the shorter leg and 2,49_{60} as the hypotenuse. Converting to base 10, we get 119 and 169. \sqrt{169^2-119^2} = 120. Therefore, the first row, in a roundabout way, shares knowledge of 119, 120, 169 as a triplet.^{1}Robson, Eleanor. “Word and Pictures: New Light on Plimpton 322”. *The Mathematical Association of America Monthly*, **109** (2): 105-120 https://www.maa.org/sites/default/files/pdf/upload_library/22/Ford/Robson105-120.pdf

So this exercise has quite a lot of historical context. Searching for integer solutions of a^2+b^2=c^2 is actually an exercise in nonlinear Diophantine equations.^{2}Polynomial equations where only integer solutions are sought. Luckily for us, a lot of prior work has been done toward general solutions of Diophantine equations. The star of today’s show is Euclid’s Formula. It states that for any pair of integers m and n, with m>n>0, Pythagorean triplets can be generated by

a=m^2-n^2 \\ b=2mn \\ c=m^2+n^2

The problem says that a+b+c=1000, so let’s sum these equations together to 1000.

(m^2-n^2)+(2mn)+(m^2+n^2)=1000 \tag{1}

After some algebra, Equation 1 is simplified to

m(m+n)=500 \tag{2}

Now we just need to find integers m and n that satisfy Equation 2. 500 doesn’t have that many factors, so it’s reasonable to just list all integer pairs a and b where ab=500: (1,500),(2,250),(4,125),(5,100),(10,50),(20,25).

We can plug these numbers in, keeping in mind the stipulation that m>n>0. (1,500) doesn’t work because n would have to be greater than m. We see that the difference between b and a has to be smaller than a. The only pair for which this holds is (20,25). Indeed, 20(20+5)=500 and 20>5>0. Behold our newfound m and n!

All that remains is to plug m and n back into Euclid’s Formula. We get a=20^2-5^2=375, b=2(20)(5)=200, and c=20^2+5^2=425. Therefore, 200, 375, 425 form the only Pythagorean triplet that add up to 1000. The answer is abc or 31875000. As Euclid would say, ΟΕΔ.^{3}Greek version of the Latin QED.