Derive the probability density function of the distance I was and still wondering how to derive the probability density function of $d^2$, where $d$ is the distance between two points that are inside a circle of radius $R$.
The two points are uniformly distributed inside the circle.
 A: Assume $R=1$ and denote the unit disk by $D$. Let ${\bf Z}_1$ and ${\bf Z}_2$ be the two random points in $D$. We argue about the random variable $S:=|{\bf Z}_2-{\bf Z}_1|$ and take care of $S^2$ later.
Fix an $r\in\ ]0,1[\ $. We first condition on the assumption $|{\bf Z}_1|=r$, or ${\bf Z}_1=(r,0)$. Denote by $F_r(s)$ the the probability that $S\leq s$ in this case. Then
$$F_r(s)={{\rm area}(D\cap B_s)\over{\rm area}(D)}={{\rm area}(D\cap B_s)\over\pi}\qquad(s>0)\ ,$$
where $B_s$ denotes the disk of radius $s$ with center $(r,0)$. It follows that
the probability density of $S$ is given by
$$f_r(s)=\lim_{\Delta s\to0+}{F_r(s+\Delta s)-F_r(s)\over\Delta s}={{\rm length}(D\cap\partial B_s)\over \pi}\ .$$
A figure shows that in the case $0<s<1$ the quantity $\ell_r(s):={\rm length}(D\cap\partial B_s)$ is given by
$$\ell_r(s)=\cases{2\pi s\quad&$(s<1-r)$ \cr
2s\arccos{r^2+s^2-1\over 2rs}&$(1-r<s<1)$\cr}\ ,$$
and in the case $1<s<2$ by
$$\ell_r(s)=\cases{
2s\arccos{r^2+s^2-1\over 2rs}&$(1<s<1+r)$\cr
0\quad&$(1+r<s<2)$ \cr}\ .$$
In order to obtain the overall probability density $f(s)$ of $S$ we have to remove the condition $|{\bf z}_1|=r$. It follows that
$$f(s)={1\over{\rm area}(D)}\int_0^1 f_r(s)\>2\pi r\> dr=2\int_0^1 f_r(s)\>r\>dr\ .$$
In the case $0<s<1$ we get
$$f(s)={2\over\pi}\int_0^1\ell_r(s)\> r\ dr={2\over\pi}\int_0^{1-s}2\pi s\> r\ dr +{2\over\pi}\int_{1-s}^12s\arccos{r^2+s^2-1\over 2rs}\> r\ dr\ .$$
In the case $1<s<2$ we have a similar expression.  Mathematica can do these integrals; the result is elementary, but ugly.
Now that we have the probability density $f$ of $S$ its easy to obtain the probability density $\tilde f$ of $S^2$: $$\eqalign{\tilde f(u)&=\lim_{h\to0+}{P[u<S^2<u+h]\over h}=\lim_{h\to0+}{P[\sqrt{u}<S<\sqrt{u+h}]\over h}\cr&=\ldots={1\over2\sqrt{u}} f\bigl(\sqrt{u}\bigr)\qquad  (0\leq u\leq 4)\ .\cr}$$
A: Since the two points are drawn uniformly and independently, you can consider wlog that the first point is at $(R,0)$ and the second one is drawn uniformly on the circle of center $(0,0)$ and radius $R$. By a symmetry argument, you can even assume that the second point is drawn uniformly on the top half circle, so that the angle $\alpha$ between the points has uniform distribution on $(0,\pi)$. Now, the triangle formed by the two points and the center of the circle is isosceles and we see easily that $d = 2 R \sin(\alpha/2) \Longleftrightarrow \alpha = 2 \arcsin (d/2R)$. So, we have for $g$ a bounded continuous function
$$ \mathbb E [g(d)] = \int_0^\pi g \left (2 R \sin(\frac \alpha 2) \right) d \alpha = \int_0^{2R} g \left (d \right) \frac 1 {\sqrt{R^2 - (d/2)^2}} d d $$
setting $d = 2 R\sin(\alpha/2)$. Thus the density is 
$$ f(d) =  \frac 1 {\sqrt{R^2 - (d/2)^2}} \ \text{ if }  \ d \in (0,2R), \ f(d) = 0 \ \text{otherwise}. $$
