Question.What is the average distance of two randomly chosen point in a square with a side length 1?
specifically, select two points at random from interior of the unit square. what is the mean distance between two random point?
solution:-
.
. .before i solve the problem,let's we get approximation. for each trial we randomly pick two points in a square and calculate the distance between the points. we can average the distance over many trials two estimate the average distance.
here, we take a point is a pair (x,y). which each co-ordinate is random number 0 to 1. we can generate two points by generating four random numbers from 0 to 1.
Let (x1, y1) = (rand();, rand();) and (x1, y1) = (rand();, rand();). In the spreadsheed I generated random numbers and then pasted values.The distance between two points can be found from the Pythagorean Theorem. The distance between two points is the hypotenuse of a right triangle with the legs being the horizontal and vertical distances
The formula for the distance between two points is therefore:
The spreadsheet performs 10,000 trials and estimates the average distance is equal to 0.517.
An exact answer
We want the expected value of the distance, where each variable is a random number drawn from the standard uniform distribution. The probability density of each variable is 1.
The expected distance is the quadruple integral of the distance formula:
The expected distance is the quadruple integral of the distance formula:
This is pretty hard to calculate, so we want to simplify it. First, we can simplify to 2 variables by focusing on a variable for the x-distance (|Δx|) and a separate one for the y-distance (|Δy|).
Consider two random variables u and v drawn from the standard uniform distribution. What is the distribution of the difference between the variables w = |u – v|? The distance will range from 0 to 1. We want to find the probability density that |u – v| = k.
Therefore we have found the distribution for |Δx|, denoted as x, and |Δy|, denoted as y. The distance formula is multiplied by those densities, and the integral becomes the following:
This integral is still hard to compute! Now we will use a change of variables into polar coordinates. We let:
x = r cos θ y = r sin θ
First we have to remember the new integral has to include an extra factor of r, which is the determinant of the Jacobian matrix, required for the change of coordinates to polar.
Next we have to find change the limits of integration. Here is a diagram that will help.
Instead of integrating the entire square, we will integrate the lower triangle and then multiply by 2. Then θ ranges from 0 to π/4, and the variable r ranges from 0 to 1/(cos θ) = sec θ.
The change of coordinates results in the following, where I have written f(r, θ) for the function to be written in polar coordinates:
Here is the integral in polar coordinates:
Now let’s simplify the integral in polar coordinates. Integrating over r is not too difficult.
Integrating for θ requires the special formula .
And that gets us to the exact answer:
(2 + √2 + 5 ln(√2 + 1))/15 ≈ 0.52140
BY: Vikash Rahii
DISTANCE BETWEEN TWO RANDOM POINTS IN A SQUARE.
Reviewed by biharishayar
on
December 31, 2017
Rating:
Really Goods QUESTION IN PUBLIC LIFE RELATED QUESTION.
ReplyDeleteNice questi6..
ReplyDeletethanks a lot..
Deletefor notification must subscribe and follow.
Nice...
ReplyDeletetujhe kb se samjh aane lga...
ReplyDelete