# What is the distribution of $PX/(PX+(1-P)Y)$ if $P$ is uniform and $X,Y$ are exponential?

Suppose $X,Y$ are exponentially distributed with $\lambda =1$ and $P$ is uniformly distributed on $(0,1)$. All random variables are independent. What is the distribution of $$Z=\frac{PX}{PX+(1-P)Y}?$$

It is known (see f.i. MSE:ratio) that the distribution of $$Z=\frac{X}{X+Y}$$ is uniform, but I am adding the complication that the ratio deals with products of one uniform and one exponential.

Mirroring the answer from @eeeeeeeeee in MSE:ratio) , I have obtained the conditional distribution for $U:=(Z|P=p)$ as follows. Let $$U = \frac{pX}{pX+(1-p)Y} \qquad \mbox{and} \qquad V=pX+ (1-p)Y$$ Then $$x(u,v)=\frac{uv}{p} \qquad \mbox{and} \qquad y(u,v)=\frac{v-uv}{1-p}$$ The determinant of the Jacobian of the transformation is $$\left| \begin{matrix} \frac{v}{p} & \frac{u}{p}\\ -\frac{v}{1-p} & \frac{1-u}{1-p} \end{matrix} \right|= \frac{v}{p-p^2}$$ So the joint pdf of $U$ and $V$ is $$f_{U,V}(u,v)=f_{X,Y}\left( \frac{uv}{p},\frac{v-uv}{1-p} \right)\left| \frac{v}{p-p^2}\right|=\frac{ve^{-cv}}{p-p^2}$$ for $v\geq 0$ and $0 \leq u\leq1$, where $$c = \frac{u(1-p)+p(1-u)}{p-p^2}$$ Recall that $c^2 v e^{-cv}$ is the density of a Gamma distribution with shape parameter 2 and rate parameter $c$; then integrate out the $v$ to obtain the marginal pdf of $U$ as $$f_U(u)=\int_0^{\infty}f_{U,V}(u,v)dv=\int_0^{\infty}ve^{-v}dv=\frac{1}{c^2} \frac{1}{p-p^2}\qquad \text{for } 0\leq u\leq 1$$ Replace $c$ from above to get $$f_{Z|p}(z)=\frac{1}{c^2} \frac{1}{p-p^2} = \frac{p-p^2}{[z(1-p)+p(1-z)]^2}$$ To derive the distribution of $Z$, one still needs to solve $$f_Z(z) = \int_0^1 f_{Z|p}(z) \, \mbox{d}p = \int_0^1 \frac{p-p^2}{[z(1-p)+p(1-z)]^2} \, \mbox{d}p$$

Is there a closed form for this integral?

• Did you try doing a partial fraction decomposition? – user159517 Nov 18 '17 at 12:04

## 1 Answer

To derive the distribution of $Z$, we need to compute $$f_Z(z) = \int_0^1 f_{Z|p}(z) \, \mbox{d}p = \int_0^1 \frac{p-p^2}{[z(1-p)+p(1-z)]^2} \, \mbox{d}p$$ Following a hint from the comments, we use partial fraction decomposition and obtain that the indefinite integral with respect to $p$ is $$I(p) = \frac{z-z^2}{(1-2z)^3(z+p-2pz)} - \frac{p (1-2z)}{(1 - 2z)^3} + \frac{\ln (2pz-p-z)}{(1 - 2z)^3}$$ So we obtain $$\int_0^1 \frac{p-p^2}{[z(1-p)+p(1-z)]^2} \, \mbox{d}p = \left[ I(p) \strut \right]_0^1 = \frac{2 -4z + \ln \left( \frac{z}{1-z} \right)}{(2z-1)^3}$$ The density function $f_Z(z)$ is $U$-shaped and symmetric around $1/2$.