How to write the distribution of the (Euclidean) distance between two random points with arbitrary distributions

39 Views Asked by At

Let the random variable $ \hat{{\mathbf x}}_i $ be defined over a some D-dimensional space (I'm interested in D=2), with distribution $ f_i(\mathbf x) $. What is the distribution of Euclidean distance between samples from $i$ and $j$?

My attempt:

Let us consider the squared Euclidean distance in 2D, defined as:

$$ d (\mathbf u, \mathbf v) = (u_x - v_x)^2 + (u_y - v_y)^2 $$

The PDF $f_d$ of the random variable $\hat d$ which is the squared Euclidean distance between the mutually-independent random variables $\hat{\mathbf u} = \hat{\mathbf x}_i$ and $\hat{\mathbf v} = \hat{\mathbf x}_j$, with PDFs $f_{\hat u}(u_x, u_y)$ and $f_{\hat v}(v_x, v_y)$, respectively, can be found using change of variables. Let us define the auxiliary variables $a = (u_x - v_x)^2 - (u_y - v_y)^2, b= u_x, c=u_y$. We can then write $ u_x, u_y, v_x, v_y$ in terms of $a,b,c,d$ as:

\begin{align} u_x &= b \\ u_y &= c \\ v_x &= b - \sqrt{\frac{d+a}{2}} \\ v_y &= c - \sqrt{\frac{d-a}{2}} \end{align}

The Jacobian of the change of variables is:

\begin{align} \mathbf J = \begin{vmatrix}0 & 0 & k_1 & k_2 \\ 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \\ 0 & 0 & k_1 & -k_2\end{vmatrix} = 2k_1 k_2 = \frac14 \frac1{\sqrt{d^2 - a^2}} \end{align} with $k_1 = -\left(2\sqrt{2}\sqrt{d+a}\right)^{-1}$ and $k_2 = \left(2\sqrt{2}\sqrt{d-a}\right)^{-1}$.

The PDF of the joint distribution $g_{a,b,c,d}$ can be found as:

$$ g_{\hat a,\hat b,\hat c,\hat d}(a,b,c,d) = \frac14 \frac1{\sqrt{d^2 - a^2}} f_{\hat u}(b, c) f_{\hat v}\left(b - \sqrt{\frac{d+a}{2}}, c - \sqrt{\frac{d-a}{2}}\right) $$

and, in principle, it is possible to calculate the PDF $f_{\hat d} (d)$ as the marginal distribution of $g$ by integrating over the entire domain of $a, b, c$:

$$ f_{\hat d}(d) = \int \int \int g_{\hat a,\hat b,\hat c,\hat d}(a,b,c,d) \mathrm d a \mathrm d b \mathrm d c $$

Is there an alternative, better, way of defining $f_{\hat d}(d)$ ?