An urn contains white and black balls with $p_w = p$ and $p_b = 1-p$. If we made $n$ extractions with replacement what is the probability that the number of white balls extracted is between $a$ and $b$?
I thought this:
- $P=P(b) - P(a)$
- $P(b) = \binom{n}{b}\cdot\left(p\right)^{b}\cdot\left(1-p\right)^{n-b}$
- $P(a) = \binom{n}{a}\cdot\left(p\right)^{a}\cdot\left(1-p\right)^{n-a}$
Am I doing it right?
You need to be slightly careful with this situation, since we are looking for multiple sample points, not just the sample points that our extraction gives us $b$ white balls and our extraction gives us $a$ white balls.
What we are looking for is $P(a \leq X \leq b)$, where $X \sim Binom(n,p_w)$ is the random variable representing the number of white balls picked.
By the cumulative mass function of the binomial distribution, $P(a \leq X \leq b) = \sum_{i = a}^b \binom{n}{i} p^i (1-p)^{n-i}.$ You can simplify this using the binomial theorem.