Heads or Tails? Question: How can Excel model the flip of a coin? Lesson Goals: Understand the probability of tossing a coin. Review previous Excel skills. New Skills: Excel functions RAND and INT. Arranging Excel worksheets and windows. Old Skills: Copy and paste cells. Relative and absolute cell references. |
You’re going to flip a coin ten times and record the result in Excel. You will model the result of a coin flip using “0” for tails and “1” for heads. If you record a great many coin flips as a 0 or 1 value, what does the value average out to? You can use the AVERAGE function to find out: |
|
The first ten coin tosses |
|
The “Average Coin” column is the average of all previous tosses Cell B5 contains the average of cells A2 through A5 |
Excel created these formulas when you entered a formula in
cell B2 and dragged it down in
step 10. When you copy and paste the entire formula, each copy computes the average of all the coin flips starting from the first flip (cell A2) to the coin flip in the row that you paste to. After ten coin flips, the average in the example above is 0.66666667. |
So, you’ve recorded ten coin tosses. You have a “running average” of the tosses. Now you’ll do at least 990 more coin tosses. Really! But the computer is going to do the coin tossing. RAND is an Excel function that returns a random number that is greater than or equal to 0 and less than 1. For example: 0.12523, 0.938923, and 0.23923. With a little math, we can use RAND to randomly get either a 0 or a 1, and nothing in between. Look at: =2*RAND() This doubles the normal RAND function and returns a random number greater than or equal to 0 and less than 2. For example: 1.3923, 0.4239, etc. We want only whole numbers, so we use the INT function, which strips off the part to the right of the decimal point. For example, INT(1.5232) returns 1. So: =INT(2*RAND()) returns either 0 or 1 with equal probability, just like flipping a coin. |
|
RAND returns a number between 0 and 1 Drag columns A and B down past 1000 |
|
Select the entire column |
|
|
Right click exactly on the left edge of the chart Change Maximum to 1 |
|