Good morning everyone,
recently i've had this type of congruence:
$ \mathsf 45x \equiv 231 mod 8 $
So i divided 45 and 231 by 8 and subbed their modulo remainder, taking me to
$ \mathsf 5x \equiv 7 mod 8 $
I compute the MDC between 8 and 5 and i know by definition that it has an inverse, which is -3, coming from
$ \mathsf 1 = 8 (2) + 5(-3) $
Now, when i multiply, i don't know when the minus signs goes away. I wrote:
$ \mathsf -15x \equiv -21 mod 8 $
But i don't know how to manage the negative sign. Could someone give me a little bit of insight (theory) ? I know it has to come positive x, but i'm not sure in general when or how to do it correctly.
In modular arithmetic you can add and subtract what you are modding by without changing the congruence. After all, adding $8$ is the same as adding $0$ in this context. Thus we have $-3=8-3=5\mod 8$. You could also note that $-15=16-15=1\mod 8$ and $-21=24-21=3\mod 8$.
Until you get more comfortable with modular arithmetic it wouldn't be a bad idea to just keep on adding what you are modding out by until everything is positive.