# Probability of Dice Rolling

hay guise i just joined this phorum an i gotta problem 4 u

Kidding.

I'm an Applied Physics major (considering switching to plain, vanilla Physics), and I've been working on this problem forever. It's not homework; only something I've been trying to work out, in bits and pieces, over the past few weeks in my spare time. It's for a game called D&D, which I'm sure some of you have heard of, this being a forum of physicists, mathematicians, and such.

The problem: You have x number of y-sided dice (denoted xdy for simplicity; though, if it alienates anyone, I'll try to avoid it), and you want to roll a number n. There are a lot of basic things anyone who's played D&D for a while can figure out; the minimum you could possibly roll is x, the maximum is xy, the average is (x+xy)/2, a plot of probability vs. n would yield a bell curve for x>2, etc.

What I'd like, though, is an exact formula to describe the number of combinations for n you could roll on xdy. Presumably, once I have that, I can calculate the probability of rolling any given number by dividing by y^x, and the probability of rolling any number n or higher by summing from n to xy. I have little education in the way of probability analysis, so I basically started listing the number of rolls for each number you could roll on 1d4, 2d4, 3d4...up to 7d4, and tried to extract a formula by intuition. So far, what I've come up with is:

f1(x, y, n) = [ $$\prod$$$$\stackrel{x-1}{i=1}$$(n-i) ]/(x-1)!
f2(x, y, n) = f1(x, y, n) - x*f1(x, y, n-y)
g2(x, y, n) = f2(x, y, x + xy - n)
g1(x, y, n) = f1(x, y, x + xy - n)

And f(x, y, n), which gives the number of cominations of dice you could have to roll n, is:

f(x, y, n) =
f1(x, y, n), x ≤ n ≤ -1+x+y
f2(x, y, n), -1+x+y ≤ n ≤ -1+x+2y
g2(x, y, n), 1-2y+xy ≤ n ≤ 1-y+xy
g1(x, y, n), 1-y+xy ≤ n ≤ xy​

The middle two functions aren't needed for x<=2. When x>=6, though, the function breaks down, and it looks like I'll need to introduce two more functions; one for -1+x+2y ≤ n ≤ (x+xy)/2, and one for (x+xy)/2 ≤ n ≤ 1-2y+xy.

The thing I'm most worried about, though, is that I'll have to continue expanding the function indefinitely. As I said before, I have very little training in probability math, so is there another, easier way for me to tackle this? I've taken math courses up to Diff Eq, Calc III, and I'm currently enrolled in Discrete Math. Thanks in advance, and sorry for the poor formatting. I'm not used to forums with such an extensive typography (is there a way to make curly brackets that extend up and down several lines?).

Last edited: