Some Geek Fun with Simple Probability

Elke asked about the motivation behind my latest post on Not Banjaxed, concerning how, when institutions are ranked according to some criteria, the smaller institutions tend to be found both at the top and at the bottom of the rankings. This behavior, described by what mathematicians call the “Law of Large Numbers” is due mainly to the increased variability one associates with smaller samples.

Since the question  is interesting enough to warrant a more detailed response, but it’s not really work related it made sense to respond over here. Or perhaps I have been on the Internet too much lately and am following suit and turning my blogs into click-bait!

As is often the case that post in question came out of a casual conversation I had recently with a friend. His child was doing some math homework for school and was asked to find some way to electronically model the rolling of a pair of dice—something that happens in many board games. The child had chosen to use Microsoft Excel and had simply used the random function to generate random integers from 2 (the lowest you can get on a pair of dice) to 12 (the highest).

I told him that was not correct and then proceeded to explain why. That, in turn, led to a discussion of how what seems simple and straightforward often is not. Since we both had significant experience teaching in rural schools I used the example in the other post to prove my point.

So, a casual conversation led, first to one post, and now to another.

Since I brought up the problem of simulating the tossing of two dice I might as well give you the same explanation.

Tossing two dice does give sum (total) between 2 and 12 but it is not the same as choosing a random number between 2 and 12 because not all of the outcomes are equally likely.

Let’s model all of the outcomes using a table.  The numbers in bold represent what is on the face of each die. Each cell shows the total for the toss.

Die #1
Die #2 1 2 3 4 5 6
1 2 3 4 5 6 7
2 3 4 5 6 7 8
3 4 5 6 7 8 9
4 5 6 7 8 9 10
5 6 7 8 9 10 11
6 7 8 9 10 11 12
Table 1: All of the outcomes if two dice are tossed.

Notice that based on the frequencies in the table, not all of the outcomes are equally-represented. For example, there is only one way to get a Two, namely, by rolling double ones. Likewise, there is only one way to get a Twelve. Other outcomes, “Lucky Seven,” for example, are more frequent.

A histogram that shows the frequencies of each outcome demonstrates this behavior clearly:

Figure 1: Histogram of Outcomes for Rolling Two Dice

Figure 1: Histogram of Outcomes for Rolling Two Dice

The histogram shows the frequency of all of the possible outcomes. It’s clear to see that they are not equally likely. As already mentioned, only one combination can give either a Two or a Twelve. Each of the other outcomes, though, can be obtained in many ways, with Seven being the most frequent of all.

The histogram above shows the frequency of the various types of outcomes. This can be used, in turn, to predict the theoretical probability of obtaining that outcome if the dice were actually rolled. Probability is determined by dividing the number of favourable outcomes by the total number of outcomes.

Let’s find the probability of obtaining “Lucky Seven” for example.  You can see from the histogram that there are 6 ways of getting an outcome of 7. If you check Table 1 you will notice that there are a total of 36 possible outcomes. To get the probability of obtaining an outcome of 7 you just divide the two, that is P(7) = 6/36 or approximately 0.17 (it’s actually a repeating decimal.) If you do this for all of the outcomes then you can recast the histogram as a bar graph showing the probability of any particular outcome.

Figure 2: Theoretical Probability of Each Outcome

Figure 2: Theoretical Probability of Each Outcome

The model chosen by my friend’s child did not take this into account. Choosing a random number between 2 and 12 assumes that all of the outcomes would be equally likely, which they are not.

So, what’s a simple solution to the problem?

Easy. Just recall the way that table 1 was structured: the rows across the side showed the results for die one and the columns showed the results for die 2. Each of the two rolls had no bearing on the other; that is we consider them to be independent events.

So, rather than using the random number generator to select a number from one to twelve, all you do is use the same generator to select two numbers from one to six and then add them.

Of course you know I could not resist the urge to try it out. I opened Excel to a blank worksheet and entered this formula in 1000 cells: =RANDBETWEEN(1,6)+RANDBETWEEN(1,6)

It would not be a great idea to try and show the 1000 numbers in the space below, as the result would not render well on a mobile. I just took a screen capture instead. The image below shows the numbers.

Figure 3: Image Showing 1000 Results for the Excel Model.

Figure 3: Image Showing 1000 Results for the Excel Model.

I then used the data analysis feature to plot a bar graph of the experimental results. The results are shown below.

Figure 4: Experimental Probability after 1000 Tries.

Figure 4: Experimental Probability after 1000 Tries.

If you compare figure 4 (the experimental probability graph) to figure 3 (the theoretical probability graph) you will notice that there’s a close but not exact match. That’s because 1000 trials of the experiment is not really enough to smooth things out! Trying it 10,000 times would have been more like it, but I’m sure you get the idea. The model is pretty good.

So what’s the point? This: once again, intuition is not very effective when you are working with numbers. In this case, it did make a lot of sense to think that generating random numbers between 2 and 12 would have done a reasonably decent job of simulating the toss of two dice. It was not, however, a good idea as the act of rolling two dice has a total of 36 separate outcomes, which, in turn, generate 11 different results—from 2 to 12. Unfortunately the likelihood of each outcome was not the same so a simple random number generator would not work. Instead we had to model the two rolls separately and then add them up. We did see, though, that this simulation gave results that modeled the ideal.

As an added bonus we also saw that a fairly large number of trials—1000 in this case—still did not give anything close to a perfect match to the ideal distribution, thus, once again demonstrating just how much randomness can affect even simple situations.

Ah chaos!


About Maurice A. Barry

Coordinator: Teaching and Learning Commons, Faculty of Education, Memorial University of Newfoundland, Parent & Husband. eLearning consultant/coordinator. Program Development Specialist - eLearning (Department of Education; Retired). Writer: over 40 Math/Physics texts/webs. Developer & Manager of web content. Geek. Not into awards but loves comments.
This entry was posted in Entertainment, Society and Culture and tagged , , , . Bookmark the permalink.

17 Responses to Some Geek Fun with Simple Probability

  1. elkement says:

    What a great story – and again one more interesting example! BTW re click-bait – I did my best to make your recent post a viral hit 🙂 Seriously, It was an awesome post!

    I had rather guessed – from your recent mentioning Antifragile on one your blogs – that some of Taleb’s examples might have motivated you to do a demonstration related to a pet peeve of yours (education and school) 🙂

    But I can relate so much to the way you came up with this! In the same way I can never resist to go down a rabbit hole when some geek comes up with an interesting question in passing!!

    • Thanks, Elks, I appreciate that. Readership has really fallen off on my blog and a little boots would be welcome!
      You and I have that in common–we enjoy the pursuit of a little clarity, even if we have to dive through some chaos get there.
      I was really tempted to show the probability graph after 10,000 trials as it d give a very nice match with the ideal, however I knew that would mean finding a way to display all of the sample results and I didn’t want to turn aw the few readers I have left 🙂

      • You need a little boots? I’ll gladly knit some booties for you to hang near your computer, what’s your favorite color? hahahah! 😀

        Readership has fallen slightly on my blog, too. I figure it’s a combination of less frequent postings (by me) and the time of year. I’m reading less this time of year than I do in the boring dead of winter.

  2. margber says:

    You’re keeping my wheels spinning! I had to read this twice before I really grasped the theory! What an interesting example. 🙂

    • Thanks for doing that! I will try and not be too tedious on a regular basis. On a related note, I dropped by your spot and noticed you are back from vacation. So when do we get pictures and advice of what might be nice to do? 🙂

  3. jennypellett says:

    Simple probability? Are you kidding? !! 🙂

    • You are correct; there is nothing simple and so-called common-sensical about probability. Rather the opposite, in my opinion. That said, so many realities in daily life can be modeled with it–medicine, insurance, weather, for instance–that we owe it ourselves to ensure that our young people get the basics as part of k-12 math. According t the “Standards” documents published by the National Council of Teachers of Mathematics (started in the US but is really international in scope these days), probability is supposed to be layered in to the school curriculum all through. The reality, though, is pretty spotty. Even if it’s in the official curriculum it’s rarely done as teachers tend not to either value it or be comfortable with it themselves.

      • jennypellett says:

        It’s definitely covered somehow in our curriculum – the topic lends itself to teaching using games which is always helpful with some students. However, it also introduces them to the idea of gambling which may or may not have its own consequence!

  4. I repeat … for all bloggers to hear (read) … you have a tremendous knack for explaining the non-trivial … you should seriously think about doing something in education. Explaining how to change a tire is one thing … a clear consideration of the sort you have presented here is quite another. Bravo … from one ‘explainer’ to another. D

  5. Tiny says:

    Great job Maurice! I finally got it after two reads 🙂

    • I am sure you are not alone. As I noted to Jenny, just then, (see above), there’s nothing intuitive about how probability really works. Hmmmm–maybe I will make that the subject of an upcoming post. If I do it will be based on the answers to these two questions:
      Question 1:
      You need to buy a new iron and have settled on one for sale at a Walmart just down the street–walking distance–that costs $90.00. You are just about to walk out the door to go get it when you see a sales flier that advertises the same one as being “on sale” at a Walmart across town for $80.00. Would you ignore the ad and get the iron for $90 at the nearby store or make the 1 hour (round trip) across town and get it for $80? Answer the question for yourself before moving on to question 2.
      Question 2:
      You need to buy a new washer-dryer combination and have settled on one for sale at a Walmart just down the street–walking distance, but you will use your pickup truck of course–that costs $1450.00. You are just about to go out the door to go get it when you see a sales flier that advertises the same one as being “on sale” at a Walmart across town for $1440.00. Would you ignore the ad and get the set for $1450 at the nearby store or make the 1 hour (round trip) across town and get it for $1440? Answer the question honestly!

      • Tiny says:

        Oh dear. This is a complicated equation. So many things to consider. I answered the first question with conviction: I’d still walk to the nearest Walmart and get it for $90. This was based on careful calculations on (a) the value of my time; (b) the cost of fuel and added mileage on my gas guzzling truck; (c) the potential risks involved in driving across the town. One might meet a careless driver 🙂 All these considerations would not be worth the nominal gain of $10. That is, $10 would not be again after all.
        Once I had answered the first question, the answer to the second question was fairly obvious, if an 11% saving was not worth it, then this minimal saving is also not worth it…
        I’m sure I’ll get an F now, but hopefully earned another post 🙂

        • You nailed it! A+
          Most do not. It would likely not surprise you to learn that most people would, for question 1, indicate that they would do it but for question 2, would say, “no” it’s just not worth it. Even though, as you noticed, the situations are more or less identical. In each case the savings was only $10. Rather than see the amount in absolute dollars, most would look at it as a proportion. A saving of $10 on $90 would be generally seen as worth it whereas a saving of $10 on a much larger purchase would not. Even though ten bucks is still ten bucks!

  6. If I had had a math teacher like you in high school, I might have gone into a math-related field. I always assumed I was no good at math, mostly because my teachers were all men, and emitted, in varying degrees of non-subtelely, the opinion that math is for boys and girls aren’t good at it. One of my teachers actually gave all the seats with the best view of the board to the boys, and placed girls in the back row and near the window (presumably giving us permission to daydream).

    When I went back to college to finish the last year of my English degree in my 40’s, I was forced to take a math class. I had a teacher who knew how to teach, and I discovered not only that I really like math, I’m also good at it.

    My favorite sentence of this post: intuition is not very effective when you are working with numbers. As a highly intuitive person, this was one of the greatest revelations of my life. Once I learned to put intuition in it’s place (locked in the closet) when I’m working with numbers, I got a whole lot smarter.

    • Thanks, mathematics education is such a controversial thing with so many issues!
      You’ve hit on one that the mathematics community itself has tried hard to address for at least 30 years now and, while it’s made significant strides, there are still remaining imbalances, especially regarding the workplace, where STEM-dependent areas are still male-dominated.
      I have a few items to add:
      Those who make math harder than it needs to be: Yes, there are still many math snobs out there; those who insist that we teach math full-bore. These people, in the end, are somewhat effective for the top 5 to 10% of the students; those with a natural inclination to the subject. For the rest, they are virtually useless.
      Those who insist that math is easy: They do just as much damage as they either trivialize what is really something that requires effort or, worse, by saying it is easy and just presenting “stuff” they do just as much damage as the previous group.
      Those who either under or over utilize technology. Mathematics is completely dependent on technology and this includes electronic calculators, computer software and applications and, yes, pencil and paper. Those who either stick to one type of tech. as well as those who over use it altogether also take the focus away from where it needs to be.
      Finally, those who seek more to entertain than to educate. Learning math requires considerable effort on the students behalf but many instructors put all of the focus into their teaching (having good notes and presentations, excessively lecturing and explaining and so on) rather than making the students own efforts the focus.
      I could go on…

      • You ought to write a book. Or at least an article.

        Seriously, those are all valid points and you make them clearly, concisely and with the wisdom that comes from experience.

        I don’t know about controversial. I think if everyone would just listen to the reasonable and right way (yours, of course) the controversy could be eliminated. 😉

Comments are Welcome!

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s