PAUL TURNER Coin on a A rich problem square inside a tile such that the side of the inner square was smaller than the side of the If you roll a coin across a chessboard and it tile by an amount equal to the diameter of the comes to rest on the board, what is the prob- coin. And he came to the important realisation ability that it covers some corner of one of the that the associated probability was just the grid squares? ratio of the areas of the smaller and larger squares. The online magazine Plus (2004) posed this In this way, Buffon made the leap from problem for students to solve. It is a useful probabilities calculated by counting — in what problem for several reasons: it introduces the are now called discrete sample spaces — to idea of probability in a continuous sample probabilities involving measuring. He was the space, it has a historical background worth first to apply geometry and the newly invented exploring and it can be simulated easily using tools of calculus to the study of probability. a computer program. In the same memoir, Buffon went on to explain what would happen if the coin were to be replaced by a baguette or stick. This is the Le jeu de franc-carreau origin of the famous Buffon needle problem: The coin-and-chessboard problem is a variant What is the probability that a needle dropped of the problem of finding the odds in an old on a grid of equally spaced parallel lines will game, Le jeu de franc-carreau, in which bets come to rest touching a line? were laid concerning whether a small coin dropped on a square-tiled floor would come to Buffon eventually published his solution to rest touching a crack between the tiles. the needle problem in 1777 in his Essai Georges Louis Leclerc, Comte de Buffon d'arithmetique morale. He showed that the analysed this game in 1733. theoretical probability for this experiment is where d is the distance between the lines and l is the length of the needle (with the restric- tion l < d). We note that the number π appears in the solution. Coin and chessboard The coin-and-chessboard problem is easier to Figure 1 solve than Buffon’s needle problem but the two have a common feature. It happens that Buffon saw that the coin would not touch a the number π is involved in the theoretical boundary if its centre landed within a smaller probability in both. This is because in the 12 amt 62 (3) 2006 coin-and-chessboard problem the area of the To do this, divide up a quarter of the tile as circular coin comes into the calculation. shown, and then find the areas of the two triangles and the sector. Figure 2 It is not hard to see that the coin covers a Figure 4 corner of a grid square whenever its centre lands within a circle with the same radius as In this case, the coin, centred on the corner. We should require the centre of the coin to land on the board. Then, to simplify the situa- tion, we can allow the coin to land on just one square of the 8×8 grid instead of the full 64 — the probability will be the same. For a small enough coin, there is a quad- rant at each corner of a square such that the More history corner will be covered if the centre of the coin lands within the quadrant. A century after Buffon posed the needle problem, the Swiss mathematician and astronomer Johann Rudolf Wolf (1816–1893) had the idea that by comparing the theoretical probability in Buffon’s experiment with a value obtained experimentally, one could obtain an estimate for the value of π. This surprising result is the essence of what have come to be Figure 3 called Monte Carlo methods (after a 1949 paper by Stanislaw Ulam and Nicholas Assuming the radius r of the coin is no Metropolis). more than half the side s of the square, the Buffon’s formula, when rearranged, gives probability P that the coin covers a corner is the relation just the ratio of the total area of the quadrants at the corners to the area of the whole square. So, if C is the event that the coin covers a where P is the probability. Wolf obtained a corner, we have probability estimate by performing the needle experiment a predetermined number of times with fixed values of l and d, counting the It is an interesting although not immedi- number of favourable outcomes. He then ately useful exercise to work out the found π (approximately) by substitution. probability, when r is between The coin-and-chessboard experiment can and be used in a similar way. Fortunately, it is easily simulated with a spreadsheet program amt 62 (3) 2006 13 and can be quickly iterated millions of times — With these arrangements, both the x- and for many more times than Buffon or Wolf y-coordinates of the coin centre are obtained would have had the patience. using the formula =RAND()-0.5. Testing for a In this case, since success is now a matter of checking how far the coin centre is from the origin. Excel works faster if several calculations we can use are combined into one cell. So, a formula like =SUMSQ(RAND()-0.5,RAND()-0.5) can be used to get the squared distance of the centre from with P estimated by the proportion of the origin, and this can then be compared with successes in a large number of trials of the the square of the coin’s radius. In my imple- experiment. mentation this calculation is embedded in an even bigger formula (see Figure 6). Simulation The essential things a simulated coin-and-chessboard experiment must do are: • randomly place the centre of the coin in a two dimensional coordinate system; • check whether each trial has been a success; and • keep a tally while iterating the experiment some speci- fied number of times. For simplicity, we can let the Figure 6 chessboard squares have side length 1. To locate the centre of the coin, two random I found it convenient to automate the coin numbers are needed, one each for the x- and tossing process with a Visual Basic for y-coordinates. In Excel, we can use the Applications procedure. RAND() function: it generates random The code for this is activated by a button on numbers between 0 and 1 with an approxi- the sheet that causes the virtual coin to be mately uniform distribution. tossed ten million times. There is also a button Instead of testing whether the centre of the to reset the experiment. coin lands in one of the corner quadrants, we Setting the radius of the coin to 0.4 will may as well combine the quadrants into one result in successes in about half the trials. To circle at the centre of the square. The coin is save Excel the trouble of calculating the just as likely to land in this central circle as in square of the radius repeatedly, it is possible the corner quadrants. We can put the origin of to set a value for the radius between 0 and 0.5, the coordinate axes in the centre of the and have the VBA procedure calculate the square. square only once for each run of the experi- ment. Cell A5 switches the process on or off depending on whether its value is set to ‘1’ or ‘0’. Formulas in other cells test whether A5 is set to on or off by treating its contents as a boolean variable: ‘1’ in cell A5 evaluates to true, ‘0’ evaluates to false. Cells D5 and F5 include circular references. Figure 5 These enable the contents of the cells to be incremented as the experiment proceeds. To 14 amt 62 (3) 2006 use the circular reference feature in Excel A wave of the hand 2000, go to the Tools menu and select Options and the Calculation tab. Check the Iteration In 10 000 000 trials of the coin-and-chess- box and set Maximum Iterations to 1 (see board experiment, there could be any number Hartley Hyde’s ‘Cactus’ article in The of successes between 0 and 10 000 000. To Australian Mathematics Teacher 60(4), 2004.) each one of these outcomes, it is possible to While at the Calculation tab dialogue box, assign a probability depending on the number select the Manual button. This will make it of successes in the outcome and on the prob- possible for the Visual Basic for Applications ability of a success in a single trial. The code to control which cells are to be updated assignment of probabilities among the on each trial. outcomes in this case is of a particular kind, To put Command Buttons on a spreadsheet called a binomial distribution. and attach code to them, first activate the We need to distinguish between the exact Control Toolbox on the View: Toolbars menu. number π and what is called the estimator Work in Design Mode, selected from the Control Toolbox, making use of the Properties and View Code options. (where m is the number of successes, n is the number of trials, s = 1 is the side of a chess- board square and r is the radius of the coin). Visual Basic for Applications Because the number m varies each time the code experiment is performed, it is a random vari- able — with a binomial probability 'This procedure resets the experiment. distribution. The estimator is also a random variable. Its probability distribution has the Private Sub CommandButton1_Click() same shape as the distribution for m. Dim state As Integer It can be shown that the mean or average state = Range("A5") value of is π, in the sense that is likely to If state = 1 Or state = 0 approach π when n is very large. It can also be Then Range("A5") = 1 - state shown that the variance of , a measure of the Else Range("A5") = 0 degree of spread of its probability distribution, If Range("A5") = 0 is given by Then Range("A1:F7").calculate End Sub This procedure repeats the simulated coin toss From this formula we can see that 10 million times. maximising the coin radius will minimise the variance. If the variance is small, most of the Private Sub CommandButton2_Click() probability is concentrated within a narrow Dim counter As Long, outer_counter As range around the mean. So, for a given Long number of trials in the experiment, the esti- outer_counter = 0 mate for π is likely to be more accurate if the If Range("A5") = 1 Then variance is small. Do In the spreadsheet simulation then, it outer_counter = outer_counter + 1 would be wise to set the coin radius to 0.5, its counter = 0 largest possible value. By trying out different Do coin radii between 0 and 0.5 one can test the counter = counter + 1 validity of the claims made above. Range("D5").calculate According to my calculations, with Loop Until counter = 10000 10 000 000 iterations per experiment and a Range("F5,D7").calculate coin radius of 0.5, the estimate of π will be Loop Until outer_counter = 1000 accurate to two decimal places in more than End If 99.9% of experiments. It will be accurate to End Sub three decimal places about 53% of the time, amt 62 (3) 2006 15 and accurate to four decimal places in less References than 8% of experiments. Looked at another way, the estimate will be Boehringer, R. http://filebox.vt.edu/users/rboehrin/Buffon/FrancCarreau.htm accurate to two decimal places 95% of the time Boyer, C. B. (rev. Merzbach, U. C.) (1989). A History of if the experiment consists of 4.14 × 103 trials; Mathematics. New York: Wiley. it will be accurate to three decimal places 95% Dörrie, H. (1965). Buffon’s needle problem. In 100 Great Problems of Elementary Mathematics: Their History and of the time if the experiment has 4.14 × 105 Solutions. New York: Dover trials; and it will be accurate to four decimal Hyde, H. (2004). Cactus. The Australian Mathematics Teacher, 60 (4), 18–19. places 95% of the time if there are 4.14 × 107 O’Connor, J. J. & Robertson, E. F. (2004). Georges Louis Leclerc trials. Comte de Buffon. Accessed at http://www-history.mcs.st- and.ac.uk/history/Mathematicians/Buffon.html Clearly this is not a good way to calculate π, O’Connor, J. J. & Robertson, E. F. (1996). Johann Rudolf Wolf. but it does provide an interesting way to get a Accessed at http://www-history.mcs.st-and.ac.uk/ history/Mathematicians/Wolf.html feel for a statistical process. Reese, G. (n.d.). Buffon’s Needle: An Analysis and Simulation. Accessed at http://www.mste.uiuc.edu/reese/buffon/buffon.html Weisstein, E. W. (2005). Buffon’s needle problem. Wolfram MathWorld. Accessed at http://mathworld.wolfram.com/BuffonsNeedleProblem.html Plus magazine (2004, September). Puzzle page: High roller. Accessed at http://plus.maths.org/issue31/puzzle/ Paul Turner Melrose High School, ACT [email protected] (cid:40)(cid:71)(cid:88)(cid:70)(cid:68)(cid:87)(cid:76)(cid:82)(cid:81)(cid:68)(cid:79)(cid:3)(cid:53)(cid:88)(cid:79)(cid:72)(cid:85) (cid:46)(cid:37)(cid:55) (cid:48)(cid:50)(cid:47)(cid:36)(cid:53)(cid:35)(cid:52) (cid:70)(cid:79)(cid:82) (cid:89)(cid:79)(cid:85)(cid:82) (cid:18)(cid:16)(cid:16)(cid:23) (cid:34)(cid:47)(cid:47)(cid:43)(cid:44)(cid:41)(cid:51)(cid:52) (cid:33)(cid:76)(cid:82)(cid:69)(cid:65)(cid:68)(cid:89)(cid:0)(cid:84)(cid:72)(cid:79)(cid:85)(cid:83)(cid:65)(cid:78)(cid:68)(cid:83)(cid:0)(cid:73)(cid:78)(cid:0)(cid:33)(cid:85)(cid:83)(cid:84)(cid:82)(cid:65)(cid:76)(cid:73)(cid:65)(cid:78)(cid:0)(cid:51)(cid:67)(cid:72)(cid:79)(cid:79)(cid:76)(cid:83) (cid:48)(cid:76)(cid:81)(cid:88)(cid:86)(cid:3)(cid:68)(cid:81)(cid:71)(cid:3)(cid:83)(cid:79)(cid:88)(cid:86)(cid:3)(cid:81)(cid:88)(cid:80)(cid:69)(cid:72)(cid:85)(cid:3)(cid:79)(cid:76)(cid:81)(cid:72)(cid:3)(cid:73)(cid:82)(cid:85)(cid:3)(cid:68)(cid:71)(cid:71)(cid:76)(cid:81)(cid:74)(cid:3)(cid:68)(cid:81)(cid:71)(cid:3)(cid:86)(cid:88)(cid:69)(cid:87)(cid:85)(cid:68)(cid:70)(cid:87)(cid:76)(cid:81)(cid:74) (cid:56)(cid:86)(cid:72)(cid:73)(cid:88)(cid:79)(cid:3)(cid:73)(cid:82)(cid:85)(cid:3)(cid:74)(cid:85)(cid:68)(cid:83)(cid:75)(cid:86) (cid:42)(cid:72)(cid:82)(cid:80)(cid:72)(cid:87)(cid:85)(cid:76)(cid:70)(cid:3)(cid:86)(cid:75)(cid:68)(cid:83)(cid:72)(cid:86) (cid:55)(cid:76)(cid:80)(cid:72)(cid:86)(cid:3)(cid:87)(cid:68)(cid:69)(cid:79)(cid:72)(cid:86)(cid:3)(cid:72)(cid:68)(cid:86)(cid:76)(cid:79)(cid:92)(cid:3)(cid:68)(cid:70)(cid:70)(cid:72)(cid:86)(cid:86)(cid:72)(cid:71) (cid:48)(cid:72)(cid:87)(cid:85)(cid:76)(cid:70)(cid:3)(cid:88)(cid:81)(cid:76)(cid:87)(cid:86) (cid:33)(cid:86)(cid:65)(cid:73)(cid:76)(cid:65)(cid:66)(cid:76)(cid:69)(cid:0)(cid:70)(cid:82)(cid:79)(cid:77)(cid:0)(cid:89)(cid:79)(cid:85)(cid:82) (cid:51)(cid:51)(cid:35)(cid:35)(cid:40)(cid:40)(cid:47)(cid:47)(cid:47)(cid:47)(cid:44)(cid:44)(cid:0)(cid:51)(cid:51)(cid:53)(cid:53)(cid:48)(cid:48)(cid:48)(cid:48)(cid:44)(cid:44)(cid:41)(cid:41)(cid:37)(cid:37)(cid:50)(cid:50)(cid:51)(cid:51) (cid:50)(cid:14)(cid:50)(cid:14)(cid:48)(cid:14)(cid:0)(cid:4)(cid:19)(cid:14)(cid:16)(cid:16) (cid:87)(cid:87)(cid:87)(cid:14)(cid:77)(cid:65)(cid:68)(cid:77)(cid:65)(cid:84)(cid:72)(cid:83)(cid:14)(cid:66)(cid:73)(cid:90)(cid:0) (cid:67)(cid:79)(cid:80)(cid:89)(cid:82)(cid:73)(cid:71)(cid:72)(cid:84)(cid:0)(cid:80)(cid:82)(cid:79)(cid:84)(cid:69)(cid:67)(cid:84)(cid:69)(cid:68)