How do we calculate $-13$ mod $40$ to get $27$?
My though process is:
$40/-13 = -3$
$-3 \cdot( -13) = 39 $
$40 - 39 = 1 $
I'm getting the answer as $1$!
How do we calculate $-13$ mod $40$ to get $27$?
My though process is:
$40/-13 = -3$
$-3 \cdot( -13) = 39 $
$40 - 39 = 1 $
I'm getting the answer as $1$!
On
Instead of thinking about mod as an operator, you should think about it as an equivalence relation.
Two numbers are equivalent mod 40 if their difference is a multiple of 40.
So, for example, 111 and 191 are equivalent mod 40 because their difference is 80, which is 2*40.
If you start with any number and add/subtract 40 repeatedly, you end up with all of the equivalent numbers.
So 111 is equivalent to 151, 191, ... but also 111-40= 71, 71-40=31, 31-40= -9, -49, etc.
Now it is a theorem (the quotient remainder theorem) that every integer $n$ can be expressed uniquely in the form $n=40q+r$ with $0\leq r < 40$. This shows that every $n$ is equivalent mod 40 to a unique $r$ coming from the list $0,1,2,3,...,39$. This is what you have been thinking of "mod" as meaning: finding this unique representative. When we look at our list above, we can see that 111 was equivalent to 31.
Notice how much easier it is to see that 111 is equivalent to 191 when you take my perspective, instead of having to divide both numbers by 40 and find that their remainders are equal to 31!
You should now easily see why -13 is equivalent to 27 mod 40. Just add 40 to -13 to get 27!
$40/(-13)$ is what you would do to calculate $40$ modulo $-13$.
Here you should do the reverse:
$-13/40 = -1$
$-1 \times 40 = -40$
$-13-(-40)=27$