0

Suppose I have a family $X$ of vectors $X_i \in \mathbb{R}^2$, where $i\in \{1,\dots, N\}$. Let $U(a,b)$ be the continuous uniform distribution with bounds $a,b.$ They are such that $X_i=(X_{i0},X_{i1})$ where $X_{i0}$ and $X_{i1}$ are randomly chosen from $U(0,1)$. Now let's consider the matrix of all distances $D$ as such: $$D_{ij} = \sqrt{\sum_k(X_{ik} - X_{jk})^2}.$$

I would say that all $X_{ik} - X_{jk}$ can be seen as picked from $U(-1,1),$ so $D_{ij}$ should be from $U(0,\sqrt{2})$ for $i\neq j.$ The average value for non diagonal elements of $D$ should be $\sqrt{2}/2.$ And thus the average over all elements of $D$ is $$ \frac{\frac{\sqrt{2}}{2} (N^2 - N) + 0 N}{N^2} = \frac{1}{\sqrt{2}}\left(1 - \frac{1}{N}\right). $$

But when I perform the calculation numerically with $N=50'000$ I get an average value of $0.5212$ instead of the expected $0.7071..$ . Is my mistake in the algebra of uniform probability distributions?

ty.
  • 540
  • 1
    The difference (or the sum) of uniform variables does not distribute as uniform. Also the square root of a uniform variable is not uniform. – nicola Jul 19 '21 at 08:36
  • @ I had a suspicion about that, it makes intuitive sense that the square root is messing with the flatness of the distribution because taking the square root is a non linear function but I why can't I take differences of the same distribution with itself and still get a stretched uniform distribution. I would guess the difference should be from $U(-1,1)$... – ty. Jul 19 '21 at 08:54
  • An example: A die is flat (you can have 1 to 6 with the same probability), the sum of two dice is not (it's not equally likely to have 2 than 7). There are plenty of resources that will tell you why the sum is not uniform. – nicola Jul 19 '21 at 09:03
  • @ty A single die is uniform. The sum of two dice is not uniform - 7 is much more common than 2 or 12 - and the same holds for difference (which is equivalent to 7 less than the sum) – Hagen von Eitzen Jul 19 '21 at 09:04
  • @HagenvonEitzen Lol, we came up with the same exact example at the same time :) – nicola Jul 19 '21 at 09:04
  • $\frac{1}{15}(2 + \sqrt2 + 5\log_e(1+\sqrt2))=0.52140543316472\ldots$ – Henry Jul 19 '21 at 09:08
  • See Mathworld Hypercube Line Picking and https://math.stackexchange.com/questions/1976842/how-is-the-distance-of-two-random-points-in-a-unit-hypercube-distributed for related information – Henry Jul 19 '21 at 09:10
  • ... and https://math.stackexchange.com/questions/1254129/average-distance-between-two-random-points-in-a-square – Henry Jul 19 '21 at 09:16
  • Thank you for the illuminating comments, I think I got it now! – ty. Jul 19 '21 at 09:51

0 Answers0