# Why doesn't -101 mod 13 = 10?

Following the formula found here (r = a - (a/b)b) I have been successfully finding the remainder for several problems, but when I try to solve -101 mod 13, I get the answer 10 even though it should apparently be 3.

101/13 = 7.769, ignore everything after the .
13 * 7 = 91
101 - 91 = 10

Am I missing something obvious here?

• The positive remainder of (for example) $-15$ when divided by $13$ is $11$, because the multiple of $13$ less than or equal to $-15$ is $-26$. – Joffan Dec 11 '17 at 5:57
• The obvious thing you missed is the negative sign. – Matthew Leingang Dec 11 '17 at 5:59

$$-101=-13\cdot7-10=-8\cdot13+3$$

So, the minimum positive remainder is $3$

Well in modular arithmetic if $a \equiv b \pmod m$ then $-a \equiv \ -b \pmod m$

Since $101$ is congruent to $10 \pmod {13}$ $(101 = 13 \times 7 + 10)$ then $-101$ is congruent to $-10 \pmod{ 13}$

However, the remainder mod m is defined as a non-negative integer $r$ in the interval $[0,m-1]$

So we just add 13 to get $-101 \equiv -10+13 \equiv 3 \pmod {13}$

$101 \equiv 10 \bmod 13$

Therefore $-101 \equiv -10 \equiv 3 \bmod 13$