Finding density of a function of i.i.d. R.V.s I'm finding it difficult to understand the explanation for my problem's solution, I would like to post it here so maybe one of you could enlight my understanding.
Just to clarify, I'm studying for a Probability test and I'm stuck at this exercise (and I'm pretty bad with functions of R.V.s), so the Homework tag is just to let it clear that I'm looking for something for dummies :/
Problem is: Given two i.i.d., exponential with $\lambda = 4$ R.V.s, X and Y, find the p.d.f. of $Z = \frac{X}{X+Y}$
Thanks in advance.
 A: Here is a systematic way.


*

*By definition, for every measurable bounded function $u$,
$$
\mathrm E(u(X,Y))=\iint16\mathrm e^{-4x-4y}u(x,y)\,[x\geqslant0,y\geqslant0]\,\mathrm dx\mathrm dy.
$$

*In particular,
$$
\mathrm E(u(Z))=\iint16\mathrm e^{-4(x+y)}u\left(\frac{x}{x+y}\right)\,[x\geqslant0,y\geqslant0]\,\mathrm dx\mathrm dy.
$$

*Consider the change of variable $x=zs$, $y=(1-z)s$. Thus, $\mathrm dx\mathrm dy=s\mathrm ds\mathrm dz$ with $s\geqslant0$ and $0\leqslant z\leqslant1$, and
$$
\mathrm E(u(Z))=\iint16\mathrm e^{-4s}u(z)\,[s\geqslant0,0\leqslant z\leqslant1]\,s\mathrm ds\mathrm dz=\int u(z)f(z)\,\mathrm dz,
$$
with
$$
f(z)=\int16\mathrm e^{-4s}\,[s\geqslant0,0\leqslant z\leqslant1]\,s\mathrm ds=[0\leqslant z\leqslant1]\,\int_0^{+\infty}16\mathrm e^{-4s}\,s\mathrm ds=[0\leqslant z\leqslant1].
$$

*This holds for every bounded measurable function $u$ hence $Z$ is uniform on $(0,1)$.

A: One first finds the cumulative distribution function: $S_Z(z) = \mathbb{P}\left( \frac{X}{X+Y} > z \right)$. Clearly $S_Z(z) = 0$ for all $ z \geqslant 1$, and $S_Z(z) = 1$ for $z \leqslant 0$, hence assume $0<z<1$. Then:
$$
  S_Z(z) = \mathbb{P}\left( X > z X + z Y \right) = \mathbb{P} \left( (1-z) X > z Y \right) = \mathbb{P} \left( X > \frac{z}{1-z} Y \right) = \mathbb{E}\left( \mathbb{P} \left( X > \frac{z}{1-z} Y |Y \right) \right) = \mathbb{E}\left( \exp\left(- \lambda \frac{z}{1-z} Y\right) \right) = \int_0^\infty \lambda  \exp\left(- \lambda \frac{z}{1-z} y\right) \exp(-\lambda y) \mathrm{d} y = \frac{1}{1+ \frac{z}{1-z}} = 1 - z
$$
This proves that $Z$ is a uniform random variable.
