Find all integers $x,y$ whose squares sum up to $c$ mod 5

53 Views Asked by At

Find all integers $x,y$ such that $x^2 + y^2 \equiv c \pmod{5}$.

I managed to solve by trying one-by-one, but I guess there is some other way to solve this?

1

There are 1 best solutions below

1
On

Now we have that all the squares the integers numbers with last digit $1,4,6,9$ will have last digit $ \equiv 1 \mod 5$. Same argument if the last digit is $2,3,7,8$ is $ \equiv 4 \mod 5$. And we have $ \equiv 0 \mod 5$ if the last digit is $0,5$.
Thus if
$c=0$ then $x=5k$, $y=5j$ for $k,j \in \mathbb{Z}$
$\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ x=5k+1$ or $x=5k+4$, $y=5j+2$ or $y=5j+3$ for $k,j \in \mathbb{Z}$
$c=1$ then $x=5k$, $y=5j+1$ or $y=5j+4$ for $k,j \in \mathbb{Z}$
$c=2$ then $x=5k+1$ or $x=5k+4$, $y=5j+1$ or $y=5j+4$ for $k,j \in \mathbb{Z}$
$c=3$ then $x=5k+2$ or $x=5k+3$, $y=5j+2$ or $y=5j+3$ for $k,j \in \mathbb{Z}$
$c=4$ then $x=5k$, $y=5j+2$ or $y=5j+3$ for $k,j \in \mathbb{Z}$

Since this expression in symmetric in $x$ and $y$ you can also swap $x$ and $y$