OU blog

Personal Blogs

Linearity of Expectation Again

Visible to anyone in the world

Linearity of Expectation can pop in surprising places.

Buffon's needle is a famous experiment first published by the Comte de Buffon in 1777. His idea was to repeatedly throw a short needle on to an array of equally spaced parallel lines and count how often the needle crossed a line. This can then be used to estimate the value of the famous number π, a rather surprising fact.

Suppose the lines are spaced 1 unit apart and the needle is of length L less than 1, so the needle will cross at most one line. Then it can be shown the average number of crossings is 2 x L/π.

The standard way to work this out uses calculus, but reading around Linearity of Expectation I came a cross a far simpler way.

In the sketch below the circles are of diameter 1 and you can see that a circle however positioned will have exactly 2 points in common with the array of paralle lines.


So we can say immediately that the expected number of crossings when a circle is placed on the array of parallel lines is 2.

Now imagine replacing the circle with a polygon made up of many tiny needles each of identical length L. The polygon will only be an approximate circle, but if the needles are very short the approximation will be good.

Given the circle has diameter 1 its circumference will be π x 1 = π and the approximating polygon will require π / L needles. Suppose we define an indicator which is 1 if a given needle crosses a line and 0 otherwise. Let the expected value of this indicator variable be E. This is the same for all the needles; it represents the average number of crossings, not the actual number of crossing by any particular needle.

Using linearity of expectation and adding this expectation E across all the π / L needles we get E x π / L and this must be the expected number of crossing for the circle, because the needles taken together make up the circle! So E x π / L = 2.

Rearrange this slightly and voilà! - we have Buffon's formula.

E = 2 x L / π

This extremely neat and simple approach was found by Barbier as long ago as 1860 but I only stumbled across it a couple of days back.

We need to do a little more work before we have a complete proof, because we've assumed L is very small. What if it's not? I'll add something in the comments about this.



Permalink Add your comment
Share post

Comments

A simulation

I wrote a Python to simulate the experiment with needles of different lengths, with these results

aggregated count for 1 needles of length 1.0 thrown 10000 times each = 6300
ratio = 0.63
for comparison 2/pi = 0.63662

aggregated count for 10 needles of length 0.1 thrown 10000 times each = 6363
ratio = 0.6363
for comparison 2/pi = 0.63662

aggregated count for 100 needles of length 0.01 thrown 10000 times each = 6350
ratio = 0.635
for comparison 2/pi = 0.63662

aggregated count for 1000 needles of length 0.001 thrown 10000 times each = 6333
ratio = 0.6333
for comparison 2/pi = 0.63662

You can see that dividing the needle of length 1 into 10, 100, 1000 smaller needles and finding their combined number of line crossings has the same result. There are fewer crosiing per needle but more needles, so the expected total number of crossings remains the same.

The approximation to 2/pi is only good to two figures and it's not a practical way to find pi, we'd need astronomical numbers of throw to get say 10 figure accuracy, but it is interesting that pi can be estimated in this way.