# Solve the following equation in natural numbers : x²+y²=1997(x-y) ?

Jun 24, 2016

$\left(x , y\right) = \left(170 , 145\right)$ or $\left(x , y\right) = \left(1817 , 145\right)$

#### Explanation:

The following proof is based on that in the book "An Introduction to Diophantine Equations: A Problem-Based Approach" by Titu Andreescu, Dorin Andrica, Ion Cucurezeanu.

Given:

${x}^{2} + {y}^{2} = 1997 \left(x - y\right)$

Let $a = \left(x + y\right)$ and $b = \left(1997 - x + y\right)$

Then:

${a}^{2} + {b}^{2} = {\left(x + y\right)}^{2} + {\left(1997 - x + y\right)}^{2}$

$= {x}^{2} + 2 x y + {y}^{2} + {1997}^{2} + {x}^{2} + {y}^{2} - 2 \left(1997 \left(x - y\right) + x y\right)$

$= {x}^{2} + 2 x y + {y}^{2} + {1997}^{2} + {x}^{2} + {y}^{2} - 2 \left({x}^{2} + {y}^{2} + x y\right)$

$= {1997}^{2}$

Hence we find:

$\left\{\begin{matrix}0 < a = x + y < 1997 \\ 0 < b = 1997 - x + y < 1997\end{matrix}\right.$

Since $1997$ is prime, $a$ and $b$ have no common factor greater than $1$.

Hence there exist positive integers $m , n$ with $m > n$ and no common factor greater than $1$ such that:

$\left\{\begin{matrix}1997 = {m}^{2} + {n}^{2} \\ a = 2 m n \\ b = {m}^{2} - {n}^{2}\end{matrix}\right. \textcolor{w h i t e}{X X} \text{or} \textcolor{w h i t e}{X X} \left\{\begin{matrix}1997 = {m}^{2} + {n}^{2} \\ a = {m}^{2} - {n}^{2} \\ b = 2 m n\end{matrix}\right.$

Looking at $1997 = {m}^{2} + {n}^{2}$ in mod $3$ and mod $5$ arithmetic, we find:

$2 \equiv 1997 = {m}^{2} + {n}^{2}$ (mod $3$) hence $m \equiv \pm 1$ and $n \equiv \pm 1$ (mod $3$)

$2 \equiv 1997 = {m}^{2} + {n}^{2}$ (mod $5$) hence $m \equiv \pm 1$ and $n \equiv \pm 1$ (mod $5$)

That means that the only possibilities for $m , n$ modulo $15$ are $1 , 4 , 11 , 14$.

In addition note that:

${m}^{2} \in \left(\frac{1997}{2} , 1997\right)$

Hence:

$m \in \left(\sqrt{\frac{1997}{2}} , \sqrt{1997}\right) \approx \left(31.6 , 44.7\right)$

So the only possibilities for $m$ are $34 , 41 , 44$

We find:

$1997 - {34}^{2} = 841 = {29}^{2}$

$1997 - {41}^{2} = 316$ not a perfect square.

$1997 - {44}^{2} = 61$ not a perfect square.

So $\left(m , n\right) = \left(34 , 29\right)$

So:

$\left(a , b\right) = \left(2 m n , {m}^{2} - {n}^{2}\right) = \left(1972 , 315\right)$

or

$\left(a , b\right) = \left({m}^{2} - {n}^{2} , 2 m n\right) = \left(315 , 1972\right)$

$\textcolor{w h i t e}{}$
If $\left(a , b\right) = \left(1972 , 315\right)$ then:

$\left\{\begin{matrix}x + y = 1972 \\ 1997 - x + y = 315\end{matrix}\right.$

and hence:

$\left(x , y\right) = \left(1817 , 145\right)$

$\textcolor{w h i t e}{}$
If $\left(a , b\right) = \left(315 , 1972\right)$ then:

$\left\{\begin{matrix}x + y = 315 \\ 1997 - x + y = 1972\end{matrix}\right.$

and hence:

$\left(x , y\right) = \left(170 , 145\right)$