Mastering Probability Puzzles — Dice (Day 3)

Boi Mai Quach
5 min readOct 29, 2023

--

Introduction

Dice problems have an advantage over other probability problems in that several scenarios can be easily simulated and investigated experimentally. This time, we will dive into another dice challenge to gain more knowledge about the probability. Some people think that using tricks to solve these problems is not always a good way to learn probability. Nonetheless, it would be ideal to capture insights and make a strong impression to interviewers if you understand the knowledge behind the tricks before using them. Let’s solve today’s problem with a detailed explanation, an interesting simulation, and a beautiful trick.

Photo by Jonathan Petersson on Unsplash

For readers new to this series, my purpose is to solve each and every probability problem in order to help individuals for interview preparation and share my passion for mathematics to inspire people of all backgrounds.

✨Please give me a 👏 if you are interested in my sharing, leave a comment 💬 to share your views/thoughts. ✨

Problem

Rolling two dice (standard fair 6-sided dice), what is the probability of rolling a sum of 11?

Now, it’s your turn to solve this problem first and then look at the solution below.

Solution

In Day 1’s problem, I proposed an easy approach to solve those two dice problem by creating a 6 x 6 table representing all 36 posibilities. We also can use the same way to solve the challenge.

The sum of 11 can be obtained in two ways: (5,6) and (6,5). Therefore, the probablity is 2/36, which is equivalent to 5.556 %

General case

Rolling two 6-sided dice is common in many popular board games, especially in Monopoly. Thus, it would be beneficial if you could estimate how likely outcomes are, as knowing what could happen can assist you in making well-informed decisions.

Today, I will address this challenge by providing you with a simulation to determine the probability of certain outcomes when rolling dice. I designed a module for simulating dice rolls, which you can install from my Github.

For example, if we want to roll two dice randomly, we can do as follows

  • First, import my module
# Import module
from dice_rolling import Dice
  • Secondly, initialise variables and Dice object
# Initialise parameters
num_dice = 2 # The number of dice
num_sides = 6 # The sides of our dice

# Create Dice object
roll = Dice(num_dice, num_sides)
  • Thirdly, run dice roll simulation
# Roll Simulation
roll.roll_random_dice()

This is the output,

Dice Roll Simulation

Dice Roll Probability

I conducted a milion trials to estimate the probabilities of each outcome for two dice rolling.

# Dice Roll Probability
outcome, probabilities = roll.get_dice_probability()

Then, this is what I get

The probabilities of rolling two 6-sided dice

Now, let’s back to the initial question and calculate the probability of rolling a sum of 11.

# the probability of rolling a sum of 11
total = 11
roll.get_sum_probability(total)

The output is,

Tip and trick

In order to get quick answers for rolling two 6-sided dice in the interviews, I will guide you through a simple way based on the visualisation below.

Visualisation of two 6-sided dice rolling with 1,000,000 trials

These values were obtained from 1,000,000 trials. As you can see, this pattern appears to be symmetrical, with the highest probability at 7. Now, draw a cone shape by doing the steps listed below:

  1. Place ascending numbers from 2 to 12 (red) on the top of the cone to represent the sum values,
  2. Put numbers 1 to 6 (green) on the left hand side and from 6 to 1 (green) on the right hand side under the cone. These numbers will indicate the number of posibilities for the respective sum events.

Now, we address today’s question based on the cone shape above.

What is the probability of getting a sum of 11?

First, we look at the number 11 above the cone. Next, we find the number right below that shape, which is also the posibilities of obtaining a sum of 11. It is number 2. Thus, the probability is 2/36 or approximately 5.556 % which matches the result of our simulations.

Only use this cone shape, we can answer most questions regarding rolling two 6-sided dice to get a sum of [value].

Conclusion

Today’s challenge is not difficult. However, this straightforward question highlights the importance of interview preparation. By using the trick above, we can have an answer in around a minute, which can be very impressive to interviewers. I am not suggesting that we should rely on tricks to solve the probability problems. Instead, we should use tricks as a strategy to get a prompt response while still understand what is going on behind the scene because interviewers will ask why you have the answer and expect a detailed explanation.

In this post, I hope that you can use my module as a practical method for learning about dice roll probability. You can use this code to generate several functions, such as multiplication, subtraction, division, doubling, and more, or leave comments below this article. Any contributions you make will be greatly appreciated.

Thank you so much for taking the time to read this article. Next week, we will work together to solve another dice-related challenge. Looking forward to seeing you all.

Note: Unless otherwise noted, all images are by the author.

Source code

Preferences

--

--

Boi Mai Quach

PhD Student at SFI Centre for Research Training in Machine Learning, Dublin City University (DCU), Ireland.