Math 132A

Binomial Distributions

Example of a Random Variable

\(X = {}\) the number of heads when flipping 3 coins:

Example

\(X\) models “the number of heads in 3 tosses of a fair coin”.

  • \(X\) can take on the values 0, 1, 2, 3.

3 coin tosses

More examples:

  • Taking a token 3 times from a bag with one red and one blue token, with replacement. Counting the number of red tokens.

  • Asking 3 people to randomly select one of two characters, when they have no preference. Counting the number of times the friendly character was selected.

  • Randomly selecting 3 people from a large crowd that has 50% males and 50% females. Counting the number of females.

  • Randomly selecting 3 plants from a field in which 50% of the plants have some specific genetic mutation. Counting the number of plants with the mutation.

  • Randomly guessing on a quiz with 3 true/false questions

Mathematically, all of those are the same.

Common theme

  • Number of heads when tossing three fair coins
  • Number of sixes when rolling three fair dice
  • Number of heads when tossing 16 fair coins
  • Number of patients testing positive for Covid-19 in a sample of 200 patients

All these can be modeled by so-called binomial random variables.

Binomial Random Variables

\(X\) is a binomial random variable if it represents the number of successes in \(n\) replications of an experiment where

  • Each replicate is independent of the other replicates.
  • Each replicate has two possible outcomes: either success or failure.
  • The probability of success \(p\) in each replicate is constant.

This is also called a binomial process.

A binomial random variable takes on values \(0, 1, 2, \dots, n\).

The numbers \(n\) and \(p\) are the parameters of the distribution.

We write \(X \sim \operatorname{Binom}(n, p)\).

The Binomial Distribution

Suppose \(X\sim \operatorname{Binom}(n,p)\). What is \(P(X = x)\)?

  • \(n\) independent repetitions
  • \(x\) successes, each with probability \(p\)
  • \(n - x\) failures, each with probability \(1 - p\)

\[\begin{gather} P(\text{first } x \text{ are successes and last } n - x \text{ are failures}) = \\ \underbrace{p\cdot p\cdot p \cdots p}_{x\text{ times}}\cdot\underbrace{(1-p)\cdot(1-p)\cdots(1-p)}_{(n-x) \text{ times}} = p^x\cdot (1-p)^{n-x} \end{gather}\]

But also

\[\begin{gather} P(\text{first } n-x \text{ are failures and last } x \text{ are successes}) = \\ \underbrace{(1-p)\cdot(1-p)\cdots(1-p)}_{(n-x) \text{ times}} \cdot \underbrace{p\cdot p\cdot p \cdots p}_{x\text{ times}} = p^x\cdot (1-p)^{n-x} \end{gather}\]

or it may be that the first is success, then there are two failures, then a success, and so on.

How many different ways can we choose \(x\) successes out of \(n\) repetitions?

The Binomial Coefficient

The binomial coefficient \(\binom{n}{x}\) is the number of ways to choose \(x\) items from a set of size \(n\), where the order of the choices is ignored.

Mathematically,

\[\binom{n}{x} = \frac{\overbrace{n\cdot(n-1)\cdot(n-2)\cdots(n-x+1)}^{x \text{ factors}}} {\underbrace{x\cdot(x-1)\cdot(x-2)\cdots 1}_{x \text{ factors}}}\]

Examples

  • Calculate \(\binom{7}{3}\)
  • Calculate \(\binom{7}{6}\)
  • Calculate \(\binom{10}{4}\)
  • Calculate \(\binom{10}{6}\)

Let’s put it all together

Each specific sequence of \(x\) successes in \(n\) trials has probability

\[p^x\cdot(1 - p)^{n-x}\]

There are \(\binom{n}{x}\) such sequences. The sequences are mutually exclusive!

The probability of exactly \(x\) successes in \(n\) trials is

\[\binom{n}{x} p^x (1-p)^{n-x}\]

Formula for the Binomial Distribution

Let \(X\) = number of successes in \(n\) trials, and \(0 \le x \le n\).

\[P(X = x)=\binom{n}{x} p^x (1-p)^{n-x}\]

Parameters of the distribution:

  • \(n\) = number of trials

  • \(p\) = probability of success

Examples

  • Let \(n = 3\) and \(p = 1/2\).

    Calculate \(P(X = 1)\).

  • Let \(n = 3\) and \(p = 1/6\).

    Calculate \(P(X = 2)\).

  • Let \(n = 16\) and \(p = 1/2\).

    Calculate \(P(X = 14)\).

    (Hint: \(\binom{16}{14} = \binom{16}{2}\))