Sunday, September 26, 2010

Probabilities on two d6

I'm sure everyone reading this has rolled a pair of dice. And if you are the kind of person who reads blogs named after 2,000 year old mathematical proofs, you can probably calculate the odds of rolling any particular sum on that pair of dice. If you haven't yet, here's a chart:
If this is a revelation to you, that might explain why you're so terrible at monopoly.

This chart is great and all, but what if we want to know more than simply the outcome of the next roll? What if we want to know the chance of, say, rolling a seven some time in the next three turns? To find the answer, let's turn to... polyhedra.

Yes, I really am going to use polyhedra to analyze probability. Sue me.

Let's take a simple example: rolling a seven in the next two rolls. The chances of rolling a seven in one roll are 1/6, and the chances of rolling a seven twice in a row are (1/6)^2, or 1/36. If you want to verify this for yourself, spend the next three hours rolling dice and drawing charts. Additionally, the chances of NOT rolling a seven are 5/6 in the next roll, and (5/6)^2, or 25/35, in the next two rolls. Here's a chart that shows this:The dark blue shows the chance of rolling a seven twice, the lighter blue shows the chance of rolling a seven once, and the purple shows the chance of not rolling a seven at all. Both colors of blue taken together represent the chance of rolling a seven sometime during the next two turns.

Let's extend this out to three turns (and three dimensions). The chances of rolling three sevens in a row are (1/6)^3, or 1/216. Similarly, the chances of NOT rolling any sevens are 125/216, and the chances of rolling at least ONE seven are 91/216. Here's a sliced cube chart for you:

The dark blue represents the chance of rolling a seven THREE times in the next three turns, the lighter blue represents the chance of rolling a seven TWICE, and the lightest blue represents the chance of rolling a seven just ONCE in the next three turns. The purple represents the chance of not rolling any sevens.

So the chances of rolling a seven in one turn are 1/6, in two turns are 11/36, and in three turns are 91/216. Notice that the denominator of the fraction keeps increasing by powers of six, and the numerator keeps increasing by powers of six minus the corresponding powers of five. This is hardly a rigorous mathematical proof, but it's good enough for me. I'm going to go ahead and put this into a formula:

Probability of rolling a 7 sometime during the next n turns = (6^n - 5^n)/(6^n).

And here's a graph of this function from n=0 to n=15:

Unfortunately my graphing utility has taken it upon itself to measure the number of turns in two and one half turn increments, which are seldom happened upon in most board games. Still, you get the idea. Even after 10 turns, the chances of not rolling a SINGLE seven are about 15%, which might explain why the thief stays on your ore mine for SO CUSSING LONG.

What about the chances of rolling something OTHER than a seven in the next n turns? I won't bother to prove this, but they're equal to

(6^n - (6-k)^n)/6^n

where n is the number of turns and k is the numerator in the chance out of 6 of rolling that number (i.e. solve the equation u/36 = k/6). [EDIT: the much simpler equation at the bottom of this post is easier to use for this] Graphed three-dimensionally, that would look something like this:

Where both n and k are variables. I won't bother to explain this graph. If you understand it, great. If not, ah well.

I really wish I could use the 6 in my equations as a variable and graph that as well, but it would require four dimensions. Poor dear.

So the next time someone is in tears after the dice have refused to cooperate, you can simply explain to them how probability works with some sketches of cubes and a graphing calculator. Of course, the chances that they'll fly into a rage and smack you are fairly high... but can be easily predicted by the equation:

just kidding.

::EDIT::

A more general equation for finding the chance x/y occurring at least once over n iterations is

(y^n - (y-x)^n)/y^n


I really should have figured this out before I finished this post, but ah well.

Monday, April 26, 2010

Here's a song I wrote about a month ago. I called it "Adel" for some reason; don't really know why. Anyhow, it's a break from my usual polyhedral ramblings, so think what you will.