[Math] Solving the simultaneous equations $x + y – z = 12$ and $x^2 + y^2 – z^2 = 12$

problem solving

I found the following question online (it was a past question on the BMO):

find all positive integer solutions $x,y,z$ solving the simultaneous equations

$ x + y – z = 12 \ $ and $\ x^2 + y^2 – z^2 = 12 $ .

Normally these questions have a simple and elegant solution and although I've managed to solve it, the answer I found was neither! I wondered if anyone can see a simpler way to tackle the problem.

The way I solved this was to use the first equation to eliminate $z$ in the second question. I then factorised the resulting equation to obtain:

$(x-12)(y-12) = 66$ .

Then, using the fact that $66=2\times 3\times 11$ and also the fact that the equations are symmetric in $x$ and $y$, I worked out the possible factorisations of $66$ into two factors. From this I worked out possible solutions and then checked to see that they indeed were. (In total I found $8$ solutions.) Although this method worked, it seemed a bit cumbersome and I hope someone can improve on it! Please note that this question is aimed at someone with at most A-level standard maths abilities meaning it shouldn't need complex mathematics to solve it!

Best Answer

I'll try a generalization.

From $x+y-z = n $ and $x^2+y^2-z^2 = m $, $z = x+y-n$ so $z^2 =(x+y)^2-2n(x+y)+n^2 =x^2+2xy+y^2-2n(x+y)+n^2 $.

Therefore $m =x^2+y^2-(x^2+2xy+y^2-2n(x+y)+n^2) =-2xy+2n(x+y)-n^2 $ so $xy-n(x+y) =-(m+n^2)/2 $ or $(n^2-m)/2 =xy-n(x+y)+n^2 =(x-n)(y-n) $. The integer solutions thus depend on the factors of $N=(n^2-m)/2$. Note that if $n$ and $m$ have different parity, there are no integer solutions.

For each $N =ab $ either $x=n+a, y=n+b $ or $x=n-a, y=n-b $.

The largest solution is gotten by setting $a=N$ and $b = 1$ so $x = n+N$ and $y = n+1$.