Modulo Operation/Examples/-2 mod 3

Theorem

 * $-2 \bmod 3 = 1$

where $\bmod$ denotes the modulo operation.

Proof
By definition of modulo operation:
 * $x \bmod y := x - y \left \lfloor {\dfrac x y}\right \rfloor$

for $y \ne 0$.

We have:
 * $\dfrac {-2} 3 = -1 + \dfrac 1 3$

and so:
 * $\left\lfloor{\dfrac {-2} 3}\right\rfloor = -1$

Thus:
 * $-2 \bmod 3 = -2 - 3 \times \left\lfloor{\dfrac {-2} 3}\right\rfloor = -2 - 3 \times \left({-1}\right) = 1$