# Calculating the distribution of a compound random variable

Given $X\sim U(1, 0)$ and $Y\sim Exp(1)$, determine the density function of $Z:=\frac{X}{Y}$.

Now, without looking up how to do it I tried to figure it out myself.

The value of the density function $f_X(x)$ is the continuous analog of the probability that $X=x$, right? I realize that $\mathbb P(X=x)=0$ fore every $x$, but it seemed so far that reasoning about random variables this way produced correct results. Also, the continuous analog of a sum is an integral.

Now, $f_Z(z)=f_\frac{X}{Y}(z)$. There is an infinite number of ways that the quotient of $X$ and $Y$ could produce $z$ so I integrated over all of them like this $\int_{-\infty}^{+\infty}f_X(x)f_Y(x/z)dx$. Now, since $f_X$ is zero everywhere but on $[0,1]$ where it's one, the integral becomes $\int_0^1f_Y(x/z)dx=z(1-e^{-1/z})$. This all seemed logical to me but then I tried the reverse. Integrating over the possible values of $Y$ and then making $X$ match them.

$\int_{-\infty}^{+\infty}f_Y(y)f_X(zy)dy=\int_0^{+\infty}e^{-y}f_X(zy)dy=\int_0^{1/z}e^{-y}dy=1-e^{-1/z}$

Why doesn't this give the same result? I'm really hoping that I didn't just make a simple calculation mistake. Actually, maybe I'm hoping I did just that so my method can be salvaged.

I would appreciate any insight.

• What is B(1,0)? B is for Beta, Bradford, Binomial, Birnbaum, Bettyboop ... – wolfies Apr 28 '15 at 11:06
• @wolfies Oh sorry. That was supposed to be $U$. For uniform. – Luka Horvat Apr 28 '15 at 11:06

The ratio distribution is evaluated by the integral: \begin{align} f_Z(z) & = f_{X/Y}(z) \\ & = \int_\Bbb R \lvert y\rvert f_X(yz)f_Y(y)\operatorname d y \\ & = \int_0^{1/z} y e^{-y} \operatorname d y \\ & = 1-e^{-1/z} (\tfrac 1 z + 1) \end{align}
\begin{align} P(Z\leq z) & = P(X \leq Yz) \\ & = \int_0^\infty\int_{0}^{\min(yz,1)} e^{-y}\operatorname d x\operatorname d y \\ & = \int_0^{1/z} e^{-y}\int_0^{yz} 1\operatorname d x\operatorname d y + \int_{1/z}^\infty e^{-y}\int_0^1 1\operatorname d x\operatorname dy \\ & = z\int_0^{1/z} ye^{-y}\operatorname d y + \int_{1/z}^\infty e^{-y}\operatorname dy \\ & = \left(z-e^{-1/z} (z+1)\right) +\left(e^{-1/z}\right) \\ & = z(1-e^{-1/z}) \\[2ex] f_Z(z) & = \frac{\mathrm d}{\mathrm d z}\Big(P(Z\leq z)\Big) \\ & = 1-(1+\tfrac 1 z)e^{-1/z} \end{align}
In general, when $X>0,Y>0$: \begin{align}f_Z(z) & = \frac{\mathrm d}{\mathrm d z} \int_0^\infty\int_0^{yz} f(x,y)\operatorname d x\operatorname d y \\ & = \int_0^\infty y f(zy,y)\operatorname d y\end{align}
• It seems like the formula is what I had in my second attempt with the extra $|y|$ in it. Is there an intuitive explanation? – Luka Horvat Apr 28 '15 at 12:56