The connection between quotient, remainder, modulo and floor functions motivates the following generalization of congruences:
Using the definition of the floor function, we define for any two real numbers \(x,y\) with \(y\neq 0\) the modulo operation "\(\operatorname{mod}\)" as follows:
\[x\mod y:=x-y\cdot \left\lfloor \frac xy \right\rfloor.\]
This definition leaves the case \(y=0\) undefined, in order to avoid division by zero. For \(y=0\), we set1
\[x\mod 0:=x.\]
The number \(y\) after "\(\operatorname{mod}\)" is called the modulus.
In the following interactive figure you can study the graph of \(x\mod y\) by manipulating the value of \(y\):
Examples: 1
This convention preserves the property that \(x\operatorname{mod}y\) always differs from \(x\) by a multiple of \(y\). ↩