Finding pdf with more than one random variable I am stuck with a question doing one of my stats tutorial and question is as follows:
Suppose X and Y are two independent exponential random variables with parameter $\theta$, i.e. their joint probability density function is 
$f(x,y; \theta) = \frac{1}{\theta^2}e^\frac{-(x+y)}\theta, x\geq0, y\geq0$
where parameter $\theta >0$.
Find the probability density function of $Z = \frac{X}{X+Y}$
Can anyone kindly guide me with this question please? I'm not exactly sure how to begin. Thank you!
 A: A common method is to find CDF, then differentiate:
$$F_Z(z)=P(Z \leq z) = P(\frac{X}{X+Y}\leq z) = P(\frac{1-z}{z}X\leq Y)$$
which is 1 outside $0 \leq z \leq 1$.Let $\alpha=\frac{1-z}{z}$, and we seek for $P(\alpha X\leq Y)$, where $\alpha \geq 0$. In the 2D plane, you'll draw the line $y=\alpha x$, and integrate the joint PDF in the area in-between the line and the x-axis; then substitute $z$, and differentiate with respect to it.
A: The joint density of $(X,Y)$ is of the form
\begin{align}
f_{X,Y}(x,y)&=\frac{1}{\theta^2}\exp\left({-\frac{x+y}{\theta}}\right)\mathbf1_{x,y>0}\quad,\,\theta>0
\\&=\frac{1}{\theta}e^{-x/\theta}\mathbf1_{x>0}\frac{1}{\theta}e^{-y/\theta}\mathbf1_{y>0}
\\&=f_X(x)f_Y(y)\quad,\text{ say }
\end{align}
So $X$ and $Y$ are independent and identically distributed Exponential variables with mean $\theta$. 
You seek the distribution of $\frac{X}{X+Y}=Z$ (say). 
Among several ways to find the distribution of $Z$, we could find the distribution function (DF) $P(Z\leqslant z)$ of $Z$, or we could use a change of variables (as mentioned in a comment) along the lines of $(X,Y)\to (Z,W)$ such that $Z=\frac{X}{X+Y}$ and $W=X+Y$. 
For the DF, we can proceed using the total probability theorem :
For each $z\in(0,1)$, 
\begin{align}
F_Z(z)&=P\left(\frac{X}{X+Y}\leqslant z\right)
\\&=\int P(X\leqslant zX+y\mid Y=y)f_Y(y)\,dy
\\&=\int_0^{\infty}P\left (X\leqslant \frac{y}{1-z}\right)f_Y(y)\,dy
\\&=\cdots
\end{align}
Differentiating $F_Z$ wrt $z$ would yield the density of $Z$.
If you use the second method with that particular transformation, you would find from the joint density of $(Z,W)$ that $Z$ and $W$ are also independently distributed, and finally identify the distribution of $Z$ from the joint density alone.
