For which positive integers $x$, $y$ satisfy the following equation: $x^2 + y^2 = 2020$?

273 Views Asked by At

This problem is driving me absolutely crazy. I managed to determine the max value of $x$ and $y$:
$x^2 + y^2 = 2020$
$=>x^2 = 2020 - y^2$ It's obvious that square cannot be smaller than 0, and we're looking only for positive integers, therefore:
$=> 2020-y^2 > 0$ And we get $y\in \{1, 2, 3 ...44\}$. Hence $\sqrt{2020} \approx\ 44,94$, and $45^2=2025$, we are only limited to integers between $1$ and $44$. The same thing goes for variable $x$. The question in sto solve for every pair of integers in range from 1 to 44 that satisfy this equation. I haven't found out any easier method of doing this, so i checked every single number, and got the solutions: $(x, y) = \{ (42, 16) ; (24, 38) \} $.
Have you got any ideas how to approach problem like this one? Thanks in advance.

2

There are 2 best solutions below

1
On

I don't know what you mean by "every pair of integers in the range." At first pass, for each $x = 1 \ldots 44$, you check if $2020-x^2$ is a square. So that's 44 calculations. But wait, the problem is symmetric in $x$ and $y$, so you can assume $x\leq y$. So you need check only $x=1\ldots 22.$

But if you think mod $4$, note that the sum of two odd squares has to be of the form $4k+2$, and $2020$ is divisible by $4$, so you only need check the even $x$'s. So that's $11$ calculations.

0
On

If you know the trick from number theory, it's easy.

$2020 = 4\cdot 5\cdot 101$.

$4$ is the square of the magnitude of the complex number $2$.
$101$ is the square of the magnitude of the complex number $10 + i$.
$5$ is the square of the magnitude of the complex number $2+i$.

So $2020$ is the square of the magnitude of the complex number $2\cdot(10+i) \cdot (2 + i) = 38 + 24i$

And $2020$ is also the square of the magnitude of the complex number $2 \cdot (10+i) \cdot (1 + 2i) = 16 + 42i$.