*Spoiler for New Scientist Enigma 1709: *

Joe remembered a puzzle he solved years ago. In an alley, two ladders, each with their feet against the base of a wall, were leaning against the opposite wall. The distances (whole numbers of centimetres) above the ground where they touched the walls were given, and Joe had to calculate how high above the ground the ladders crossed. He also calculated that the ladders could have been 315 centimetres and 261 centimetres long. What was the width of the alley?

They’re on a real Pythagorean triples kick lately. At least I think the width of the alley is supposed to be a whole number of centimeters, otherwise the problem has no unique solution, does it?

But if the alley is required to be a whole number of centimeters wide then what we have are two Pythagorean triangles, one with hypotenuse 315 and one with hypotenuse 261, and both having one side the same.

Well, this is easy, if you remember the hypotenuse of a Pythagorean triangle has length *a*(*u*^{2}+*v*^{2}) with *u*>*v*. The prime factors of 315 are 5, 7, and 9, so *a* can be 1, 5, 7, 9, 35, 45, 63, or 315. Testing these we find *a*=63, *u*=2, *v*=1 or equivalently *a*=7, *u*=6, *v*=3 and no other possibilities. Then the other two sides of the triangle are *a*(*u*^{2}–*v*^{2}) and 2*auv* which are 189 and 252. One of these must be the width of the alley. Now testing 261^{2}–189^{2} and 261^{2}–252^{2}, the first gives 180^{2} while the other doesn’t give us an integer root. So the two triangles are 189, 252, 315 and 189, 180, 261, with 189 the width of the alley.