Results 1 to 4 of 4

Thread: Average distance between 2 random points

  1. #1
    Newbie
    Joined
    Apr 2010
    Posts
    1

    Average distance between 2 random points

    Here's a problem I've been struggling with:

    If I select two numbers at random between 0 and 100 (inclusive and they can be the same number) what is the average difference between these numbers? Assume difference is always positive (i.e. if i select 2 and 40 or 41 and 3 the difference is 38) So if I select 1000000 pairs, what will the average difference be? I'm pretty sure it's less than 50 but I'd like a proof or integral etc...

    Ideally I would get a generic solution in the form of "N" where the range is between 0 and N. ( I really want the average between 0 and 1)


    Thanks.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member Failure's Avatar
    Joined
    Jul 2009
    From
    ZŁrich
    Posts
    555
    Quote Originally Posted by jaxon4 View Post
    Here's a problem I've been struggling with:

    If I select two numbers at random between 0 and 100 (inclusive and they can be the same number) what is the average difference between these numbers? Assume difference is always positive (i.e. if i select 2 and 40 or 41 and 3 the difference is 38) So if I select 1000000 pairs, what will the average difference be? I'm pretty sure it's less than 50 but I'd like a proof or integral etc...

    Ideally I would get a generic solution in the form of "N" where the range is between 0 and N. ( I really want the average between 0 and 1)


    Thanks.
    Let's assume, for simplicity, that the two points are uniformly and continuously distributed on the entire intervall [0;N].
    Suppose you now pick a first point x from [0;N] at random, then this point splits [0;N] into two segments, [0;x] and [x;N].
    If you now pick the second point, at random, it will be from the lower intervall with probability x/N and from the upper intervall with probability (N-x)/N.
    In the first case, the avarage distance of the second point from the first will be $\displaystyle \tfrac{x}{2}$, while in the second case, the average distance will be $\displaystyle \tfrac{N-x}{2}$.

    So, given the first point x from [0;N] the average distance of the second point is $\displaystyle \tfrac{x}{2}\cdot \tfrac{x}{N}+\tfrac{N-x}{2}\cdot\tfrac{N-x}{N}=\tfrac{x^2+(N-x)^2}{2N}$.
    You now only have to integrate this, multiplied with the appropriate density function $\displaystyle \tfrac{1}{N}$, with respect to x to get the average distance of two points randomly chosen from the interval [0;N].
    Last edited by Failure; Apr 10th 2010 at 02:07 AM.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Senior Member
    Joined
    Feb 2010
    Posts
    422
    Should be $\displaystyle \frac1{N^2}\int_0^N\int_0^N|x-y|\,\mathrm{d}x\,\mathrm{d}y$ for random real points in [0,N] shouldn't it? If so, then it should come out to N/3, which is less than half, as you thought.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    5
    Quote Originally Posted by jaxon4 View Post
    Here's a problem I've been struggling with:

    If I select two numbers at random between 0 and 100 (inclusive and they can be the same number) what is the average difference between these numbers? Assume difference is always positive (i.e. if i select 2 and 40 or 41 and 3 the difference is 38) So if I select 1000000 pairs, what will the average difference be? I'm pretty sure it's less than 50 but I'd like a proof or integral etc...

    Ideally I would get a generic solution in the form of "N" where the range is between 0 and N. ( I really want the average between 0 and 1)


    Thanks.
    You are being vague are these reals numbers of integers?

    The real number problem is equivalent to choosing two numbers $\displaystyle x,y\sim U(0,1)$ and asking for the mean of $\displaystyle |x-y|$. Well without loss we may assume that $\displaystyle x\sim U(0,1)$ and $\displaystyle y\sim U(0,x)$, then we have:

    $\displaystyle E(|x-y|)=2\int_{x=0}^1 \int_{y=0}^x (x-y) \;dydx=1/3$

    (the 2 is needed to normalise the probability over the lower half unit square)

    CB
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 2
    Last Post: Oct 14th 2011, 11:43 AM
  2. Distance between two random Points in a square
    Posted in the Advanced Statistics Forum
    Replies: 2
    Last Post: Jul 21st 2010, 09:05 AM
  3. Average distance of two points on a sphere
    Posted in the Geometry Forum
    Replies: 9
    Last Post: May 27th 2010, 11:53 AM
  4. Replies: 1
    Last Post: May 8th 2010, 06:35 PM
  5. Displacement, distance and average velocity
    Posted in the Calculus Forum
    Replies: 6
    Last Post: Jul 13th 2009, 01:53 PM

Search Tags


/mathhelpforum @mathhelpforum