A Nice Distribution on the Real Numbers

I wanted to call this post “Throwing Darts at the Real Numbers,” but apparently someone else already came up with that title to talk about something else. This is a follow-up to the last post that talked about why it’s not possible to define a uniform distribution on an unbounded set (like \mathbb{Z} or \mathbb{R}).

Even though it’s not possible to uniformly sample from the real numbers, is there something else that we can choose uniformly that will induce a certain distribution on the real numbers? There is!

What if we were standing some fixed distance (say, 1 unit) away from the real numbers and threw darts at it? If we throw darts at the real numbers, we can describe our throw by the angle that the dart’s path makes with the real number line.

The red line describes the path of the dart towards the real number line, and the angle \theta describes the angle that the dart’s path makes with the line.

Suppose if you were to draw a perpendicular line through where you were standing to the number line, that it passed through the value 0\in \mathbb{R} (slide over the stick figure a bit to the right).

Now, we can define a nice distribution on \mathbb{R} by picking angles \theta\in [-\frac{\pi}{2},\frac{\pi}{2}] uniformly from the probability density function (PDF) \theta \sim U[-\frac{\pi}{2},\frac{\pi}{2}]. This PDF has the equation f(x)=\frac{1}{\pi} when x\in [-\frac{\pi}{2},\frac{\pi}{2}] and f(x)=0 when x<-\frac{\pi}{2} or x>\frac{\pi}{2}. This means that, for example, picking an angle between -\frac{\pi}{4} and \frac{\pi}{4} is just as likely as picking an angle between 0 and \frac{\pi}{2}.

Let’s say you are standing 1 unit away from the real number line and in line with 0 and compute the probability that the dart you throw hits somewhere between 1 and 2.

To compute this probability, we need to find the angle between where you’re standing and each of those points on the number line. Here are the pictures to have in your head.

Now, we want to find the upper and lower bounds of \theta that create these the triangles with top side lengths between 1 and 2. We’re measuring these angles in radians, but it doesn’t really matter as long as we divide by the appropriate scaling factor.

In the first triangle, \theta=arctan(\frac{1}{1})=\frac{\pi}{4}\approx 0.7854, and in the second triangle, \theta=arctan(\frac{2}{1})\approx 1.107.

Now we can compute the probability of hitting this region as \frac{arctan(1)-arctan(2)}{\pi}\approx 0.1024. There’s a \pi in the denominator since from all the way parallel to the number line facing to the left and all the way parallel to the number line facing to the right makes up \pi radians.

This means that if you pick angles uniformly between -\frac{\pi}{2} and \frac{\pi}{2}, there is roughly a 10.24% chance that the number you hit will be in between 1 and 2.

Isn’t that kind of cool? I think so. I’m not sure if this is a standard distribution, so if anyone has any insight into that, let me know!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s