# Does a mod change a uniform probability distribution?

Given a uniform probability distributed random variable $X$ between the interval $[0,100]$. If I construct a new random variable $Y$ as $Y = X \mod N$, with a given $N$. Will $Y$ still be uniformly distributed?

I would say yes, the only thing that will change is the interval, which will be from $[0,N]$. Am I correct?

## 2 Answers

Let $m$ be the integer with $mN\leq 100<(m+1)N$.

If $mN=100$ then the distribution of $Y=X\pmod N$ is indeed uniform on $[0,N]$. That is because for $0\leq t\leq N$, we have $$P[Y\leq t]=P[X\leq t]+P[N\leq X<N+t]+...+P[(m-1)N\leq X<(m-1)N+t]=\dfrac{t}{100}+\dfrac{t}{100}+...+\dfrac{t}{100}(m\text{ times})=\dfrac{mt}{100}=\dfrac{t}{N}$$ since $N=\dfrac{100}{m}$

If however $mN<100<(m+1)N$ then we have two cases depending on whether $mN+t>100$ or $mN+t\leq 100$.

In the former, $P[mN\leq X<mN+t]=\dfrac{100-mN}{100}$. Therefore, like the previous sum, $P[Y\leq t]=P[X\leq t]+P[N\leq X<N+t]+...+P[(m-1)N\leq X<(m-1)N+t]+P[mN\leq X<mN+t]=\dfrac{mt}{100}+\dfrac{100-mN}{100}=1-\dfrac{m(N-t)}{100}$.

In the latter, however, $P[mN\leq X<mN+t]=\dfrac{t}{100}$ and so $P[Y\leq t]=\dfrac{(m+1)t}{100}$ following above argument.

No. For example, if $N = 3$, $Y \in [0,1)$ if $X \in [0,1) \cup [3, 4) \cup \ldots \cup [99,100)$ (probability $34/100$), but $Y \in [1,2)$ if $X \in [1,2) \cup [4,5) \cup \ldots \cup [97,98)$ (only $33/100$).

• Thank you for your reply, I was wondering how the $\mod$ then would affect the distribution of $Y$. Could you maybe elaborate on that aspect? – Snowflake Dec 26 '16 at 1:49