[Math] Solving a system of equations using modular arithmetic modulo 5

elementary-number-theorymodular arithmetic

Give the solution to the following system of equations using modular arithmetic modulo 5:

$4x + 3y = 0 \pmod{5}$
$2x + y \equiv 3 \pmod{5}$

I multiplied $2x + y \equiv 3 \pmod 5$ by $-2$, getting $-4x – 2y \equiv -6 \pmod{5}$.

$-6 \pmod{5} \equiv 4 \pmod 5$

Then I added the two equations:

$4x + 3y \equiv 0 \pmod{5}$
$-4x – 2y \equiv 4 \pmod{5}$

This simplifies to $y \equiv 4 \pmod{5}$.

I then plug this into the first equation: $4x + 3(4) = 0 \pmod{5}$

Wrong work:

Thus, $x = 3$.
But when I plug the values into the first equation, I get $2(3) + 4 \not\equiv 3 \pmod{5}$.
What am I doing wrong?

EDIT:

Revised work:

$x = -3 \pmod{5} = 2 \pmod{5}$.
Now when I plug the values into the first equation, I get $2(2) + 4 \equiv 8 \pmod{5} \equiv 3 \pmod{5}$.

Best Answer

There's also a "cheats" method available here. There are only $25$ possible values of $(x,y) \in (\mathbb{Z}_5)^2$. We can just check them one-by-one, and see which ones work.

We could do this by hand, or on a computer. In GAP:

for x in [0..4] do
  for y in [0..4] do
    if((4*x+3*y) mod 5=0 and (2*x+y) mod 5=3) then
      Print([x,y],"\n");
    fi;
  od;
od;

returns the single solution $(x,y)=(2,4)$.

Related Question