Definition:Modulo Operation

Definition
Let $x, y \in \R$ be real numbers.

Then the operation $\bmod$ is defined as:
 * $x \bmod y := \begin{cases}

x - y \left \lfloor {\dfrac x y}\right \rfloor & : y \ne 0 \\ x & : y = 0 \end{cases}$

From the definition of the floor function, we see that, when $y \ne 0$:


 * $\displaystyle 0 \le \frac x y - \left \lfloor {\frac x y}\right \rfloor = \frac {x \bmod y} y < 1$.

Hence:
 * $y > 0 \implies 0 \le x \bmod y < y$
 * $y < 0 \implies 0 \ge x \bmod y > y$
 * $x - \left({x \bmod y}\right)$ is an integral multiple of $y$.

The operation is most usually defined when $x$ and $y$ are both integers.

From the Quotient-Remainder Theorem it follows that the quantity $x \bmod y$ is called the remainder when $x$ is divided by $y$. This still holds when $x$ and $y$ are not actually integers.

The value $\left \lfloor {\dfrac x y}\right \rfloor$ is called the quotient.

Modulo Zero
We see that, from the definition:

Modulo 1
Note also that from the definition:

Also see
Compare with congruence modulo $z$ which approaches the subject from a slightly different direction.