How do you calculate the probability of rolling something with x 6-sided dice?
- Example 1: Rolling exactly one 6 with three 6-sided dice.
- Example 2: Rolling exactly two 6s with three 6-sided dice.
- Example 3: Rolling exactly five 6s with ten 6-sided dice.
Also, out of curiosity, what would a function look like if it also had the amount of sides of the die as a variable (so an n-sided die as opposed to a 6-sided one)?
$B_{n,p}$, the count of successes among $n$ independent trials with identical success rate $p$ follows a Binomial Distribution. $$B_{n,p}\sim\mathcal {Binomial}(n,p) \iff \mathsf P(B_{n,p}=k)=\binom{n}{k}p^k(1-p)^{n-k}\mathbf 1_{k\in\{0,..,n\}}$$
This is the count of selections of $k$ from $n$ trials, times $k$ probabilities for successes and $n-k$ probabilities for failure.
If you wish the probability for exactly $1$ six among $3$ rolls of a six sided die, that is :
$$\mathsf P(B_{3,1/6}{=}1)=\dbinom 3 1 \dfrac {1^15^2}{6^3}=\dfrac{25}{72}$$
And such.