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 \floor {\dfrac x y}$

for $y \ne 0$.


We have:

$\dfrac {-2} {-3} = 0 + \dfrac 2 3$

and so:

$\floor {\dfrac {-2} {-3} } = 0$


Thus:

\(\ds -2 \bmod -3\) \(=\) \(\ds -2 - \paren {-3} \times \floor {\dfrac {-2} {-3} }\)
\(\ds \) \(=\) \(\ds -2 - \paren {-3} \times 0\)
\(\ds \) \(=\) \(\ds -2\)

$\blacksquare$


Sources