If X and Y are independent gamma random variables with parameters (α, λ) and (β, λ), respectively, compute the joint density of U = X + Y and V = X/(X + Y).
The joint density of X and Y is given by
f_{X,Y}(x,y)=\frac{\lambda e^{-\lambda x}(\lambda x)^{\alpha-1}}{\Gamma(\alpha)}\ \frac{\lambda e^{-\lambda y}(\lambda y)^{\beta-1}}{\Gamma(\beta)}={\frac{\lambda^{\alpha+\beta}}{\Gamma(\alpha)\Gamma(\beta)}}e^{-\lambda(x+y)}x^{\alpha-1}y^{\beta-1}
Now, if g_{1}(x,y)=x+y,\,g_{2}(x,y)=x/(x+y), then
{\frac{\partial g_{1}}{\partial x}}={\frac{\partial g_{1}}{\partial y}}=1,\qquad{\frac{\partial g_{2}}{\partial x}}={\frac{y}{(x+y)^{2}}},\qquad{\frac{\partial g_{2}}{\partial y}}=-{\frac{x}{(x+y)^{2}}}and so
J(x,y)=\begin{vmatrix} 1 & 1 \\ \frac{y}{(x+y)^{2}} & \frac{-x}{(x+y)^{2}} \end{vmatrix} = -{\frac{1}{x\ +y}}Finally, because the equations u = x + y, v = x/(x + y) have as their solutions x = uv, y = u(1 − v), we see that
f_{U,V}(u,v)=f_{X,Y}[u v,\ u(1-v)]u=\frac{\lambda e^{-\lambda u}(\lambda u)^{\alpha+\beta-1}}{\Gamma(\alpha+\beta)}\frac{v^{\alpha-1}(1-v)^{\beta-1}\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)}
Hence X + Y and X/(X + Y) are independent, with X + Y having a gamma distribution with parameters (α + β, λ) and X/(X + Y) having density function
f_{V}(v)={\frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)}}v^{\alpha-1}(1-v)^{\beta-1}, 0 < v < 1
This is called the beta density with parameters (α, β).
This result is quite interesting. For suppose there are n + m jobs to be performed, with each (independently) taking an exponential amount of time with rate λ for performance, and suppose that we have two workers to perform these jobs. Worker I will do jobs 1, 2, … , n, and worker II will do the remaining m jobs. If we let X and Y denote the total working times of workers I and II, respectively, then upon using the preceding result it follows that X and Y will be independent gamma random variables having parameters (n, λ) and (m, λ), respectively. Then the preceding result yields that independently of the working time needed to complete all n + m jobs (that is, of X + Y), the proportion of this work that will be performed by worker I has a beta distribution with parameters (n, m).