Probability Density Function of euclidean distance function Let $X = [x_1,\cdots,x_n]$ and $Y = [y_1,\cdots,y_n]$ such that coordinates of the points be uniformly distributed in the $[-1,1]$ interval, i.e.: $x_i,y_i$ ~ $U[-1,1]$.
My problem is that of determining the probability density function of the Euclidean distance between $X$ and $Y$. Could you help me to solve this problem, please?
 A: For the sake of simplifying notation (this solution will generalize easily), lets consider the case where we are working in the square $[0,1]^2$ rather than $[0,1]^n$.
We can now conduct an experiment where we randomly select two points in the square $[0,1]^2$.
Let $f((x_1,x_2),(y_1,y_2))$ denote the probability density function of the first randomly selected point being contained in the subset $A \subset [0,1]^2$ and the second randomly selected point being contained in $B \subset [0,1]^2$.
Since $f((x_1,x_2),(y_1,y_2))$ is a probability density function on $[0,1]^2 \times [0,1]^2$ we have that:
$$P([0,1]^2 \times [0,1]^2) = \int_{[0,1]^2} \int_{[0,1]^2} f((x_1,x_2),(y_1,y_2))dV = 1$$
Since we select the points randomly, our p.d.f $f((x_1,x_2),(y_1,y_2))$ is uniform, and thus for any subset $A \times B \subset [0,1]^2 \times [0,1]^2$ we have that:
$$P(A \times B) = \int_B \int_A f((x_1,x_2),(y_1,y_2))dV$$
Let us now define a function $Z: [0,1]^2 \times [0,1]^2 \rightarrow \mathbb{R}$ by:
$$Z((x_1,x_2),(y_1,y_2)) = \sqrt{(x_1-y_1)^2 + (x_2-y_2)^2}$$
Thus $Z$ is a random variable that transforms our original sample space of $[0,1]^2 \times [0,1]^2$ into the sample space of all possible distances between the first point $(x_1,x_2)$ and the second point $(y_1,y_2)$. (Note that the codomain of a random variable is by definition $\mathbb{R}$. The range of our random variable will be the maximal distance possible between two points in the square, which is $\sqrt{2}$.)
Let $G(z)$ denote the distribution function of $Z$. Then we have that:
$G(z)= P(Z \leq z)$
$=P(\sqrt{(x_1-y_1)^2 + (x_2-y_2)^2} \leq z)$
$= \int \int_{ \{(x_1,x_2),(y_1,y_2): Z((x_1,x_2),(y_1,y_2))<z \} } f((x_1,x_2),(y_1,y_2)) dV$
$=\int \int_{\{(x_1,x_2),(y_1,y_2): \sqrt{(x_1-y_1)^2 + (x_2-y_2)^2} < z \}} f((x_1,x_2),(y_1,y_2) dV$
The p.d.f g(z) of the random variable $Z$ can now be obtained by differentiation:
$g(z) = \frac{dG(z)}{dz}$
I'm new to this stuff so if somebody wants to clean this up / finish this for me that'd be great!
