# Distribution of ratio between two independent uniform random variables

Supppse $X$ and $Y$ are standard uniformly distributed in $[0, 1]$, and they are independent, what is the PDF of $Z = Y / X$?

The answer from some probability theory textbook is

$$f_Z(z) = \begin{cases} 1/2, & \text{if } 0 \le z \le 1 \\ 1/(2z^2), & \text{if } z > 1 \\ 0, & \text{otherwise}. \end{cases}$$

I am wondering, by symmetry, shouldn't $f_Z(1/2) = f_Z(2)$? This is not the case according to the PDF above.

• What is the domain of $X$ and $Y$? – Sobi Dec 8 '15 at 13:47
• en.wikipedia.org/wiki/Ratio_distribution – kjetil b halvorsen Dec 8 '15 at 13:54
• Why would you expect this to be true? The density function tells you how tightly packed the probability is in the neighborhood of a point, and it is clearly more difficult for $Z$ to be near $2$ than $1/2$ (consider for instance that $Z$ can always be $1/2$ no matter what $X$ is, but $Z < 2$ when $X > 1/2$). – dsaxton Dec 8 '15 at 14:06
• Possible duplicate of Distribution of a ratio of uniforms: What is wrong? – Xi'an Dec 8 '15 at 14:21
• I don't think it's a duplicate, that question is seeking the PDF, here I have the PDF, I am just questioning its correctness (perhaps rather naively). – qed Dec 8 '15 at 14:29

The right logic is that with independent $X, Y \sim U(0,1)$, $Z=\frac YX$ and $Z^{-1} =\frac XY$ have the same distribution and so for $0 < z < 1$ \begin{align} P\left\{\frac YX \leq z\right\} &= P\left\{\frac XY \leq z\right\}\\ &= P\left\{\frac YX \geq \frac 1z \right\}\\ \left.\left.F_{Z}\right(z\right) &= 1 - F_{Z}\left(\frac 1z\right) \end{align} where the equation with CDFs uses the fact that $\frac YX$ is a continuous random variable and so $P\{Z \geq a\} = P\{Z > a\} = 1-F_Z(a)$. Hence the pdf of $Z$ satisfies $$f_Z(z) = z^{-2}f_Z(z^{-1}), \quad 0 < z < 1.$$ Thus $f_Z(\frac 12) = 4f_Z(2)$, and not $f_Z(\frac 12) = f_Z(2)$ as you thought it should be.

This distribution is symmetric--if you look at it the right way.

The symmetry you have (correctly) observed is that $Y/X$ and $X/Y = 1/(Y/X)$ must be identically distributed. When working with ratios and powers, you are really working within the multiplicative group of the positive real numbers. The analog of the location invariant measure $d\lambda=dx$ on the additive real numbers $\mathbb{R}$ is the scale invariant measure $d\mu = dx/x$ on the multiplicative group $\mathbb{R}^{*}$ of positive real numbers. It has these desirable properties:

1. $d\mu$ is invariant under the transformation $x\to ax$ for any positive constant $a$: $$d\mu(ax) = \frac{d(ax)}{ax} = \frac{dx}{x} = d\mu.$$

2. $d\mu$ is covariant under the transformation $x\to x^b$ for nonzero numbers $b$: $$d\mu(x^b) = \frac{d(x^b)}{x^b} = \frac{b x^{b-1} dx}{x^b} = b\frac{dx}{x} = b\, d\mu.$$

3. $d\mu$ is transformed into $d\lambda$ via the exponential: $$d\mu(e^x) = \frac{de^x}{e^x} = \frac{e^x dx}{e^x} = dx = d\lambda.$$ Likewise, $d\lambda$ is transformed back to $d\mu$ via the logarithm.

(3) establishes an isomorphism between the measured groups $(\mathbb{R}, +, d\lambda)$ and $(\mathbb{R}^{*}, *, d\mu)$. The reflection $x \to -x$ on the additive space corresponds to the inversion $x \to 1/x$ on the multiplicative space, because $e^{-x} = 1/e^x$.

Let's apply these observations by writing the probability element of $Z=Y/X$ in terms of $d\mu$ (understanding implicitly that $z \gt 0$) rather than $d\lambda$:

$$f_Z(z)\,dz = g_Z(z)\,d\mu = \frac{1}{2}\begin{cases} 1\,dz = z\, d\mu, & \text{if } 0 \le z \le 1 \\ \frac{1}{z^2}dz = \frac{1}{z}\, d\mu, & \text{if } z > 1. \end{cases}$$

That is, the PDF with respect to the invariant measure $d\mu$ is $g_Z(z)$, proportional to $z$ when $0\lt z \le 1$ and to $1/z$ when $1 \le z$, close to what you had hoped.

This is not a mere one-off trick. Understanding the role of $d\mu$ makes many formulas look simpler and more natural. For instance, the probability element of the Gamma function with parameter $k$, $x^{k-1}e^x\,dx$ becomes $x^k e^x d\mu$. It's easier to work with $d\mu$ than with $d\lambda$ when transforming $x$ by rescaling, taking powers, or exponentiating.

The idea of an invariant measure on a group is far more general, too, and has applications in that area of statistics where problems exhibit some invariance under groups of transformations (such as changes of units of measure, rotations in higher dimensions, and so on).

• Looks like a very insightful answer. It's a pity I don't understand it at the moment. I will check back later. – qed Dec 8 '15 at 16:40

If you think geometrically...

In the $X$-$Y$ plane, curves of constant $Z = Y/X$ are lines through the origin. ($Y/X$ is the slope.) One can read off the value of $Z$ from a line through the origin by finding its intersection with the line $X=1$. (If you've ever studied projective space: here $X$ is the homogenizing variable, so looking at values on the slice $X=1$ is a relatively natural thing to do.)

Consider a small interval of $Z$s, $(a,b)$. This interval can also be discussed on the line $X=1$ as the line segment from $(1,a)$ to $(1,b)$. The set of lines through the origin passing through this interval forms a solid triangle in the square $(X,Y) \in U = [0,1]\times[0,1]$, which is the region we're actually interested in. If $0 \leq a < b \leq 1$, then the area of the triangle is $\frac{1}{2}(1-0)(b-a)$, so keeping the length of the interval constant and sliding it up and down the line $X=1$ (but not past $0$ or $1$), the area is the same, so the probability of picking an $(X,Y)$ in the triangle is constant, so the probability of picking a $Z$ in the interval is constant.

However, for $b>1$, the boundary of the region $U$ turns away from the line $X = 1$ and the triangle is truncated. If $1 \leq a < b$, the projections down lines through the origin from $(1,a)$ and $(1,b)$ to the upper boundary of $U$ are to the points $(1/a,1)$ and $(1/b,1)$. The resulting area of the triangle is $\frac{1}{2}(\frac{1}{a} - \frac{1}{b})(1-0)$. From this we see the area is not uniform and as we slide $(a,b)$ further and further to the right, the probability of selecting a point in the triangle decreases to zero.

Then the same algebra demonstrated in other answers finishes the problem. In particular, returning to the OP's last question, $f_Z(1/2)$ corresponds to a line that reaches $X=1$, but $f_Z(2)$ does not, so the desired symmetry does not hold.

Just for the record, my intuition was totally wrong. We are talking about density, not probability. The right logic is to check that

$$\int_1^k f_Z(z) dz = \int_{1/k}^1 f_Z(z) = \frac{1}{2}(1 - \frac{1}{k})$$,

and this is indeed the case.

Yea the link Distribution of a ratio of uniforms: What is wrong? provides CDF of $Z=Y/X$. The PDF here is just derivative of the CDF. So the formula is correct. I think your problem lies in the assumption that you think Z is "symmetric" around 1. However this is not true. Intuitively Z should be a skewed distribution, for example it is useful to think when Y is a fixed number between $(0,1)$ and X is a number close to 0, thus the ratio would be going to infinity. So the symmetry of distribution is not true. I hope this help a bit.