I need some help with the following:
A hotel has $r$ rooms. The probability that a guest who booked a room also appears (which means: no cancellation) is $p = 0.9$.
I'd like to know how many rooms can be booked so that the probability for "no guest has to leave (due to overbooking)" stays under the value $a$.
Let $S_n ~ Bin(n,p)$ the number of guests, who actually booked a room AND did appear.
$P(S_n > r) = P(\frac{S_n - np}{\sqrt{npq}} > \frac{r-np}{\sqrt{npq}}) = 1 - P(S_n'' \leq \frac{r-np}{\sqrt{npq}}) = 1 - \Phi(\frac{r-np}{\sqrt{npq}})$.
- This value needs to be $< a$. So:
$\frac{r-np}{\sqrt{npq}} \ge z_{1-a}$ where $z_{1-a}$ is the inverse of standard normal distribution $\phi$.
This leads to: $r-np \ge z_{1-a}\cdot \sqrt{npq} \Leftrightarrow \frac{r}{p}-n \ge z_{1-a} \cdot \sqrt{\frac{nq}{p}}$, finally:
$(\sqrt{n})^2 + z_{1-a} \sqrt{\frac{q}{p}} \sqrt{n} - \frac{r}{\sqrt{p}} \leq 0$.
Now I'd like to find the zero point and then it should be done?! So: How to conclude? And have I done it correct so far?
$r-np \geq z_{1-a}\cdot \sqrt{npq}$
We can change the inequality to an equality, because we have to square the equation. Squaring is not an equivalent transformation. You can to decide at the end if n has to be $\leq$ or $\geq$.
Taking the square on both sides
$r^2-2rnp+n^2p^2=z^2\cdot npq$
$p^2n^2-(2rp+z^2\cdot p\cdot q)n+r^2=0$
Using the quadratic formula we have
$n_{1/2}=\frac{2rp+z^2\cdot p\cdot q\pm\sqrt{(2rp+z^2\cdot p\cdot q)^2-4\cdot p^2\cdot r^2}}{2p^2}$
$n_{1/2}=\frac{2rp+z^2\cdot p\cdot q\pm\sqrt{4p^2r^2+4rz^2qp^2+z^4q^2p^2-4\cdot p^2\cdot r^2}}{2p^2}$
$n_{1/2}=\frac{2rp+z^2\cdot p\cdot q\pm\sqrt{4rz^2qp^2+z^4q^2p^2}}{2p^2}$
You can check with the inequality at the beginning which value for $n$ is right.
We can drop the continuity correction factor if $n$ is sufficiently large enough. In the most cases it will be true. One thumb of rule is $n \cdot p \cdot q\geq 9$.
Link to the calculation using the formula
Calculation using the binomial distribution with $n=61,p=0.9$ and $x=50$
Calculation using the binomial distribution with $n=60,p=0.9$ and $x=50$