If $X,Y$ are independent $\chi ^2$ with $m$ and $n$ degrees of freedom, then $\frac{X}{X+Y} \sim\beta(m/2, n/2)$
I was reading https://en.wikipedia.org/wiki/Ratio_distribution#Other_ratio_distributions and I find the following problem: Let $X$ and $Y$ be independent $\chi ^2 $ with $m$ and $n$ degrees of freedom then $\dfrac{X}{X+Y} = \beta(m/2, n/2)$. Where $\chi^2(k)$ has density function $$f_{\chi^2(k)}(x)=\begin{cases}\displaystyle \frac{1}{2^{k/2}\Gamma(k/2)}\,x^{(k/2) - 1} e^{-x/2}&\text{if }x>0,\\ 0&\text{if }x\le0 \end{cases} $$
I proved that $X+Y$ is $\chi ^2$ with $n + m$ degrees of freedom using the moment-generating function. If $Z=X+Y$ and $U=\dfrac{X}{X+Y}=\dfrac{X}{Z}$ using the formula for the density of the ratio of two independent random variables: $$f_U(u)= \int_{-\infty}^{\infty}f_X(uv)f_Z(v)|v|dv $$
then
$$\dfrac{u^{m/2-1}}{2^{(m+n/2)} \Gamma(m/2) \Gamma((m+n)/2)} \int_0^{\infty} v^{m+\dfrac{n}{2}-1} e^{-(v/2)(u+1)}dv $$
and using some algebra:
$$f_U(u)=\dfrac{u^{m/2-1} \Gamma(m+n/2)}{\Gamma(m+n/2) \Gamma(m/2) (u+1)^{m+n/2}}$$
and this is not $\beta(m/2, n/2)$, it looks more like $\beta(m/2, m/2+n/2)$ but $(u+1)^{m+n/2}$ is causing troubles.
I need help if something is false or any hint.
Solution 1:
Let $X \sim \chi^2(m)$ and $Y \sim \chi^2(n)$, and let $T(X,Y)=(U,V)$ be a transformation such that $T_1(X,Y)=U=\frac{X}{X+Y}$ and $T_2(X,Y)=V=X+Y$, then $T^{-1}_1(U,V)=X= UV$ and $T^{-1}_2(U,V)=Y=V-UV$. Then $ |J_{T^{-1}}|=|V| $. $X$ and $Y$ are independent then the joint density function is:
$$ f_{X,Y}(x,y)=\frac{(1/2)^{m/2}}{\Gamma(m/2)}x^{m/2 -1} e^{-x/2} \frac{(1/2)^{n/2}}{\Gamma(n/2)}y^{n/2 -1} e^{-y/2} $$
for $x, y \geq 0$ and $0$ in other case.
Then, by the theorem of change of variable we have:
$$f_U(u)= \int_{-\infty}^{\infty} \frac{(1/2)^{m/2+n/2}}{\Gamma(m/2) \Gamma(n/2)} (uv)^{m/2-1}(v-uv)^{n/2-1}e^{-uv/2-(v-uv)/2} |v|dv $$
We have $v=x+y$ then $f_U$ is $0$ for $v < 0$ then we can consider the integral only in the interval $(0, \infty)$ and $|v|=v$, also $u=\frac{x}{x+y}$ then $0 \leq u \leq 1$. With some algebra:
$$f_U(u)= \frac{(1/2)^{m/2+n/2}}{\Gamma(m/2) \Gamma(n/2)} u^{m/2-1} (1-u)^{n/2-1} \int_{0}^{\infty} v^{m/2+n/2-1}e^{-v/2} dv $$
If $w=v/2$ and we make the change of variable in the integral we obtain: $$\int_{0}^{\infty} v^{m/2+n/2-1}e^{-v/2} dv = 2^{m/2+n/2} \Gamma(m/2+n/2)$$
Hence, $$f_U(u)=\frac{ \Gamma(m/2+n/2) }{\Gamma(m/2) \Gamma(n/2)} u^{m/2-1} (1-u)^{n/2-1} =\dfrac{u^{m/2-1} (1-u)^{n/2-1}}{B(m/2,n/2)}$$
in the interval $[0,1]$, and this is the density function of the Beta distribution.