# Binomial distribution

Binomial distribution | |

[ilmath]X\sim\text{Bin}(n,p)[/ilmath] | |

[ilmath]p\in[/ilmath][ilmath][0,1][/ilmath][ilmath]\subseteq\mathbb{R} [/ilmath], [ilmath]n\in\mathbb{N}_{\ge 0} [/ilmath] | |

Definition | |
---|---|

p.m.f | [ilmath]\mathbb{P}[X\eq k]:\eq{}^n\text{C}_k\ p^k(1-p)^{n-k} [/ilmath] |

## Definition

## Derivation

Let there be [ilmath]n[/ilmath] items, [ilmath]X_1,\ldots,X_n[/ilmath] which can take the values "*yes*" or "*no*", we denote by [ilmath]y_i[/ilmath] the [ilmath]i^\text{th} [/ilmath] [ilmath]X_j[/ilmath] taking the value [ilmath]y[/ilmath] and similarly for [ilmath]n_j[/ilmath].

We are interested in getting exactly [ilmath]k[/ilmath] [ilmath]y[/ilmath]s. (specifically how many combinations there are of various [ilmath]X_i[/ilmath] for getting [ilmath]y[/ilmath]s, we consider for example [ilmath]y_1y_2[/ilmath] the same as [ilmath]y_2y_1[/ilmath], these are distinct permutations but the same combinations)

- We can choose the first [ilmath]y[/ilmath] to come from any of the [ilmath]n[/ilmath] [ilmath]X_j[/ilmath]s so there are [ilmath]n[/ilmath] ways to choose this
- The next [ilmath]y[/ilmath] can only come from [ilmath]n-1[/ilmath] [ilmath]X[/ilmath]s (as 1 of them is already taken)
- The next [ilmath]y[/ilmath] can only come from [ilmath]n-2[/ilmath] [ilmath]X[/ilmath]s

and so on, the result is [ilmath]n(n-1)(n-2)\cdots(n-(k-1))[/ilmath]^{[Note 1]}, we may write this as [ilmath]\frac{n!}{(n-k)!} [/ilmath]

Next consider the case where [ilmath]k\eq 3[/ilmath], then one of the ways to choose [ilmath]k[/ilmath] may be [ilmath](1,2,4)[/ilmath] (meaning [ilmath]y_1y_2y_4[/ilmath] the rest [ilmath]n[/ilmath]s), and another way is [ilmath](2,1,4)[/ilmath], meaning [ilmath]y_2y_1y_4[/ilmath]), notice that these are "the same" (as combinations, but are different permutations), they both have [ilmath]X_1[/ilmath], [ilmath]X_2[/ilmath] and [ilmath]X_4[/ilmath] being "yes".

Notice that choosing from [ilmath]\{1,2,4\} [/ilmath] there are 3 ways to choose the first element, 2 ways for the second and only one way (the remaining item) for the third.

Thus, in general, of the [ilmath]k[/ilmath] chosen [ilmath]X[/ilmath]s to represent "*yes*"s, there are:

- [ilmath]k[/ilmath] ways to choose the first element
- [ilmath]k-1[/ilmath] ways to choose the second element
- ....
- [ilmath]2[/ilmath] ways to choose the [ilmath]k-1[/ilmath]th element,
- [ilmath]1[/ilmath] way to choose the final element.

So there are [ilmath]k(k-1)\cdots 2\cdot 1[/ilmath] ways to choose these [ilmath]k[/ilmath] chosen elements.

This is just [ilmath]k![/ilmath]

Thus the [ilmath]\frac{n!}{(n-k)!} [/ilmath] ways to choose count the same collection of [ilmath]k[/ilmath] elements [ilmath]k![/ilmath] times (as in the example, the elements 1, 2 and 4 were counted 6 times, 2 were explicitly given)

So we divide [ilmath]\frac{n!}{(n-k)!} [/ilmath] by [ilmath]k![/ilmath] to yield

- [ilmath]\frac{n!}{k!(n-k)!} [/ilmath] this is just [ilmath]{}^n\text{C}_k[/ilmath]

## Motivating example

Suppose we flip a coin 3 times and count the number of heads, we want to find the probability that there is exactly 1 head. Notice that there are 3 distinct outcomes which have exactly one head, *htt*, *tht* and *tth*, assuming each instance of one head and two tails has the same probability ([ilmath]p(1-p)(1-p)[/ilmath] for independent flips, and [ilmath]p[/ilmath] the probability of a head on a single flip) we can just multiply that probability by 3.

In general for [ilmath]n[/ilmath] coin flips, the probability of exactly [ilmath]k[/ilmath] heads depends [ilmath]{}^n\text{C}_k[/ilmath] distinct outcomes, each with [ilmath]k[/ilmath] heads.

As above, assuming each flip is independent and the probability of any individual flip yielding heads being [ilmath]p[/ilmath], then the probability of exactly [ilmath]k[/ilmath] heads from the [ilmath]n[/ilmath] flips is:

- [ilmath]{}^n\text{C}_k\ p^k(1-p)^{n-k} [/ilmath]

## Notes

- ↑ We stop at [ilmath](n-(k-1))[/ilmath] as for [ilmath]k\eq 1[/ilmath] it's just [ilmath]n[/ilmath] or [ilmath]n-0[/ilmath], for [ilmath]k\eq 2[/ilmath] it's [ilmath](n-0)(n-1)[/ilmath] and so forth, we always stop at [ilmath](n-(k-1))[/ilmath].