1
$\begingroup$

I'd like to calculate the average difference between two numbers, each between $0$ and $10$. I calculated this for integers and came up with an average distance of $4$.

My method: there are $10$ ways to obtain a difference of $1$, $9$ ways to obtain a difference of $2$, $3$ of $8$, $4$ of $7$, $5$ of $6$, $6$ of $5$, etc. I took the weighted average of all the possibilities and I ended up with $\frac{220}{55} = 4$.

But I actually have float values between $0$ and $10$. If I did the integer average distance correctly, is the average distance between $0$ and $10$ continuous still $4$?

$\endgroup$
  • $\begingroup$ I don't think averages are well-defined across infinite sets. $\endgroup$ – Wildcard Jan 4 '17 at 1:36
  • 1
    $\begingroup$ it should be 10/3 $\endgroup$ – Saketh Malyala Jan 4 '17 at 1:40
  • $\begingroup$ It does not really matter to you, since you want the solution for real numbers rather than integers, but the average distance between two integers is less than 4 if the integers are chosen uniformly and independently, because there is a 1/11 probability that the difference will be zero. $\endgroup$ – David K Jan 4 '17 at 1:48
  • $\begingroup$ Thanks! I've checked out link and that might solve my problem provided it works for continuous. So, if I may, can we agree that the continuous solution is equal to the discrete solution, given symmetry? $\endgroup$ – zazizoma Jan 4 '17 at 2:10
1
$\begingroup$

Every pair of numbers between $0$ and $10$ can be associated with a unique point $(x,y)$ in the square $[0,10] \times [0, 10]$. For such a point, the function $f(x,y)=|x-y|$ measures the difference between the two numbers. To find the average value of that function, one computes $$ \frac{1}{100}\int_0^{10} \int_0^{10} |x-y| dx dy $$

The integral is the continuous analog of "summing" all of the integer values; the $100$ measures the area of the square region, which is the continuous analog of the "number" of integer values.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks! I'll play with that a bit. $\endgroup$ – zazizoma Jan 4 '17 at 2:11
  • $\begingroup$ Okay, I got 3.33 for this definite integral, which is the same solution as for the discrete as given above, which was 10/3. $\endgroup$ – zazizoma Jan 4 '17 at 2:31
  • 1
    $\begingroup$ Yes, that's right. See also the link in dxiv's comment under your question. $\endgroup$ – mweiss Jan 4 '17 at 2:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.