Let $X,Y$ be independent normally distributed random variables. Find the density of $\frac{X^2}{Y^2+X^2}$ Let $X,Y$ be independent standard normally distributed random variables and $X,Y\neq 0$. Find the density of $\frac{X^2}{Y^2+X^2}$
I was given the tip of first calculating the density of $(X^2,Y^2)$ and then calculate the density of $(\frac{X^2}{Y^2+X^2},Y^2+X^2)$
When I follow the tips: I know that $X^2\sim\Gamma(\frac{1}{2},\frac{1}{2})$ and $Y$ too. Furthermore, $X^2$ and $Y^2$ are still independent. Therefore the density $f_{(X^2,Y^2)}(x,y)$ can be written as $f_{X^2}(x)f_{Y^2}(y)$ where $f_{X^2}$ and $f_{Y^2}$ are the density functions of $X^2$ and $Y^2$
My next idea, with the tip above in mind is to consider a map $\varphi: (x,y) \mapsto (\frac{x}{x+y},x+y)$
It then follows that $(\frac{X^2}{Y^2+X^2},Y^2+X^2)=\varphi(X^2,Y^2)$
and $f_{\frac{X^2}{Y^2+X^2},Y^2+X^2}(a,b) = f_{\varphi(X^2,Y^2)}(a,b)
$
Note that $\varphi^{-1}: (a,b)\mapsto (ba,b-ba)$ and thus $\det D \varphi^{-1}(a,b)=\det\begin{pmatrix} b & a \\
-b & 1-a
\end{pmatrix}=b(1-a)+ab\implies \det D \varphi^{-1}(\frac{X^2}{Y^2+X^2},Y^2+X^2)=(Y^2+X^2)(1-\frac{X^2}{Y^2+X^2})+(\frac{X^2}{Y^2+X^2})(Y^2+X^2)=Y^2+X^2$
And hence $P_{(\frac{X^2}{Y^2+X^2},Y^2+X^2)}(A)=\int_A f_{(\frac{X^2}{Y^2+X^2},Y^2+X^2)}(x,y)\,dx\,dy = \int_{\varphi^{-1}(A)}f_{(X,Y)}(x,y)\times (X^2+Y^2)\,dx\,dy = \int_{\varphi^{-1}(A)} f_X(x)\times f_Y(y)\times (X^2+Y^2)\,dx\,dy$
Where do I go from here?
 A: I’m on my phone so I can’t type it all out but X^2 and Y^2 are independent chi-squared r.v.s with one degree of freedom each.
These chi squared rvs are equivalent to Gamma(1/2,2) in distribution.
By a known fact about gamma random variables, if X and Y are independent gammas with the same location but different shape parameters a and b, X/X+Y is Beta(a,b). In this case we end up with Beta(1/2,1/2) as our final answer.
=====
Additional proof of independence of X/(X+Y) and X+Y along with derivation of distributions for gamma r.v.s X,Y:
$X,Y\sim \Gamma(\lambda_1,a),\Gamma(\lambda_2,a)$ and independent.
Let $,=/(+),+$ so $=,(1−)=$ and the jacobian $∣∣∂(,)/∂(,)∣∣=|([[,][−,1−]])|=||=$. The last equality is true since $,>0$. 
Then $_{,}(,)=_{,}((,),(,)) \propto ^{−}^{_1−1}^{−}^{_2−1}=^{−(+)}^{_1−1}^{_2−1}.$
Simplifying further, we get
$$e^{-av}(uv)^{\lambda_1-1}((1-u)v)^{\lambda_2-1}v = e^{-av}v^{\lambda_1+\lambda_2-1}\times u^{\lambda_1-1}(1-u)^{\lambda_2-1}.$$
Thus $V\sim \Gamma(\lambda_1+\lambda_2,a)$ and $U=X/(X+Y)\sim Beta(\lambda_1,\lambda_2)$ and are independent.
A: Observe that the distribution of the vector $(X,Y)$ is rotationally invariant. That is, if we rotate it at any angle, the resulting vector has the same distribution as $(X,Y)$. 
Why? Rotation  $\alpha$ radians counterclockwise gives the vector $(X\cos \alpha-Y\sin \alpha,X\sin \alpha+Y \cos \alpha)$, which is centered gaussian whose covariance matrix is the identity, hence the components are independent standard normal. 
Since the distribution of $(X,Y)$ is invariant under rotation, the angle it makes with the positive $x$-axis, $\Theta$ is uniformly distributed on $[0,2\pi)$. 
Let   $Z= X^2/(X^2+Y^2)$. Then from the definition of $\Theta$, 
$Z = \cos^2 \Theta$, so this is nothing but a transformation of a uniform RV, which after a routine calculation gives us the density 
$$f_Z (z) = \frac{1}{\pi\sqrt{(1-z)z}},~z \in (0,1).$$ 
