Imagine tossing a coin nine times, and getting “heads” nine times in a row. What is the probability that "tails" will come out on the tenth throw?
If you answered "90%", then go ahead with reading, a little review of statistics will certainly be welcome.
If, on the other hand, you are among those elected who answer (correctly) "50%", then you already know the difference between dependent and independent events. As is used to repeat in the statistical field, a coin has no memory of its past, and with each toss the probability that heads are thrown are equal to the probability that tails are thrown. Although the previous series saw the release of 99 "tails" in a row, every time we throw the coin in the air, the numbers related to the probabilities reset, and we start from scratch.
It is evident that such behavior appears at least counterintuitive to those who, like the average human being, are used to looking for patterns in all their sensory perception. We are faced with the usual, very ancient story that sees us as actors in the search for an improvement of our state through the attempt to recognize the root causes behind every manifestation of Reality.
From coins to diceIf we have exactly 50% chances of seeing a coin fall on heads or tails (ignoring those rare exceptions where the coin stands on the edge), what are the odds for each side of a die to come out? Simple: with each roll, each face has exactly one in six chance of appearing. So, about 16.67%.
In other words, each value from 1 to 6 has exactly the same probability of exit (unless you have sealed dice…).
Things get more interesting when we increase the number of dice to roll: in no way, in fact it will be possible to obtain the value 1 with two dice (obviously…). In the following table we see how many different ways we can get each value as a result.
With a little combinatorial mathematics (but also just common sense) it is easy to recognize that the output possibilities for each number are no longer the same, as some values can be combined in several different ways. If we look at the table, we realize that we have 36 different possible combinations at each throw. The value 2 and the value 12 will each have a 1 in 36 chance of coming out on each roll, the value 3 and the value 11 will have 2 probabilities each of going out on each roll, and so on. In other words, the probability of each number coming out is no longer the same with respect to the single dice, and in particular, the probability of coming out of a 2 or a 12 with two dice is equal to the exit of a straight number in roulette. (1/36 or 2.78%, if we do not consider zero for the moment).
Let's increase the complexity.What happens if we use more than just two dice? What would the odds be for each release? Would they keep the apparent linearity of growth or would they create stranger curves? We could calculate the values by hand, but we would risk making mistakes as the calculations to be made increase. A computer, on the other hand, would be perfectly at ease...
We have a small board with special computing capabilities, the Seeeduino Wio Terminal. This is an Arduino on steroids, equipped with a SAMD51 system with an ARM Cortex M4 processor. It is just a matter of writing a simple program that simulates the throw of 6 dice using the random() function, accumulates the output values for each combination and calculates the percentage of the total outputs.
To make the program more interesting to view, we will add the display of the number of outputs for each combination on a table.
At the end of the program, just click on the blue button to have a tabulation of the probabilistic values calculated for each combination.
The program is available on GitHub and here on the attachments section.
Feel free to contact me if you need clarifications.
Comments