# Uniform random variable distribution

This is a homework problem out of the book. It says

If $U$ is a uniform random variable on [0,1], what is the distribution of the random variable $X = [nU]$, where [$t$] denotes the greatest integer less than or equal to $t$?

There is a second part that says

Do this for $n = 10$. True or false, and explain: “Random digit” is a good name for the random variable $X$

I don't even know where to begin. All the book says about Uniform Distribution is that uniform density is $f(x) = 1, 0 \le x \le 1$. What does $t$ represent and how do I start this problem?

• Presumably $n$ is supposed to be a positive integer. One minor point is that is possible to achieve the value $n$, if $U=1$, but that the probability of doing so is $0$. – Henry May 8 '11 at 0:03
• @Henry The question makes sense for any real $n$, not just positive integers! – whuber May 8 '11 at 13:59
• @whuber:You are correct in general, but I still suspect my "presumably" is what was intended. – Henry May 8 '11 at 15:32

$[t]$ is the floor function, and $t$ just represents a generic argument. So for example $[0.5]=0$, $[0.9]=0$, $[1.01]=1$, $=1$, $[23.567]=23$, and so on. You simply ignore whats written after the decimal point (note: this is not the same thing as rounding, for $[0.9]=0$ whereas rounding would give $1$.)

With non-smooth functions such as the floor function, the safest way to go is to use the cumulative distribution function, or CDF. For the uniform distribution this is given by:

$$F_{U}(y)=\Pr(U<y)=\int_{0}^{y}f_{U}(t)dt=\int_{0}^{y}dt=y$$

Now the good thing about CDFs is that you can simply substitute the functional relation in, but only once you have inverted the floor function. Now this inversion is not 1-to-1, so a standard change of variables using jacobian's doesn't apply. For example, suppose $X=0$. Then we know that $[nU]=0$, which means that $nU<1$, which implies that $U<n^{-1}$. We can work out this probability directly from the CDF:

$$\Pr(X=0)=\Pr(U<n^{-1})=F_{U}(n^{-1})=n^{-1}$$

The reason we can do this is that the two propositions " $X=0$ " and " $U<n^{-1}$ " are equivalent - one occurs if and only if the other occurs. So they must have the same "truth value" and hence also the same probability.

This is not too hard to continue on. Suppose $X=1$, then we must have $nU<2$ (or else $X>1$) and we must also have $nU>1$ (or else $X=0$ as we have just seen). So the equivalent condition to $X=1$ in terms of $U$ is $1<nU<2$. I'll stop my answer here so you can work out the general form of the probability mass function for $X$ ($\Pr(X=z)$ for general argument $z$).

One small hint is to note that $\Pr(a<U<b)=\Pr(U<b)-\Pr(U<a)=b-a$ for a uniform distribution.

I can post the full answer if you wish, but you may not learn as well compared to if you do it yourself.

• I didn't realize that square brackets represent the floor function. Doesn't the [0,1] represent the interval? I'm still confused as to how to answer. The distribution for U is between 0 and 1 and nothing outside of that. So does that mean the distribution for X is between 1 and 2? How do I answer this? – styfle May 8 '11 at 20:54
• This is as far as I got: When the random variable $X=x, x/n \le U \lt (x+1)/n$. Is that the answer? – styfle May 8 '11 at 21:41
• @styfle - pretty much - now you just use my hint to get the probability that $X=x$ – probabilityislogic May 8 '11 at 21:48
• @probabilityislogic Sorry I don't follow. What do you mean "get the probability that X = x"? – styfle May 8 '11 at 22:37
• $Pr(X=x)=Pr(\frac{x}{n}\leq U < \frac{x+1}{n})$. But from the hint, $Pr(a<U<b)=b-a$ so we get $Pr(X=x)=\frac{x+1}{n}-\frac{x}{n}=\frac{1}{n}$. – probabilityislogic May 9 '11 at 11:23

$t$ is just a placeholder name for a variable, the actual focus in that explanation is on the square brackets which refer to the floor function.

I would start by plotting the function that maps from $U$ to $X$, that is $X(u)=[nu]$ in the range of all the values $U$ can assume. What does the set of possible function values (i.e. the image of the function) look like? How big are their relative proportions regarding their preimages? That should give you a clue how to get the distribution function of $X$.