Suppose that $X_1 \sim \Gamma(\alpha_1,\beta)$ and $X_2 \sim \Gamma(\alpha_2,\beta)$ and let $Z = \frac{X_1}{X_1 + X_2}$ ($X_1$ and $X_2$ are assumed to be independent).
I want to prove that $Z$ is beta distributed as follows: $Z \sim Beta(\alpha_1, \alpha_2)$.
I don't want to use the Jacobian as shown there: http://www.math.wm.edu/~leemis/chart/UDR/PDFs/GammaBeta.pdf.
Instead, I know that $Z = \frac{X_1}{X_1 + X_2} \Rightarrow X_2 = X_1\frac{1-Z}{Z}$ and the joint of $X_1$ and $X_2$ is:
$$P(X_1,X_2) = \frac{\beta^{\alpha_1 +\alpha_2}}{\Gamma(\alpha_1)\Gamma(\alpha_2)}X_1^{\alpha_1-1}X_2^{\alpha_2-1} \exp[-\beta(X_1 + X_2)]$$
By integrating the joint I get:
$$P(Z) = \int_0^{+\infty} P(X_1,X_1\frac{1-Z}{Z}) dX_1 = \int_0^{+\infty} \frac{\beta^{\alpha_1 +\alpha_2}}{\Gamma(\alpha_1)\Gamma(\alpha_2)}X_1^{\alpha_1-1}\Bigg(X_1\frac{1-Z}{Z}\Bigg)^{\alpha_2-1} \exp[-\beta X_1/Z]dX_1$$
Using that $Beta(\alpha_1,\alpha_2)\Gamma(\alpha_1 + \alpha_2) = \Gamma(\alpha_1)\Gamma(\alpha_2)$ and pulling the constant outside of the integral:
$$P(Z) = \frac{Z^{\alpha_1 - 1} (1-Z)^{\alpha_2 - 1}}{Beta(\alpha_1,\alpha_2)} \int_0^{+\infty} \frac{\beta^{\alpha_1 + \alpha_2}}{\Gamma(\alpha_1+\alpha_2)}\Bigg( \frac{X_1}{Z} \Bigg)^{\alpha_1-1}\Bigg(\frac{X_1}{Z}\Bigg)^{\alpha_2-1} \exp[-\beta X_1/Z]dX_1\\ = \underbrace{\frac{Z^{\alpha_1 - 1} (1-Z)^{\alpha_2 - 1}}{Beta(\alpha_1,\alpha_2)}}_{\text{Beta distribution}} \underbrace{\int_0^{+\infty} \frac{\beta^{\alpha_1 + \alpha_2}}{\Gamma(\alpha_1+\alpha_2)}\Bigg( \frac{X_1}{Z} \Bigg)^{\alpha_1 + \alpha_2 - 2} \exp[-\beta X_1/Z]dX_1}_{\text{Almost a gamma distribution that should integrate to 1}}$$
How do I get the Beta distribution from there? I have tried a change of variable $Y = \frac{X_1}{Z}$ but it does not seems to lead to the result.