# Dice roll probability calculator.

## Probability Mass Function (PMF)

## Cumulative Distribution Function (CDF)

The *Probability Mass Function* of a discrete distribution represents the probability of each event occuring.
For example, if \(X\) is a random variable that has a uniform distribution over the values 1, 2, 3, 4, and 5, then
the pmf for \(X\) would be
$$ f_X(x) = \frac{1}{5} $$
In other words, each value has a probability of 0.2 of occuring. If each event is equally likely to occur, then the
pmf can be calculated by simply finding the proportion of events that have the outcome of interest. (Note: This method
will only work if each event is equally likely to occur.)

In the case of rolling dice, a simple way to find the probability of each roll occuring is just to divide the number of
ways that roll can occur by the total number of possible roles. For example, let \(X\) be the outcome of rolling 3 six sided dice.
Note that there are \( 6 \times 6 \times 6 = 216 \) possible outcomes (although some of the outcomes might produce a duplicate value
in our random variable \(X\) which is the sum of the rolls.) There is exactly one way that you can roll a three though. You
must roll a one on all dice, so the probability of rolling a three is
$$ f_X(3) = \frac{1}{216} $$
The probability of rolling a four is more complicated to calculate. There are multiple ways that this can occur. We could roll a \((2, 1, 1)\),
a \((1, 2, 1)\), or a \((1, 1, 2)\). Therefore, the probability of rolling a four is
$$ f_X(4) = \frac{\texttt{roles that sum to }4}{\texttt{total possible rolls}} = \frac{3}{216} $$
You can use this method to calculate the probability of getting any roll with any dice assuming that they are fair dice.

If the probability mass function for the random variable \(X\) is \( f_X(x) = P(X=x) \), then the *Cumulative Distribution Function*
for \(X\) is \( F_X(x) = P(X\leq x) \). It is just the probability that the random variable of intrest, \(X\), is less than or
equal to some \(x\).

In the case of rolling dice, the cdf is simply the probability that we roll at least an \(x\). This could be calculated in a similar
way to the pdf, but if you already have the pdf, then there is an easier way to compute it.
$$ F_X(x) = \sum_{i=-\infty}^x f_X(i) $$