# Solving the simultaneous equations $x + y - z = 12$ and $x^2 + y^2 - z^2 = 12$

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!

• I think you did just what was expected. What was the average time allotted per question? This looks like it would fit within 10-15 minutes to me. – Ross Millikan Sep 20 '15 at 20:53
• Welcome to our site! – kjetil b halvorsen Sep 20 '15 at 21:02
• Different, but not better: we have $x-z=12-y$, $x^2-z^2=12-y^2$. Letting $k=x+z$, this implies that $(12-y)k=12-y^2$, which is quadratic in $y$. The discriminant of this quadratic is $(k-24)^2-528$, so finding integer solutions is tantamount to factoring $528$ (which incidentally is $8\cdot 66$). – Micah Sep 20 '15 at 21:15
• Cheers guys, (thanks Micah for the alternative way!). The time allotted is about 30 minute for the question. It took me a while to check whether the possible solutions from the factorisation of 66 were actually solutions to the original question since it requires working out 12 two digit numbers squared and although my problem solving is ok, my mental maths/calculating is pretty rubbish! – Zestylemonzi Sep 20 '15 at 21:28

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$.