# Distribution of a ratio of uniforms: What is wrong?

Suppose that $X$ and $Y$ are two i.i.d. uniform random variables on the interval $[0,1]$

Let $Z=X/Y$, I am finding the cdf of $Z$, i.e. $\Pr(Z\leq z)$.

Now, I came up with two ways of doing this. One produces a correct answer consistent with the pdf here: http://mathworld.wolfram.com/UniformRatioDistribution.html, the other does not. Why is the second method wrong?

First Method

$\newcommand{\rd}{\mathrm{d}} \Pr(Z\leq z) = \Pr(X/Y\leq z) = \Pr(X\leq zY) = \int^{1}_{0}\int^{\min(1,zy)}_{0} \rd x \rd y = \int^{1}_{0}\min(1,zy)\ \rd y$ $= \left\{ \begin{array}{lr} \int^{1/z}_{0}zy\ \rd y + \int^{1}_{1/z} \rd y& : z > 1\\ \int^{1}_{0}zy\ \rd y & : z \leq 1 \end{array} \right.$ $= \left\{ \begin{array}{lr} 1 - \frac{1}{2z} & : z > 1\\ \frac{z}{2} & : z \leq 1 \end{array} \right.$

This appears correct.

Second Method

$\Pr(X/Y\leq z) = \Pr(X \leq zY\ |\ zY \geq 1)\Pr(zY \geq 1) + \Pr(X \leq zY\ |\ zY < 1)\Pr(zY < 1)$ by total probability

$= \Pr(X \leq zY\ |\ zY \geq 1)\Pr(Y \geq 1/z) + \Pr(X \leq zY\ |\ zY < 1)\Pr(Y < 1/z)$

Taking $z>1$ yields $(1)(1-\frac{1}{z}) + (\int^{1/z}_{0}\int^{zy}_{0} \rd x \rd y)(\frac{1}{z}) = 1-\frac{1}{z} + (\int^{1/z}_{0}zy\ \rd y)(\frac{1}{z}) = 1-\frac{1}{z} + \frac{1}{2z^{2}}$

This is already different. Why is this wrong?

Thanks!

Here is a hint.

Consider carefully the term $\mathbb P( X \leq z Y \mid z Y < 1 )$. In particular, for concreteness, choose $z = 2$, so that we are considering the event $\mathbb P( X \leq 2 Y \mid Y < 1/2 )$.

Now, look at this picture (which is very closely related to the above probability). Now, does that conditional probability depend on our particular choice of $z$?

• I guess the more formal description of the picture is: Let $R = zY$ we can see that the pdf for $R$ is $1/z$ so $\Pr(X \leq R \wedge R < 1) = \int^{1}_{0}\int^{r}_{0} 1/z\ dx\ dr = \frac{1}{2z}$ But I still do not understand why setting the integral up as I did before does not work. Even if the value of z plays no real role, why does setting x's integral limit to zy and then setting y's integral limit to 1/z not rectify this? Sep 14, 2011 at 2:25
• Ah, ok I think maybe I got it. So we are going to have this contracted region {(x,y) : y < 1/z} on the unit square, then we are going to expand that very region by z so {(x,y) : y < z/z}. I.e. all the unit square again. The region where x<y is 1/2. But how do we formalize this intuition mathematically; i.e. following this contract, expand route formally? And what are some tips for avoid these types of mistakes? Sep 14, 2011 at 2:58
• @Junier Drawing a picture often helps :-).
– whuber
Sep 14, 2011 at 4:39
• +1 @whuber. When in doubt, draw a picture. This seems to invariably clarify problems I'm having. Sep 14, 2011 at 5:12
• It depends on how formally you want to formalize this mathematically. First note that $\int_0^{1/z} \int_{0}^{zy} \mathrm{d}x \mathrm{d}y$ is the joint probability $\mathbb P(0 \leq X \leq zY, 0 \leq Y \leq 1/z)$, not the conditional probability you were trying to calculate. This is a pretty common mistake. Note that dividing what you have by $\mathbb P(0 \leq Y \leq 1/z) = 1/z$ recovers the correct answer. (This is just Bayes' rule.) Sep 14, 2011 at 9:06