Probability function for distance d from the center of a point picked at random in a unit disk

3.7k Views Asked by At

Assume there is a unit disk with radius = 1 and centered at $C$. Randomly and uniformly pick a point $P$ in the disk. What is the expected distance between $C$ and $P$?

Solution:

Since $P$ is $\bf{Uniformly Distributed}$, we know the probability is $\frac{1}{\pi}$, use polar coordinates substitution $x = r\cos{\theta}$ and $y = r\sin{\theta}$, we know

$E[\sqrt{x^2+y^2}] = \frac{1}{\pi}\int_{0}^{2\pi}\int_0^1r*rdrd\theta = \frac{2}{3} $

Here is the problem. How do we generate a uniformly randomly distributed $P$ in real life?

At my original thinking, there are two independent variables, $\theta$ and $r$, every point in the disk can be represented by these two variables. Thus, we uniformly pick an angle from $[0, 2\pi)$ and distance from $[0, 1)$. But in this way, the probability of choosing a point becomes $\frac{1}{2\pi}*1=\frac{1}{2\pi}$ , which is different from $\frac{1}{\pi}$ that I claimed before. Also, in this setup, the expected distance from any point to the center becomes $\frac{1}{2}$, since it is $[0, 1)$ uniform distribution.

This contradiction gives me trouble and I can only conclude that the distance probability isn't uniform $[0, 1)$ distributed. Actually, from this link http://mathworld.wolfram.com/DiskPointPicking.html

it actually says that "The probability function for distance d from the center of a point picked at random in a unit disk is $P(d) = 2d$.

Indeed, if this is the probability function for distance, the expectation is easy to calculate, $\int_0^1 2rdr=\frac{2}{3}$, which is the same as before. Also, the total probability becomes $\int_0^{2\pi} \int_0^1 2r(\frac{1}{2\pi})rdrd\theta = 1$.

I know why $dxdy = rdrd\theta$ when transforming $x,y$ to $r, \theta$, but it is not that easy to imagine the distance is not uniformly distributed. Can someone give an easy to understand explanation?

Follow-up question, what if the shape of object is more complicated? As an example, if on x-y plane, I draw a equilateral triangle and be asked to uniformly pick a point inside the triangle, how to do it? Previously, I was thinking use rotation matrix. Give the vector representation of two sides, each decides an angle (uniformly between $[0,\frac{\pi}{3}]]$ to rotate. But now I'm very worried that this way, it cannot generate really uniformed distributed points. What if the triangle is not symmetric?

2

There are 2 best solutions below

0
On BEST ANSWER

This answer is centered on the question about generating points at random in the unit disk. A simple method has two steps, as Commented by @JeanMarie:

(a) Generate candidate points at random in the square with vertices at $(-1,-1)$ and $(1,1).$ This can be done by generating $x$-coordinates from $\mathsf{Unif}(-1,1)$ and independently generating $y$-coordinates according to the same uniform distribution.

(b) Then retain only points falling inside the disk.

This is implemented in R statistical software as below. The final statements explore the $\mathsf{Beta}(2,1)$ distribution of distances $D$ from the accepted points to the center.

set.seed(1234);  m = 10^6
x.cand = runif(m, -1, 1);  y.cand = runif(m, -1, 1)
d.cand = sqrt(x.cand^2 + y.cand^2);  inside = (d.cand < 1)
x = x[inside];  y = y[inside];  d = d.cand[inside]
mean(d);  sd(d)
## 0.6666624    # aprx E(D) = 2/3
## 0.2356152    # aprx SD(D) = sqrt(1/18)
mean(inside)
## 0.784404     # fraction of accepted points, aprx pi/4

hist(d, prob=T, col="skyblue2")
curve(dbeta(x, 2, 1), lwd=2, col="red", add=T)

enter image description here

A million candidates were generated and $784\,404$ of them were accepted. The illustration below shows only $50\,000$ points (for clarity), corresponding accepted ones in red.

enter image description here

6
On

Consider two bands of points: those whose distances from the center are on the interval $[0.1,0.2]$, and those whose distances are on the interval $[0.8,0.9]$. Note that the second band has greater area than the first band, and it is thus more likely to pick a point in the second band, if the distribution is uniform.

Does that help?