The Buffon Needle Problem Revisited in a Pedagogical Perspective

Ivar G. Johannesen

Imagine a floor marked with many equally spaced parallel lines and a thin stick whose length exactly equals the distance L=1 between the lines. If we throw the stick on the floor, the stick may or may not cross one of the lines. The probability for a hit involves π. This is surprising since there are no circles involved; on the contrary, there are only straight lines. If we repeat the experiment many times and keep track of the hits, we can get an estimate of the irrational number π. (We also consider sticks of length L>1.)

The problem can easily be done as an exercise in a first calculus course, where the students are challenged to consider concepts such as probability, definite integration, symmetry, and inverse trigonometric functions. The solution to this problem therefore gives many applications in a variety of fields in calculus.

We continue by throwing regular polygons of different sizes, increasing the number of edges, and at last reach the ultimate goal of throwing circular objects. This article illustrates the process of throwing sticks, polygons, and circles analytically and graphically, and how to carry out calculations for different n-gons. The result always involves the number π, except when the circle is introduced! We also show the circle result as a limiting value as n increases to infinity.

Introduction

The problem of throwing sticks on a set of parallel equidistant lines was first raised by the French naturalist and mathematician Georges Louis Leclerc Comte de Buffon in 1733 and later solved in 1777 by Buffon himself. Despite the apparent linearity of the situation, the result gives us a method for computing the irrational number π. For more than 250 years, scientists have been intrigued by this puzzle, as can be seen by a quick search on the internet. Many authors have extended the exercise to throwing regular polygons. This article considers regular polygons with either even or odd n. When the number of vertices is even, opposite vertices are situated on the diameter of the circumscribed circle. There are no diametrically opposed vertices in odd regular polygons; therefore, these n-gons are more challenging for students to handle. The length L of the stick is replaced by the diameter L of the circumscribed circle when regular polygons are considered.

This article illustrates the process of throwing sticks, polygons, and circles analytically and graphically, and how to carry out calculations for different n-gons. The mathematics necessary are elementary and suitable for students in a first calculus course. The students will solve the necessary integrals and calculate the probabilities by hand before invoking Mathematica.

The introductory part of the lab considers sticks of length L=1—the same unit length as the distance between lines. The idea is described in [1, 2], including relevant Mathematica code for illustrations. Each throw can be fully described by two parameters: the distance y from the center of the stick to the nearest line, and the acute angle θ that the stick makes with any parallel line (Figure 1).

In the parameter space (θ,y), the graph of the function y=(1/2) sin θ is the border line between the areas representing hits and misses. Due to symmetry, we need only consider  0≤y≤(1/2), 0≤θ≤(π/2) (Figure 2).

Relating to the main topic in this article, we regard the stick as a degenerate polygon with two vertices and reformulate our function expression accordingly.

The probability of hitting a line is the ratio of the area under the graph to the area of the parameter space.

P[hit] = (((∫_0^(π/2))(1/2)Cos[(π/2)-θ]\[DifferentialD]θ)/(π/4))

This result is interesting because it suggests a way to estimate the number π. Let a group of students draw parallel, equidistant lines on a large piece of paper and throw a substantial number of sticks on it, keeping a record of the hits. If n needles hit a line out of t tries, then the students get an approximation ((2t)/n)≈π.

Long Sticks

Let us look at sticks with arbitrary length L. When L≤1, the probability of hits is directly proportional to L. When L>1, large values of θ always give hits. Here is the situation for L=2.

Plot[Cos[(π/2)-θ],{θ,0,(π/3)},PlotRange->{{0,(π/2)},{0,(1/2)}},Frame->True,FrameLabel->{Style[θ,Larger],Style[y,Larger]},RotateLabel->False,PlotStyle->Thickness[0.01],FrameTicks->{{0,(π/6),(π/3),(π/2)},Automatic}]

For θ≥(π/6), the stick of length 2 always crosses a line because it is inclined so much. On the other hand, arbitrarily long sticks can avoid hitting a line if the inclination is small enough. The probability for a stick of length L is given by the function probSticks.

probSticks[L_]= (4/π)If[L <1,(∫_0^(π/2))(L/2)Sin[θ]\[DifferentialD]θ,((1/2)((π/2)-ArcSin[(1/L)]) + (∫_0^(ArcSin[(1/L)]))(L/2)Sin[θ]\[DifferentialD]θ)];

The expression is interesting for several reasons. First, we have a “real” situation in which an inverse trigonometric function arises naturally. Second, the definite integral that makes up the last term is noteworthy in that finding an antiderivative is easy, while evaluating it at the integral’s endpoints requires a little more work. The students are encouraged to simplify cos(arcsin(1/L)) and verify the following simpler expression.

probSticks[L_]:=If[L≤1,((2 L)/π),((2 )/π)((L-(Sqrt[(L^2)-1]))+ ArcCos[(1/L)] )]

The probabilities always involve the factor (1/π). For L≤1, the graph is linear.

probSticks [1]

N[%]

The results can be summarized for sticks of any length by plotting the probability of hitting a line as a function of L.

Plot[probSticks[L],{L,0,15},PlotStyle->Thickness[0.015],Epilog->{Blue,Dashing[{0.02}],Line[{{1,0},{1,1}}]},AxesLabel->TraditionalForm/@{Style[x,Larger],Style[P[x],Larger]}]

Tossing Squares

We start our investigation of regular polygons by tossing squares on the ruled floor. Let θ be the acute angle between the vertical and a line through the square's center and the midpoint of an edge (Figure 3). Other choices for the angle are also possible.

The graph in the parameter space dividing hits and misses is given by y=(L/2) cos((π/4)-θ), where L is the length of the square’s diagonal. This is the same as the diameter of the circumscribed circle. Due to symmetry, it is enough to consider 0≤θ≤(π/4).

For L≤1, we always have y≤(1/2). What about squares whose diameter is greater than 1? Since the θ parameter is restricted to [0, (π/4)], we must consider the limit L=(Sqrt[2]). If L increases beyond that value, there are always hits with at least one side of the square. Then the curve dividing hits and misses is greater than 1/2 for all values of θ, and the plot in parameter space is empty. When L>1, the polygon hits a line if (L/2)cos((π/4)-θ)<(1/2) and θ<(π/4). This means that θ>(π/4)-arccos((1/L)).

Show[Table[Plot[(1/2) L Cos[(π/4)-θ],{θ,0,If[L≤1,(π/4),(π/4)-ArcCos[(1/L)]]},PlotRange->{{0,(π/4)},{0,(1/2)}},Frame->True,FrameLabel->{Style[θ,Larger],Style[y,Larger]},RotateLabel->False,PlotStyle->Thickness[0.01],FrameTicks->{{0,(π/16),(π/8),(π/4)},Automatic},DisplayFunction->Identity],{L,0.6,1.4,0.2}],DisplayFunction->$DisplayFunction]

The area in parameter space corresponding to hits is

(∫_0^(π/4))(L/2)cos((π/4)-θ)dθ = (∫_0^(π/4))(L/2)cos θdθ

for L≤1, and

(1/2)((π/4)-((π/4)-arccos((1/L))))+(∫_0^((π/4)-arccos((1/L))))(L/2)cos((π/4)-θ)θ=(1/2)arccos((1/L))+(∫_(arcCos((1/L)))^(π/4)) (L/2)cos θdθ

for 1<L<(Sqrt[2]). This gives us the probability function

probSquare[L_]:= (8/π) Piecewise[{{(L/2)(∫_0^(π/4))Cos[θ]\[DifferentialD]θ,0 ≤L ≤1},{((1/2)ArcCos[(1/L)] +(L/2) (∫_(ArcCos[(1/L)])^(π/4))Cos[θ]\[DifferentialD]θ), 1<L ≤ (Sqrt[2])},{(π/8),True}}]

{probSquare[1],probSquare[(Sqrt[2])]}

N[%]

Hexagons

Throwing hexagons follows the same outline as squares. Opposite vertices lie on the diameter of the circumscribed circle, and so we have symmetry about θ=(π/6).

For L>1, the hexagon hits a line when θ≥(π/6)-arccos ((1/L)). For L≥(2/(Sqrt[3])), at least one line is always hit (Figure 4).

probHexagon[L_]:= (12/π) Piecewise[{{(L/2)(∫_0^(π/6))Cos[θ]\[DifferentialD]θ,0 ≤L ≤1},{((1/2)ArcCos[(1/L)] +(L/2) (∫_(ArcCos[(1/L)])^(π/6))Cos[θ]\[DifferentialD]θ), 1<L ≤ (2/(Sqrt[3]))},{(π/12),True}}]

{probHexagon[1], probHexagon[(2/(Sqrt[3]))]}

Octagons

We continue with octagons (Figure 5).

For L>1, the octagon hits a line when θ≥(π/8)-arccos ((1/L)). For L≥(( 1)/(cos((π/8)))), at least one line is always hit.

Off[N::meprec]

probOctagon[L_]:= (16/π) Piecewise[{{(L/2)(∫_0^(π/8))Cos[θ]\[DifferentialD]θ,0 ≤L ≤1},{((1/2)ArcCos[(1/L)] +(L/2) (∫_(ArcCos[(1/L)])^(π/8))Cos[θ]\[DifferentialD]θ), 1<L ≤ (Sqrt[4-2(Sqrt[2])])},{(π/16),True}}]

{probOctagon[1], probOctagon[(1/(Cos[(π/8)]))]}

probOctagon[1]/. Sin[x_]-> (Sqrt[((1-Cos[2 x])/2)])// Simplify

N[%]

Dodecagons

Before treating the general 2n-gon, here is the case of the dodecagon (Figure 6).

probDodecagon[L_]:= (24/π) Piecewise[{{(L/2)(∫_0^(π/12))Cos[θ]\[DifferentialD]θ,0 ≤L ≤1},{((1/2)ArcCos[(1/L)] +(L/2) (∫_(ArcCos[(1/L)])^(π/12))Cos[θ]\[DifferentialD]θ), 1<L ≤ 2(Sqrt[2-(Sqrt[3])])},{(π/24),True}}]

{probDodecagon[1],probDodecagon[(1/(Cos[(π/12)]))]}

N[%]

2n-gons

For higher-order n-gons where n is even, we encounter the same sort of symmetry about θ=(π/n) and always get a hit when L≥(1/(cos((π/n)))).

probNgon[n_?EvenQ,L_]:= ((2 n)/π) Piecewise[{{(L/2)(∫_0^(π/n))Cos[θ]\[DifferentialD]θ,0 ≤L ≤1},{((1/2)ArcCos[(1/L)] +(L/2) (∫_(ArcCos[(1/L)])^(π/n))Cos[θ]\[DifferentialD]θ), 1<L ≤ (1/(Cos[(π/n)]))},{(π/(2n)),True}}]

{probNgon[20,1],probNgon[20,(1/(Cos[(π/20)]))]} (* icosagon *)

Tossing Triangles

Next we look at equilateral triangles. In a regular odd polygon, the adjacent vertices do not lie on the diameter of the circumscribed circle. This means that we must take the full distance between lines into consideration.

Let y be the vertical distance from the top line to the center of the triangle. This is where the medians cross; the medians are also the altitudes since the triangle is regular. From Figure 7, we see that the border line between the hit and miss areas is y=(L/2)cos((π/3)-θ), where L is the diameter of the circumscribed circle. This means that the altitudes (medians) have length ((3L)/4). For L>(4/3), the triangle therefore has to cut one or more lines.

But there is another border line, as Figure 8 shows.

Thus the hit area consists of two distinct parts in parameter space.

Plot[{(1/2) Cos[(π/3)-θ],1-((Cos[θ])/2)},{θ,0,(π/3)},Frame->True,FrameLabel->{Style[θ,Larger],Style[y,Larger]},RotateLabel->False,PlotStyle->Thickness[0.01],FrameTicks->{{(π/6),(π/3)},Automatic},PlotRange->{0,1}]

The total hit area in parameter space is therefore:

(∫_0^(π/3))(L/2)cos ((π/3)-θ)dθ+(∫_0^(π/3))(1-(1-(L/2)cos θ))dθ=(∫_0^(π/3))(L/2)cos ((π/3)-θ)dθ+(∫_0^(π/3))(L/2) cos θdθ =(∫_0^(π/3))L cos θdθ.

We can see that the two separate areas are equal, which simplifies the probability calculation.

probTriangle[1]= (3/π)(∫_0^(π/3))Cos[θ]\[DifferentialD]θ

N[%]

y[x_,L_]:=(L/2)(Cos[(π/3)-x]+Cos[x])

{Solve[y[(π/6),L]==1,L],Solve[y[(π/3),L]==1,L]}// Flatten

When (2/(Sqrt[3]))<L<(4/3), the triangle cuts the line when θ>(Subscript[θ, 1]), where (Subscript[θ, 1]) is the solution of the equation (L/2)(cos( (π/3)-θ)+cos θ )=1, given 0<θ<(π/6). For L ≥(4/3), the triangle has to cross at least one line, since then (Subscript[θ, 1])≤0. Note that (4/3)=((((2/(Sqrt[3]))))^2).

probTriangle[L_]:= If[L≤(2/(Sqrt[3])),(3/π)(∫_0^(π/3))L Cos[ x]\[DifferentialD]x]

{probTriangle[1],probTriangle[(2/(Sqrt[3]))]}

Pentagons

The calculations for other odd-sided polygons follow the same outline as for triangles.

y[x_,L_]:=(L/2)(Cos[(π/5)-x]+Cos[x])

{Solve[y[(π/10),L]==1,L],Solve[y[0,L]==1,L]}// Flatten

If L≥(8/(5+(Sqrt[5]))), the pentagon has to cut one line. Again we see that this limit is the square of the lower limit, as was the case with n=3. For (Sqrt[(8/(5+(Sqrt[5])))])<L<(8/(5+(Sqrt[5]))), there are always hits if θ>(Subscript[θ, 1]), where (Subscript[θ, 1]) is the solution to the equation (L/2)(cos((π/5)-θ)+cos θ)=1, given  0<θ<(π/10).

probPentagon[L_]:= If[L≤ (Sqrt[(8/(5+(Sqrt[5])))]), (5/π)(∫_0^(π/5))L Cos[x]\[DifferentialD]x]

{ToRadicals[probPentagon[1]],probPentagon[(Sqrt[(8/(5+(Sqrt[5])))])]}

(2n+1)-gons

Define the function:

y[x_,L_]:=(L/2)(Cos[(π/n)-x]+Cos[x])

Here is the value of L, where all polygons in the most symmetric position hit a line.

Solve[y[(π/(2 n)),L]==1,L]

Here is the value of  L, where every polygon hits a line, independent of rotation.

Solve[y[0,L]==1,L]

For higher-order n-gons where n is odd, we always hit a line when L≥(2/(1+cos((π/n))))=((((1/(cos((π/(2n)))))))^2). For L≤(1/(cos((π/(2n))))), the probability is proportional to L, and for (1/(cos((π/(2n)))))≤L≤((((1/(cos((π/(2n)))))))^2), there is always a hit if θ≥(Subscript[θ, 1]), where (Subscript[θ, 1]) is a solution of the equation (L/2)(cos( (π/n)-θ)+cos θ)=1, given 0<θ<(π/(2n)).

Tossing Coins

Suppose a penny with diameter L is thrown on a ruled surface. The position of the coin is independent of the angle θ, and the circle hits the line whenever  y≤(L/2) (Figure 9).

In this case the parameter space is one-dimensional, but we can define a random value (Subscript[θ, max]) and create a rectangle [0,(Subscript[θ, max])]×[0,(1/2)]. The probability for hitting a line is therefore (L/2)/(1/2)=L that is directly proportional to L when L≤1. The next plot illustrates the situation when L=(3/4).

Plot[(3/8),{θ,0,(π/2)},Frame->True,FrameLabel->{Style[θ,Larger],Style[y,Larger]},RotateLabel->False,PlotStyle->Thickness[0.01],PlotRange->{0,0.5},FrameTicks->{{0,(π/2)},{0,0.375,0.5}}]

probCircle[L_]:= If[L< 1,L,1]

{probCircle[(3/4)], probCircle[1]}

For the first time, when the circle actually appears on the scene, the result does not involve π!

Summary for the Case L=1

In this article we extended the Buffon needle problem to include polygons thrown on a ruled floor and calculated the probabilities for hits for various values of the diameter L of the circumscribed circle. Each time the answer involved the irrational number π and therefore indicated a simulation to estimate the value of this famous number. Here is a summary of the results for L=1 (the stick counts as a 2-gon).

({{n, p, N[p]}, {2, (2/π), 0.63662}, {3, ((3(Sqrt[3]))/π), 0.82699}, {4, ((2(Sqrt[2]))/π), 0.90032}, {5, ((5 (Sqrt[(1/2)(5-(Sqrt[5]))]))/π), 0.93549}, {6, (3/π), 0.95493}, {8, ((4 (Sqrt[2-(Sqrt[2])]))/π), 0.97450}, {12, ((3(Sqrt[2])((Sqrt[3])-1))/π), 0.98862}, {∞, 1, 1.00000}})

For each value of n, we find p(n)=((n sin((π/n)))/π)=((sin((π/n)))/(π/n)), and therefore (lim_(n->∞))p(n)=1. Taking the limit as the number of vertices in the regular polygon tends to infinity, we therefore reach the result for tossing circles on the ruled floor.

For even n-gons we found the border line to be y=(L/2) cos((π/n)-θ) for  0≤ θ≤((2π)/n). All n-gons would cut a line if L≥(1/(cos((π/n)))). As n->∞,  y->(L/2), which is independent of θ and always hits a line when L≥1. This is in agreement with the circular case.

For odd n-gons, we found y=(L/2)(cos((π/n)-θ)+cos θ), 0<θ<(π/n). All n-gons would cut a line when L≥(2/(cos((π/n))+1)). As n->∞, this again is in accordance with the circle case.

Thus the result of throwing pennies is fully compatible with the limiting results obtained by studying n-gons for large n.

In the Mathematica code, we had to take into consideration the parity of n when calculating the border line function, but the probability function for L=1 could be simplified to one formula for all n.

y[n_?EvenQ][x_,L_]:=(L/2)(Cos[(π/n)-x])/; 0 ≤ x ≤ (π/n)

y[n_?OddQ][x_,L_]:=(L/2)(Cos[(π/n)-x]+Cos[x])/; 0 ≤ x ≤ (π/n)

probNgon[n_]:= (n/π)(∫_0^(π/n))Cos[θ]\[DifferentialD]θ

Reference

E. W. Packel and S. Wagon, Animating Calculus: Mathematica Notebooks for the Laboratory, 2nd ed., New York: TELOS/ Springer-Verlag, 1996.

E. W. Weisstein. “Buffon’s Needle Problem” from Wolfram MathWorld—A Wolfram Web Resource.
mathworld.wolfram.com/BuffonsNeedleProblem.html.