Modulo Operation/Examples/-100 mod 7

From ProofWiki
Jump to navigation Jump to search

Theorem

$-100 \bmod 7 = 5$

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 {-100} 7 = -15 + \dfrac 5 7$

and so:

$\left\lfloor{\dfrac {-100} 7}\right\rfloor = -15$


Thus:

\(\displaystyle -100 \bmod 7\) \(=\) \(\displaystyle -100 - 7 \times \left\lfloor{\dfrac {-100} 7}\right\rfloor\)
\(\displaystyle \) \(=\) \(\displaystyle -100 + 7 \times 15\)
\(\displaystyle \) \(=\) \(\displaystyle 5\)

$\blacksquare$


Sources