How to solve $937=x^2+24x+24y+y^2$ where x and y are integers.

I am trying to solve the equation $937=x^2+24x+24y+y^2$, where x and y are integers. What I've tried is changing the right side of the equation to $$(x+y)^2-2xy+24x+24y$$ $$(x+y)^2-2(x+y)(-12)+xy$$ $$(x+y)((x+y)++24+x+y)$$ $$2(x+y)(x+12+y)$$

and then trying to find integers that fit into the equation but it doesn't seem like the most efficient or proper way to solve this equation. Any suggestions?

• Hint: $(x+12)^2 + (y+12)^2 = ???$ – achille hui Sep 14 '15 at 20:48
• When I evaluate that I get $$x^2+24x+24y+y^2+288$$. I'm not sure how that would help me solve the equation. – Jonathan Sep 14 '15 at 20:53
• "Borrow" the 288 from your goal number 937 and see what's left. Then you're looking for sum of two squares to equal that, and there are various techniques for solving $u^2+v^2=m$ when it can be solved. – coffeemath Sep 14 '15 at 20:56
• $937+288 = 1225 = 35^2 = (5\times 7)^2$, this reduce to the well known problem of writing a number as sum of squares... – achille hui Sep 14 '15 at 20:58
• @coffeemath, I think you led OP astray. You should have told him to add $288$ to both sides of the equation. – Lubin Sep 14 '15 at 21:10

Complete the square in each of the $x$ and $y$ quadratics:

\begin{align} (x^2+24x+144)+(y^2+24y+144)=937+288&=1225 \\ (x+12)^2+(y+12)^2=35^2 \end{align}

So we are seeking Pythagorean triples where the triangle has two sides of length $x+12,y+12$ and a hypotenuse of $35$. Irreducible Pythagorean triples are of the form:

$$(m^2-n^2,2mn,m^2+n^2)$$

The only primitive triples relevant here are those with $m^2+n^2\in\{5,7,35\}$ because these are all the factors of $35$ larger than one, and so are the only ones that can be scaled up to obtain a triangle with hypotenuse $35$.

The only one with integer solutions is $m^2+n^2=5 \implies m=2,n=1$ ($7$ and $35$ are of the form $4k+3$ so cannot be a sum of two integer squares) from which we have the primitive triple $(3,4,5)$. So

\begin{align} &3^2+4^2=5^2 \\ &\implies 21^2+28^2=35^2 \\ &\implies (\pm21)^2+(\pm28)^2=35^2 \\ &\implies (x+12,y+12)\in\{(21,28),(-21,28),(21,-28),(-21,-28),(28,21),(-28,21),(28,-21),(-28,-21)\} \\ &\implies (x,y)\in\{(9,16),(-33,16),(9,-40),(-33,-40),(16,9),(-40,9),(16,-33),(-40,-33)\} \end{align}

[Update]

As $\color{blue}{\text{coffeemath}}$ has pointed out, there are also trivial solutions (not Pythagorean triples) to the original equation, i.e.

$$(x+12,y+12)\in\{(\pm35,0),(0,\pm35)\}$$

whence

$$(x,y)\in\{(-47,-12),(23,-12),(-12,-47),(-12,23)\}$$

are also solutions.

• Thank you for this explanation. It has inspired me to increase my knowledge on pythagorean triples. – Jonathan Sep 15 '15 at 1:19
• You're welcome. I'm glad you're inspired. It's a nice topic. – Marconius Sep 15 '15 at 1:33
• There are four more solutions $(x,y)=(-12,-12 \pm 35),(-12 \pm 35,-12).$ – coffeemath Sep 15 '15 at 12:11
• @coffeemath - Thanks - not sure how I missed that. I've updated the answer accordingly. – Marconius Sep 15 '15 at 13:28