If two points are placed randomly on a one by one square then the distance between them must be somewhere from zero to √2 (1.414).
Step 1: simplify the question
Question 2: What is the average distance between two points on a unit line? (I plan to refer to my two points as X1
and X2
and the distance between them as Y
.)
Y = |X1 - X2|
Note: The vertical lines (|) represent absolute value and merely mean that the distance is always considered to be positive regardless of whether X1
or X2
is actually larger. This is because distance is an inherently positive value.
Step 2: simplify the question further
Question 3: If X1
is not random and we place it in a known place on our line, what is the average Y
for any random location of X2
?
If
X1
is 0, then Y
may be anywhere from 0 to 1 and will be equal to the value of X2
. Because this is a straight line, the average Y
value should be exactly .5
If
X1
is .5
(in the middle of the line), then the placement of X2
will only allow Y
to vary from 0 to .5
. Following the principle that the average value of a line of straight slope is its middle value. The average value of Y
where X1 = .5
is .25
.
If
X1
is .25
this situation becomes a bit more complicated. If X2
is less than X1
, Y
will fall between 0 and .25
(average value: .125
). If X2
is greater than X1
, Y
will fall between 0 and .75
(average value: .375
) Given that X2
has a 25% chance of falling to the left of X1
, and a 75% chance of falling to the right, the weighted average value of Y
is .3125
.
In general, for any particular value of
X1
, the average distance Y
would be equal to the average distance if X2
is less than X1
times the probability that X2
actually would be less than X1
, plus the average distance if X2
is greater than X1
times the probability that X2
actually would be greater than X1
.
Our new formula for average Y = X12 - X1 + 1/2
. This formula can be tested by trying some of the values of X1
which we have already considered. This is the answer to question 3.
Step 3: Use the answer to question 3 and return to question 2
Question 2: What is the average distance between two points on a unit line?
We know the answer to the question for any single fixed value of X1
, and need to calculate the average for all values of X1
. This range is not a straight line, so I can't just take the middle value as the average. Here's my formula for the average value of Y
for all values of X1
from 0 to 1:
For the integrated function: F(X1) = 1/3X13 - 1/2X12 + 1/2X1
this translates to
[ F(max X1) - F(min X1) ] / [ max X1 - min X1 ].
Because we are working with the range of 0 to 1, plugging these two values into the final function yields the answer of 1/3
. This is the average distance of two points placed at random on a line of length 1.
This seems to me to be such a simple answer that I suspect I could have gotten this far much more simply. I don't know how though... any ideas?
Step 4: use the answer to question 2 to answer the main question
X1
and X2
(which I will call Y1
), and the vertical distance (which I will call Y2
) can be related to the actual difference using the formula: distance2 = Y12 + Y22
Because we know the average values of Y1
and Y2
are each 1/3
, we can calculate the average distance:
distance2 = (1/3)2 + (1/3)2
distance2 = 2/9
distance = √2/3 = approximately .4714
Tags: math