[Math] solving negative linear congruences

discrete mathematics

OK so I know how to solve linear congruences when they're positive but negative is a different story..

I have $$ 200x\equiv 13 \pmod {1001} $$

I got the inverse as $$ -5 $$ and then I multiply both sides with the inverse to get:

$$ -1000x \equiv -65 \pmod {1001} $$

So $$ x \equiv -65 \mod {1001} $$

Is that correct? I tried to perform a check by substituting it back in the equation but it won't work 🙁

Thanks!

Best Answer

Notice that if you multiply by $5$ on both sides, you can get rid of the $200$ very quickly and save yourself the trouble of having to use the extended Euclidean algorithm. Also, your mistake is not having a negative sign on both sides of your congruence.

$200x \equiv 13 \pmod{1001} \Rightarrow 1000x \equiv 65 \pmod{1001} \Rightarrow -x \equiv 65 \pmod{1001}$.

Now, multiply both sides by $-1$:

$x \equiv -65 \pmod{1000} \equiv 936 \pmod{1001}$