Euclidean distance of two uniform random variables Two random variables $X$ and $Y$ are uniformly distributed, the pdfs of which are given by $f_{X}\left(x\right) = f_{Y}\left(y\right) = 1/r$. I am trying to obtain $Z = \sqrt{X^2 + Y^2}$.
I tried the approach shown below, but I want to avoid having the $\tan^{-1}$ term in $f_{Z}\left(z\right)$.
Can anybody help me in finding an easier (algebraic) form of $f_{Z}\left(z\right)$? Further, it will be most desired that the resulting $f_{Z}\left(z\right)$ ends up with a "known" distribution (e.g., Rayleigh).
My approach:
The cdf of $Z$ is found as
\begin{align}\label{eq_F_L}
F_{Z}\left( z \right) &= \mathbb{P} \left( Z \le z \right)\nonumber\\
&= \mathbb{P} \left(\sqrt{X^2 + Y^2} \le z\right)\nonumber\\
&= \displaystyle \int_{0}^{r} \mathbb{P} \left(Y \le \sqrt{Z^2 - X^2} \right) f_{X}\left(x\right) \text{d}x\nonumber\\
&\stackrel{(a)}{=} \displaystyle \frac{1}{r^2} \int_{0}^{r} \sqrt{z^2 - x^2} \text{d}x\nonumber\\
&= \frac{1}{r^2} \left[ \frac{1}{2} \left( x \sqrt{z^2 - x^2} + z^2 \tan^{-1}\left( \frac{x}{\sqrt{z^2 - x^2}} \right) \right) \right]_{0}^{r}\nonumber\\
&= \frac{1}{2r^2} \left[ r \sqrt{z^2 - r^2} + z^2 \tan^{-1}\left( \frac{r}{\sqrt{z^2 - r^2}} \right) \right].
\end{align}
(a) follows from $F_{Y}\left(y\right) = \int f_{Y}\left(y\right) \text{d}y = y/r$.
Then the pdf of of $Z$ can be identified as
\begin{align}\label{eq_f_L_proof}
f_{Z}\left( z \right) &= \frac{\text{d}}{\text{d}z} F_{Z}\left( z \right)\nonumber\\
&= \frac{z}{r^2} \tan^{-1} \left( \frac{r}{\sqrt{z^2 - r^2}} \right).
\end{align}

Looking to the problem geometrically, it is clear that the pdf /cdf cannot but be defined piecewise

and it is easy to derive  the pdf from the area of the segment of the circular annulus between $z$ and $z+dz$ intercepted by the square,
divided by the area of the whole square ($r^2$), i.e.
$$
p(z\,;\,r) = {1 \over {r^{\;2} }}\left\{ {\matrix{
   {{\pi  \over 2}\,z} & {0 \le z < r}  \cr 
   {\left( {{\pi  \over 2}\, - 2\arccos \left( {{r \over z}} \right)} \right)z} & {r \le z \le \sqrt 2 \,r}  \cr 
 } } \right.
$$
giving  the cdf as
$$
\eqalign{
  & P(z\,;\,r)
 = \left[ {0 \le z \le \sqrt 2 \,r} \right]\left( {{\pi  \over 4}\left( {{z \over r}} \right)^{\;2}  - 2\left[ {r \le z} \right]{1 \over {r^{\;2} }}\int_{t = r}^z {\arccos \left( {{r \over t}} \right)tdt} } \right) =   \cr 
  &  = \left[ {0 \le {z \over r} \le \sqrt 2 } \right]\left( {{\pi  \over 4}\left( {{z \over r}} \right)^{\;2}  - 2\left[ {1 \le {z \over r}} \right]\int_{t/r = 1}^{z/r}
 {\arccos \left( {{1 \over {t/r}}} \right)\left( {{t \over r}} \right)d\left( {{t \over r}} \right)} } \right) =   \cr 
  &  = \left[ {0 \le {z \over r} \le \sqrt 2 } \right]\left( {{z \over r}} \right)^{\;2} \left( {{\pi  \over 4} - \left[ {1 \le {z \over r}} \right]\left( {\arccos \left( {{1 \over {z/r}}} \right)
 - {1 \over {z/r}}\sqrt {1 - \left( {{1 \over {z/r}}} \right)^{\;2} } } \right)} \right) \cr} 
$$
where the square brackets indicate the Iverson bracket.

