# Thread: Is there a mathematic formula for this?

1. ## Is there a mathematic formula for this?

So I'm wondering if there is a shortcut for something I'm trying to figure out. Let me try to explain. You have 6 sided die. Any number from 1-6 has an equal chance of being the outcome. How do I calculate finding the outcome for each sum if I roll two 6 sided dice? Like rolling a getting the sum 2 and 12 is 1/36. But how do I can I calculate the other results without actually listing them all? Long story short I have to do this but for each possible sum if I roll SIX 6 sided dice (so the outcomes are 6-36).

Thanks!  Reply With Quote

2. ## Re: Is there a mathematic formula for this? Originally Posted by Magic_Hat So I'm wondering if there is a shortcut for something I'm trying to figure out. Let me try to explain. You have 6 sided die. Any number from 1-6 has an equal chance of being the outcome. How do I calculate finding the outcome for each sum if I roll two 6 sided dice? Like rolling a getting the sum 2 and 12 is 1/36. But how do I can I calculate the other results without actually listing them all? Long story short I have to do this but for each possible sum if I roll SIX 6 sided dice (so the outcomes are 6-36).

Thanks!
I'm pretty sure we've done it before, with various complications.
It's a basicish combination problem (in that there is a nice general solution, not so basic that I can remember it)

For the 2 dice it looks like a triangle (centred on 7)
For 6 The mean is 6*3.5, and it's a very spikey graph.  Reply With Quote

3. ## Re: Is there a mathematic formula for this? Originally Posted by jayem I'm pretty sure we've done it before, with various complications.
It's a basicish combination problem (in that there is a nice general solution, not so basic that I can remember it)

For the 2 dice it looks like a triangle (centred on 7)
For 6 The mean is 6*3.5, and it's a very spikey graph.
Huh?   Reply With Quote

4. ## Re: Is there a mathematic formula for this?

For the probability function p(x) for the probability of the sum of 6 dice being x, I think the exact solution is probably a piecewise polynomial with 6 pieces and degree 5 on each piece. The discrete analog of integration should give the formulas. If you just want a table of numbers, it is probably more practical to iteratively compute the table P(N) for N dice from the table P(N-1) for N-1 dice as: P(N)(x) = sum over y = 1 to 6 of (1/6) * P(N-1)(x-y), taking care to keep track of for which values x P(N-1)(x) was zero.

And there are approximation schemes where you just match up the average values and the standard deviations and call it a day.

I'd be more explicit, but I have to run.  Reply With Quote

5. ## Re: Is there a mathematic formula for this? Originally Posted by Magic_Hat Huh? I was going to come back (I was having a brain fart with the integration).

For one die there is one way of getting each result.

For two die, the combinations are P(2)=1, P(3)=2 P(4)=3 P(5)=4 P(6)=5 P(7)=6 P(8)=5 P(9)=4 etc... If you plot it on a graph you get a triangle.
As you add more die the graph at the bottom gets a bit wider but it looks almost like a spike.

For 6 die, the combinations start P(6)=1, 6, 35 (any die can be the first 2, any die can be the second but if it's the same)

As Davidsh suggest. Iterative computation is probably the nicest way. You can 'easily' modify it to deal with compounding issues.
It saves having to deal with the vast majority of identical cases (in the 6 die case you do with something like 200 simple sums rather that 46656). If you feel clever you can even build it up exponentially.  Reply With Quote

6. ## Re: Is there a mathematic formula for this?

If you just want to look at dice probabilities as part of something else you're figuring out, https://anydice.com/ is going to be much easier than doing math yourself.  Reply With Quote

7. ## Re: Is there a mathematic formula for this?

I had a discussion with my friend earlier this year about just this. Let me see if I can dig up my old notes...

Short version is, if you roll an n-sided die and an m-sided die (n can equal m) you multiply the polynomials (x1+x2+x3...+xn) and (x1+x2+x3...+xm). The exponents of the terms in the resulting polynomial are the potential sums; the coefficients of each term (remember the implied 1 in front of certain terms) are the number of ways to get that particular sum. So in this case, you'd be multiplying (x1+x2+x3+x4+x5+x6) by itself a few times. If I can find my old notes (we specifically looked at that exact circumstance a while back) I'll post what that looks like, but until then, try to enjoy the multiplication you've got to do.  Reply With Quote

8. ## Re: Is there a mathematic formula for this?

Not sure about the formula, but this gives the probabilities for various xd6.

http://gurpsland.no-ip.org/articles/d6chance.htm  Reply With Quote

9. ## Re: Is there a mathematic formula for this?

And https://anydice.com/ will show you the outcome for a variety of different die combinations.  Reply With Quote

10. ## Re: Is there a mathematic formula for this?

For general calculations I like to use https://www.wolframalpha.com/
It can easily do dice, and it will give you the statistical distribution as well. It handled 3d8+4d6 just fine as a random test.
It is also really good for unit conversions and all sorts of other things.

While there are formulas for calculating dice rolls, a more simplified chart is probably a lot more useful for understanding the probability and distribution, with distribution being more important to most cases where you're using dice.  Reply With Quote

11. ## Re: Is there a mathematic formula for this? Originally Posted by georgie_leech I had a discussion with my friend earlier this year about just this. Let me see if I can dig up my old notes...

Short version is, if you roll an n-sided die and an m-sided die (n can equal m) you multiply the polynomials (x1+x2+x3...+xn) and (x1+x2+x3...+xm). The exponents of the terms in the resulting polynomial are the potential sums; the coefficients of each term (remember the implied 1 in front of certain terms) are the number of ways to get that particular sum. So in this case, you'd be multiplying (x1+x2+x3+x4+x5+x6) by itself a few times. If I can find my old notes (we specifically looked at that exact circumstance a while back) I'll post what that looks like, but until then, try to enjoy the multiplication you've got to do.
This method is known as using generating functions, and it's equivalent to performing a Discrete Convolution on the distributions. In general, you can't get a nice closed form where you can just plug in the number of dice and get the function you want, you have to use an algorithm to do it. As someone said above, for our purposes as roleplayers just using anydice is more than sufficient.  Reply With Quote

12. ## Re: Is there a mathematic formula for this? Originally Posted by Craft (Cheese) This method is known as using generating functions, and it's equivalent to performing a Discrete Convolution on the distributions. In general, you can't get a nice closed form where you can just plug in the number of dice and get the function you want, you have to use an algorithm to do it.
Yep, its a convolution. Much repeated addition. The vids in the link help you to find a feeling for how it works. The distributions 'pass by' each other to define the outcome at that point.
If you want a shortcut for several dice (four or more), you can use the Cental Limit Theorem (https://en.m.wikipedia.org/wiki/Central_limit_theorem). That is, they approximately behave like a bell curve. It even holds for different sorts of dice, since dice distributions are generally well behaved.  Reply With Quote

13. ## Re: Is there a mathematic formula for this?

As Craft mentioned, there is no nice closed formula for an arbitrary number n of dice. However, this is a nice article that breaks down the math for deriving the formulas of the distributions for n=2,3,4.  Reply With Quote

14. ## Re: Is there a mathematic formula for this?

While exact solutions are not always available, the Central_limit_theorem tells us that the more dice you add the closer to a normal distribution you get. Once you are looking at more than a couple of dice the normal approximation is pretty good.  Reply With Quote

15. ## Re: Is there a mathematic formula for this?

For 2d6 specifically: P(n)=(6-|n-7|)/36

Beyond 2d6 it starts getting a lot messier (though you can fit a polynomial to any of them, at the very least through some sort of brute force fit of a whole bunch of individual points, though at that point tabular data is so much easier).  Reply With Quote

16. ## Re: Is there a mathematic formula for this?

You can recursively generate the formula for n dice from the formula for n-1 dice:
p(x, n): probability of rolling an x on nd6
p(0, 0) = 1; p(x, 0) = 0 where x≠0
p(x, n) = (p(x-1, n-1) + p(x-2, n-1) + p(x-3, n-1) + p(x-4, n-1) + p(x-5, n-1) + p(x-6, n-1)) / 6

And you can calculate the formula for any x and n by repeated substitution. Needless to say, it gets really complicated for large values of n.  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•