# distance distribution between two points using their length distribution

I have a circle with radius x which is a random variable that its distance from the center of circle has a known pdf. Now suppose we have an other point y (in which it may be in the circle or outside) that again its distance from the center of the circle has a known pdf. I want to derive the pdf of the distance between these two points, which I name z. I try to solve this problem for two cases, namely y outside of the circle and y inside the circle:
1) $f(z|y>x) = \frac{\int_{0}^{\infty}\int_{x}^{\infty}f(z,x,y)dydx}{Pr(y>x)}$
I know that the relationship between x,y and z is $z = \sqrt{x^2+y^2-2xycos(\theta)}$. I know the joint pdf of x and y. However, I do not know the pdf of $\theta$ which I assume to be uniform in $0 \leq \theta \leq 2\pi$ and also I suppose that it is independent of x and y. For getting f(z,x,y) I use following method:
$\left\{ \begin{array}{l} z = \sqrt{x^2 + y^2 - 2xy cos(\theta)} \\ w = x \\ t = y \end{array} \right.$
Then I derived Jacobian $J(x,y,\theta)$ which is $J(x,y,\theta) = \frac{wt\sin(\cos^{-1}(\frac{w^2+t^2-z^2}{2wt}))}{z}$
Hence, we have $f(z,w,t) = \frac{f_{\theta}(\theta)f_{XY}(w,t)}{J(x,y,\theta)}$
2)$f(z|y<x) = \frac{\int_{0}^{\infty}\int_{0}^{x}f(z,x,y)dydx}{Pr(y<x)}$
For this case I follow the same method as in case 1.

First of all I want to know whether my approach is correct or not. If it is correct my problem is that for some values of x and y, Jacobian is zero which means f(z,w,t) is infinity.For example if the value of x is 1 and the value of y is 2 and the angle between them is zero which means they are in the same line, in this case z is 1 which is reasonable. However in this case J(x,y,\theta) is zero! and this ruin the f(z,w,t).
Am I missing something? If yes so how can I obtain the pdf of z?
Thanks

• What are the known pdfs of $X$ and $Y$? – knrumsey May 14 '17 at 23:16
• Their pdfs are generalized gamma distribution $f_n(x) = \frac{2 (\pi \lambda)^n x^{2n-1} \exp\{-\pi \lambda x^2\}}{\Gamma(n)}$ and $f_m(y) = \frac{2 (\pi \lambda)^m y^{2m-1} \exp\{-\pi \lambda y^2\}}{\Gamma(m)}$ – Simin May 15 '17 at 7:29