Wednesday 9 May 2012

Uniformly Distributed Random Points Inside a Circle

So I just started my blog and I already posted my first blog. Now I want to get my hand dirty by posting some math!

The problem I want to consider here is generation of uniformly distributed random points inside different geometric shapes. The simplest shape to consider is a rectangle. In this case, the generation of uniformly distributed random points is trivial. Let \(l\) be the length of the square, \(w\) be the width, and the point \(p_c(x_c,y_c)\) be the center of the rectangle. Let \(p_i(X,Y)\) be a random point inside the rectangle. Here \(X\) and \(Y\) are random variables. For \(p_i\) to be uniformly distributed, \(X\) must be a uniform distribution over the interval \(\left[ l-\frac{x_c}{2}, l+\frac{x_c}{2} \right] \), and \(Y\) must be a uniform distribution over the interval \(\left[ w-\frac{y_c}{2}, w+\frac{y_c}{2} \right] \). Well this is fairly trivial.

Now lets consider a circle. The problem is not as trivial. We define a circle by its radius \(r_c\) and the point representing its center \(p_c(x_c,y_c)\). For simplicity lets assume the center of the circle is on the origin (i.e. \(p_c(0, 0)\) ). The first guess that people typically give (which is wrong) is to use polar coordinates with \(r\) and \(\theta\) uniformly distributed over \(\left[ 0, r_c \right] \) and \(\left[ 0, 2\pi \right] \), respectively. The reason this turn out to be wrong is because the area of a circle with radius \(\frac{r_c}{2}\) and the area of a ring (or doughnut) with width \(\frac{r_c}{2}\) are not the same. What is the correct answer? (I will post the answer with derivation in a few days!)

See the answer here.

No comments:

Post a Comment