# $X_1,X_2$ independent gamma-distributed random variables. Density of $Y:=\frac{X_1}{X_1+X_2}$

Let $$X_1,X_2$$ be two independent gamma-distributed random variables: $$X_1 \sim \Gamma(a_1,b), X_2 \sim \Gamma(a_2,b)$$.

How can I determine the density of $$Y:=\frac{X_1}{X_1+X_2}$$

I don't really know how to start, so I would appreciate any tips! Thanks in advance!

• Did you search the site? This has been asked here so many times. Here is a similar one. – StubbornAtom Nov 12 '18 at 18:48
• – StubbornAtom Nov 12 '18 at 18:55

We'll get the CDF of $$Y$$, then differentiate it. For $$y\ge 0$$, $$Y\le y$$ iff $$X_1\le\frac{yX_2}{1-y}$$, which for fixed $$X_2=x_2$$ has probability $$\int_0^{yx_2/(1-y)}f_1(x_1)dx_1$$, with $$f_1$$ the pdf of $$X_1$$. Integrating over $$x_2$$ gives the CDF of $$Y$$, $$\int_0^\infty dx_2 f_2(x_2)\int_0^{yx_2/(1-y)}f_1(x_1)dx_1$$, with $$f_2$$ the pdf of $$X_2$$. Differentiating with respect to $$y$$ obtains the density $$\int_0^\infty dx_2 f_2(x_2)\frac{x_2}{(1-y)^2}f_1(\frac{yx_2}{1-y})=\frac{b^{a_1+a_2}y^{a_1-1}(1-y)^{-a_1-1}}{\Gamma(a_1)\Gamma(a_2)}\int_0^\infty dx_2 x_2^{a_1+a_2-1}\exp\frac{-bx_2}{1-y}=\frac{y^{a_1-1}(1-y)^{a_2-1}}{\operatorname{B}(a_1,\,a_2)}$$(on $$[0,\,1]$$, of course). In other words, $$y\sim\operatorname{B}(a_1,\,a_2)$$.