Product Distributes over Modulo Operation

From ProofWiki
Jump to navigation Jump to search

Theorem

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

Let $x \bmod y$ denote the modulo operation.

Then:

$z \paren {x \bmod y} = \paren {z x} \bmod \paren {z y}$


Proof

By definition of modulo operation:

$x \bmod y := \begin {cases}

x - y \floor {\dfrac x y} & : y \ne 0 \\ x & : y = 0 \end {cases}$

If $y = 0$ we have that:

$z \paren {x \bmod 0} = z x = \paren {z x} \bmod \paren {z 0}$


If $y \ne 0$ we have that:

\(\ds z \paren {x \bmod y}\) \(=\) \(\ds z x - z y \floor {\frac x y}\)
\(\ds \) \(=\) \(\ds z x - z y \floor {\frac {z x} {z y} }\)
\(\ds \) \(=\) \(\ds \paren {z x} \bmod \paren {z y}\) Definition of Modulo Operation

$\blacksquare$


Sources