Modulo Operation/Examples/-2 mod -3

From ProofWiki
Jump to navigation Jump to search

Theorem

$-2 \bmod -3 = -2$

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} = 0 + \dfrac 2 3$

and so:

$\left\lfloor{\dfrac {-2} {-3} }\right\rfloor = 0$


Thus:

\(\displaystyle -2 \bmod -3\) \(=\) \(\displaystyle -2 - \left({-3}\right) \times \left\lfloor{\dfrac {-2} {-3} }\right\rfloor\)
\(\displaystyle \) \(=\) \(\displaystyle -2 - \left({-3}\right) \times 0\)
\(\displaystyle \) \(=\) \(\displaystyle -2\)

$\blacksquare$


Sources