This puzzle, which I posted to twitter (@puzzlecritic) a few weeks ago, is one of my variations on a problem that appeared in a mathematical discussion group on LinkedIn:
Find three different positive integers such that the sum of any two is a square.
This seems innocuous; you just have to find three numbers that work, and you’re not even asked to prove anything. And yet it is possible to spend a frustratingly long time trying and failing to come up with an answer. Even if you do stumble upon a solution, you might be left wondering if there are any more, and if so how you might go about finding them all.
Small examples do exist, but the matter can be settled in complete generality with algebra. We are looking for positive integers satisfying the following:
Now, at the moment it looks like we just don’t have enough information: the numbers being asked for are and , but the equations above have six unknowns, not three.
Oh well. Let’s see what happens when we solve them simultaneously for and :
We now have expressions for our three original numbers; unfortunately they’re in terms of and . But wait: we are now completely free to pick positive integer values for and , and this will give us our three numbers and ! Problem solved.
Great, so let’s pick . We’re so close we can taste the finish line. Our values for and are…
Oh dear. Our numbers were supposed to be positive, and -2 is definitely not positive.
You can’t be sure you can solve a problem until you’ve seen it all the way through. We are not completely free to pick values for and after all: we require the sum of the smaller two to be greater than the third and largest square. Otherwise one of and will be negative, as in the failed attempt above.
Okay, point made; let’s finish this. 16, 25 and 36 are all squares, and 16+25 is greater than 36. So let’s pick , and we obtain…
Oh come on! What now? Just when you thought the hurdle had been overcome, another one pops up.
When you see it, it’s obvious: if you ever find yourself dividing by 2, you had better make sure that the number you started with was even, or you won’t have an integer left after the calculation, as in failed attempt number 2.
At this stage, you might begin to question if anything else could go wrong. Actually, there is something – we can ensure positivity and integer values, but how do we know our and will all be different?
A bit of thought resolves this quickly: looking at the equations we had to solve, two of and will be equal only if two of and are equal.
Alright, we finally have this sussed (hopefully). Pick different values of and so that the squares of the smaller two have a sum greater than the square of the third, and so that all the numerators on the right hand side of the second set of equations above are even. This is equivalent to the condition that $x^2+y^2+z^2$ is even.
Looking at small numbers, we find that satisfies all the necessary conditions, and at long last we have a solution:
After all that, it might feel like it would have been quicker just to try loads of numbers. The benefit of the algebraic approach is that now we know how to find all the solutions.
It’s such a simple puzzle, but an awful lot of good learning can come out of it. I will be asking pupils to have a go for many years to come.