4
Probability Simulation with a Spreadsheet Author(s): Richard Bridges Source: Mathematics in School, Vol. 28, No. 4 (Sep., 1999), pp. 14-16 Published by: The Mathematical Association Stable URL: http://www.jstor.org/stable/30212031 . Accessed: 06/04/2014 08:21 Your use of the JSTOR archive indicates your acceptance of the Terms & Conditions of Use, available at . http://www.jstor.org/page/info/about/policies/terms.jsp . JSTOR is a not-for-profit service that helps scholars, researchers, and students discover, use, and build upon a wide range of content in a trusted digital archive. We use information technology and tools to increase productivity and facilitate new forms of scholarship. For more information about JSTOR, please contact [email protected]. . The Mathematical Association is collaborating with JSTOR to digitize, preserve and extend access to Mathematics in School. http://www.jstor.org This content downloaded from 173.56.112.90 on Sun, 6 Apr 2014 08:21:05 AM All use subject to JSTOR Terms and Conditions

Probability Simulation with a Spreadsheet

Embed Size (px)

Citation preview

Probability Simulation with a SpreadsheetAuthor(s): Richard BridgesSource: Mathematics in School, Vol. 28, No. 4 (Sep., 1999), pp. 14-16Published by: The Mathematical AssociationStable URL: http://www.jstor.org/stable/30212031 .

Accessed: 06/04/2014 08:21

Your use of the JSTOR archive indicates your acceptance of the Terms & Conditions of Use, available at .http://www.jstor.org/page/info/about/policies/terms.jsp

.JSTOR is a not-for-profit service that helps scholars, researchers, and students discover, use, and build upon a wide range ofcontent in a trusted digital archive. We use information technology and tools to increase productivity and facilitate new formsof scholarship. For more information about JSTOR, please contact [email protected].

.

The Mathematical Association is collaborating with JSTOR to digitize, preserve and extend access toMathematics in School.

http://www.jstor.org

This content downloaded from 173.56.112.90 on Sun, 6 Apr 2014 08:21:05 AMAll use subject to JSTOR Terms and Conditions

Probability Simulation with

adS p sh

by Richard Bridges

An appreciation of probability is an important part of the National Curriculum--and rightly so. In this article I want to suggest that a spreadsheet may be a more effective tool for classroom experimentation than traditional dice and coins. There are two main reasons for this. Firstly, it is quicker to generate large data samples. Secondly, it is more flexible, al- lowing a wider range of experiments. I will comment on some of the possibilities one by one, and attach a sample worksheet that I have used in exploring them with pupils. I shall assume Microsoft's Excel is being used, but other spreadsheets are very similar.

Simulating a Single Fair Die

The spreadsheet formula =RAND() will produce a random decimal between 0 and 1. This can be turned into a fair die by multiplying by 6, taking the integer part and adding one. For simplicity the worksheet takes pupils through the steps to do this in adjacent spreadsheet cells:

however, it is perfectly possible in a single cell using: =INT(6*RAND())+1

Pressing the f9 key forces Excel to generate a new random number (as part of recalculating the worksheet). It is quite feasible to generate 100 'rolls' of the die in a very short time by repeatedly pressing f9. If, as suggested on the worksheet, the values are recorded into a tally table, the data can be used as a source of class discussion.

Even such a simple experiment raises several important issues. Is the die fair? What do we mean by 'fair'? The numbers didn't all come up the same number of times (same frequency), so does this mean the die is unfair? What is a

14

reasonable deviation from equal frequencies for a fair die? Does this depend how many times you roll it? How can we estimate the probability of getting a six from our data? What should the probability of a six be in theory? How much does the 'experimental probability' differ from the theoretical value? Does this depend on the number of rolls?

The Sum of Two Fair Dice

Many dice games involve rolling two dice and using the sum of the two values. This is easy to simulate:

~:~'~:~ss~aaass%x~slslss~slsa~%sasresa

I" I 6"~~1~-~4 +~4

~., ................ .. _. _.. . .- -, ..

Again, pressing f9 generates a new total in C1, so that it is very quick to record 100 'rolls' into a tally table. The new feature in this situation is the unequal theoretical probabili- ties of the various values. Even quite able pupils will tend to say that these are all 1/12, or 1/11 once they've realized that 1 is not a possible value! Yet their experimental data will clearly contradict this. The scene should be set for a valuable discus- sion on how many ways two dice can actually land, and how many ways each total can arise. Once the correct theoretical probabilities of 1/36, 2/36, etc. are agreed, the experimental probabilities can be compared with them. The varying values obtained are a result of the unequal theoretical probabilities overlaid with the inherent deviation from theory found in any finite random sample.

At this point, several opportunities are available for further experiments. Which are taken will depend on the time available and the preferences of the teacher. I mention three possibilities, in no particular order:

Simulating Unfair Coins

A fair coin may be generated from a random number using the IF command:

A"i . . . . .

1

=RAD"

= (A<05"Had Ta

"

It may easily be made unfair to any desired degree by altering the 0.5-the worksheet suggests 0.25. A reasonable exercise is to set up two such unfair coins, and record a tally table of the number of heads shown by the coins (i.e. 0, 1 or 2 heads) in each of around 100 'tosses'. It is then a useful discussion exercise to arrive at the correct theoretical proba- bilities of each number. These could be approached via a possibility space for two four sided dice, or via tree diagrams. Ideas of independence naturally arise. Finally, experiment may be compared with theory.

Automated Samples

An obvious exercise would be to graph the tally table data, particularly for the sum of two dice. Though valuable in itself as a manual task, yet further insights can be gained by making the computer do the work. The techniques exist to set up a spreadsheet that, on pressing f9, 'rolls' two dice 100 times, compiles the frequency distribution, and graphs it. Here is a sketch of how to do it:

Set up fair dice in Al and B1, and their sum in C1, and copy these down the columns to row 100. Enter the possible values for the sum: 1, 2, 3, ..., 12 down column E from El to E12. Highlight the cells beside them in column F (F1 to F12) and enter the following formula:

=FREQUENCY(C1:C100, E1:E12)

Mathematics in School, September 1999

This content downloaded from 173.56.112.90 on Sun, 6 Apr 2014 08:21:05 AMAll use subject to JSTOR Terms and Conditions

This counts the values in the C cells into the categories given in the E cells. It needs to be entered into all the F cells together as an 'array formula', so don't just press Enter to finish it off. Instead, hold down CTRL and Shift and press Enter while they're held down. The frequencies should now appear. On pressing f9 the dice are effectively rolled another 100 times and the frequencies updated. It's now easy to create a bar chart by highlighting the frequencies in the F cells and using the 'Chart Wizard'. Pressing f9 now updates the chart as well (it's a good idea to 'lock' the vertical scale at a maximum of 25 to prevent spurious re-scaling as the samples vary). The tremendous variety obtained from different samples is a valuable lesson in statistical variability:

20.

15

10

5

t--

How Many Rolls to Start a Game? Many games at some point involve rolling a die until some desired number is obtained. The following spreadsheet counts the number of tosses of a fair coin until the first head is obtained:

The formulae in cells A2 and B2 are copied down the

j:A

column for some way-at least 10 rows. In use, the spread- sheet produces a display like this:

3~xz~x Tad 1) rl I

:;~ ~ ~;~ ~~~~~~~~~~~~~~~~~~~~~~~..... ........x........ .x.x..xx...x..;..:x

;x;x;=;x ... .... ........

~~ai t ~ !I T~Ii l i............ Tudi 8 H e a d

:::::: ....... :........................ ..... . . .... .. .... .. . . ..... . . . . ... . .2.. ........ ....... .... .. . . ... .

Working out the theoretical probabilities of the various numbers of rolls needed is reasonably challenging, and is the idea behind some published GCSE coursework tasks. Here, particularly, the opportunity to generate a good sample of experimental data to compare with theory is valuable.

I have used some of these ideas with (bright) Year 8 pupils, via the following worksheet. There would clearly be a role for simulations of this type through GCSE to Sixth Form level pupils-the automated frequency distribution could easily be extended to a chi-squared calculation, for example. M See worksheet on p. 16.

Author Richard Bridges, King Edward's School, Birmingham B15 2UA.

A unique way of teaching and learning mathematics

"....must be worth a close look by all secondary schools...."

Review of Algebra 1 in May issue of Mathematics in Schools

This series of products represents a new system for learning and teaching mathematics. The CD ROM-based software covers the material required for GCSE mathematics and part of the A level syllabus. They can be used for individual study, or as a class activity on a local area network.

The products make use of unique Virtual Laboratories' that make

mathematical concepts easier to understand, provide an unlimited number of worked examples, motivate students and build students' confidence.

Single user: x49 10 user network: x99

~ XZi ~i~i~ii~ii~i~j~~i~i~i~~~

"" i~i~iic~ ~j x:~x:~x:x:x:i~x:~x:~x:i''~x

~~~iQi~~iaiai~i!ii~i~a~~~ ~~ 4ii~~jiiiiFi~i~i~i~i~i~i~ x: xx.:~~1Fii~'4~.j'ii~iiiiii~~ :::::::::i::::::::

ri.rSx.Cj~~j~:~lrll i

~:~:~~~~~'i:~::j::~::::::: ~iiiii~~iljj COiiX W~Ziiiiili5ii:ilBlilililiii::::::::::::i:

i~iii I: "x"x''~x: i~~~:~~~ili~cxlaiWrisXr .: ...::::::::I:I::::::: :I:I x:x::~:~:2:~:ij'a:I:~ x:x:x ... -:i:::::::i::i:::::::::::::~xr::`:cr:--:

j xxxxxxxxxxxxxxxxxxx-: ~:~:l::i:::i:::::::::::::i''~~ x~x ~iajsj:iiji~i~

~d~~~i~i ~iXiXl~~~ji

~i~i~i'~ ~i~iiXX O~i~~il~~

~x111CiX~i~iPiIiS

~~~~~

j3QiiXiXi~ ~i~''~:'~'~f'l~BDiiiiiu:ixi:j ~.l:X.. ~. ;.x:x:x:x:x:x:x:-x:x:x:x:x:x

~x~x~

(lI(1111)1~(1(11111~~tllll[tl~~~il~Itlll

rmmm m n~r tt~ nr It nl 3 ~1 :r~l I1~11~:~,~ IIcr ,Ill):(L'llllllliil4(I((LI~,IIII: 'I~Itl IMl(t~r,!~rrr~vLII'Il(lll):(L'11111111

Mathematics in School, September 1999

diffeen t Mo

e~ 2 Test ayfB~~~g~

I

15

This content downloaded from 173.56.112.90 on Sun, 6 Apr 2014 08:21:05 AMAll use subject to JSTOR Terms and Conditions

Investigating Probability with the Excel 97Spreadsheet

This sheet will show you how to use the Excel spreadsheet to simulate a die and check whether it is fair or not. You will also investigate the probabilities of the various possible totals when you add together two dice, and look at the effect of creating unfair coins. You should work in pairs for this exercise.

Simulating a Die Log on to your computer and start up Excel. Click the mouse in cell Al and enter the formula:

=RAND() and press Enter. A number should appear in the cell. Press key f9 a few times; this tells the spreadsheet to recalculate. The number in Al should change at random. Notice what possible values appear.

This is no good for a die yet. In cell B1 type the formula: = A1"6

(You can click the mouse on Al instead of typing it). Press f9 a few times. This is more like a die, but not yet whole numbers. In cell C1 put the formula:

=INT(B1) and press f9. This rounds to the next whole number below and is nearly like die scores, but you need to add 1. Do this in cell D1. 'Roll' the 'die' by pressing f9 and check that you get scores between 1 and 6.

Is the Die Fair? Work out how you could use the results from a number of presses of f9 to check whether your simulated die gives a fair probability for each number. In your book lay out a table of the possible values and keep a tally of which one occurs as you keep pressing f9. You need a large sample for good results, which needn't take long with a tally table. Go for around 100 'rolls' of your 'die'.

From your data work out the experimental probability of each number occurring. What do you think the theoretical probability should be? Do they agree fairly well?

Two Dice Highlight the cells forming your die, Copy, then Paste into row 2. Then use cell E2 to add the two 'dice' together. Roll the dice a few times to check everything is working.

Now set up a tally table for the score from the two dice, and go for about 100 rolls again. Are all values equally probable? What is the experimental probability of 2? What do you think it should be theoretically? What about 3? And the other values?

Simulating Coins Choose a blank row of your sheet (row 4?) and put =RAND( ) into column A. Into column B put:

=IF( A4 < 0.5 , "Head" , "Tail") 'Toss the coin' a few times to check it works. Do you think it is a fair coin? Now make it unfair, so that the probability of a Head is 0.25 -how can you do this? Check that it seems to be working about right. Now copy another similar unfair coin into the row below.

Now set up a tally table for the possible numbers of Heads from the two coins together (i.e. 0, 1, or 2 Heads). Take a reasonably sized sample and work out experimental probabilities. Question: what do you think are the theoretical probabilities of the three possible values?

If you get time, make the coins unfair by a different amount, and repeat the experiment.

16 Mathematics in School, September 1999

This content downloaded from 173.56.112.90 on Sun, 6 Apr 2014 08:21:05 AMAll use subject to JSTOR Terms and Conditions