Derive the distribution of $Z$ given two identically and independently exponentially r.v.s? $$Z=\frac{X}{X+Y}$$
$(X,Y)$ are iid r.v.s with $$f(x)=\lambda e^{-\lambda x}$$
We are asked to condition on $Y$ to derive the distribution of $Z$; $F(t)$ and $f_Z(z)$.

I don't know where to start, exactly. Is this a transformation? I don't know what it means to "condition on" a variable. 
 A: If $Y = y$ for some fixed $y$, then what is the distribution of $Z \mid Y = \frac{X}{X+y}$?  How would you find this out?  Is $g(X) = X/(X+y)$ a monotone function over its support?  Could you use $$f_Z(z) = f_X(g^{-1}(z)) \left|\frac{dg^{-1}}{dz}\right|?$$
If you know the conditional density, how would you find the unconditional density?  Does something like this:  $$f_Z(z) = \int_{y \in \Omega} f_{Z\mid Y}(z\mid y) f_Y(y) \, dy$$ look familiar?  What is the meaning of $y \in \Omega$?
Is the result surprising?  Does it suggest that perhaps there is a different way to reason about the distribution of $Z$?  What if $X$ and $Y$ were exponential with unequal parameters?  Or, what if you wanted to calculate the distribution of $$Z = \frac{X_1}{X_1 + X_2 + \cdots + X_n}, \quad X_i \sim \operatorname{Exponential}(\lambda)?$$  In fact, what is the distribution of $$Z_{a,b} = \frac{X_1 + \cdots + X_b}{X_1 + \cdots + X_{a+b}}, \quad X_i = \operatorname{Exponential}(\lambda)?$$

Okay, so you should have $$Z \mid (Y = y) = g(X) = X/(X+y), \quad g^{-1}(z) = \frac{y z}{1-z}.$$  Consequently, $$\left|\frac{dg^{-1}}{dz}\right| = \frac{y}{(1-z)^2}.$$  Note we do not need absolute values because $y > 0$, and the denominator, being a square, is never negative.  Now what is the support of $Z$?  The key observation is that when $X$ is close to $0$, $Z$ is also close to $0$; but as $X \to \infty$ for a fixed $Y$, then $Z \to 1$.  So the support should be $0 < Z < 1$.
Now, we have $$f_{Z \mid Y}(z \mid y) = \lambda e^{-\lambda yz/(1-z)} \cdot \frac{y}{(1-z)^2}, \quad 0 < z < 1,$$ so the unconditional density is $$\begin{align*} f_Z(z) &= \int_{y = 0}^\infty \lambda e^{-\lambda y z/(1-z)} \frac{y}{(1-z)^2} \lambda e^{-\lambda y} \, dy \\ &= \frac{\lambda^2}{(1-z)^2} \int_{y=0}^\infty y \exp \left(-\lambda y \left( \tfrac{z}{(1-z)} + 1\right)\right) \, dy \\ &= \frac{\lambda^2}{(1-z)^2} \cdot \frac{1-z}{\lambda} \int_{y=0}^\infty y \frac{\lambda}{1-z} e^{-\lambda y/(1-z)} \, dy \\ &= \frac{\lambda}{1-z} \cdot \operatorname{E}[Y^*] \\ &= 1, \quad 0 < z < 1,\end{align*}$$ where we recognize the last integral as the expectation of an exponential random variable $Y^*$ with parameter $\lambda^* = \lambda/(1-z)$, thus $\operatorname{E}[Y^*] = (1-z)/\lambda$.  Consequently, $Z \sim \operatorname{Uniform}(0,1)$.
