# Statistics

So I don’t lose it, here it is again. In this guy’s communications class 10 or so years ago (don’t remember if it was Comm 1 or Comm 2), one of our homework problems was, essentially, to find a formula to calculate the probability of rolling a total $$\LARGE{t}$$ on $$\LARGE{n}$$ $$\LARGE{s}$$-sided dice. The homework wasn’t quite so generic, but I nearly had it back then. I’ve derived the formula a couple of times since, but I can’t reliably find it on the internets, so here it is:

$$\Huge{p(t)=\frac{\sum\limits_{k=0}^{\lfloor{\frac{t-n}{s}}\rfloor}(-1)^{k}{n \choose k}{{t-sk-1}\choose{n-1}}}{s^n}}$$

The more dice one has, the more this looks like a Gaussian distribution

$$\Huge{f(x\ |\ \mu,\sigma^2)={\frac{1}{\sqrt{2\sigma^2\pi}}}e^{-\frac{(x-\mu)^2}{2\sigma^2}}}$$

where

$$\Huge{\mu=\frac{n(s+1)}{2}}$$

and

$$\Huge{\sigma=\frac{1}{\sqrt{2\pi}p(\lfloor\mu\rfloor)}}$$

The tails are slightly flatter, so it might be some other “bell”-shaped PDF, but this is a good approximation.