Question 1161858
```python?code_reference&code_event_index=2
from scipy.stats import binom

# Constants
p_miss = 0.0957
p_show = 1 - p_miss

# (a) n=61, capacity=59, find P(k=60) + P(k=61)
n_a = 61
p_60 = binom.pmf(60, n_a, p_show)
p_61 = binom.pmf(61, n_a, p_show)
ans_a = p_60 + p_61

# (b) n=65, capacity=59, find P(k > 59)
n_b = 65
capacity_b = 59
ans_b = binom.sf(capacity_b, n_b, p_show) # sf is 1 - cdf, so P(X > 59)

# (c) capacity=52, find max n such that P(k > 52) < 0.05
capacity_c = 52
threshold = 0.05
best_n = 52
for n in range(53, 100):
    prob_bumped = binom.sf(capacity_c, n, p_show)
    if prob_bumped < threshold:
        best_n = n
    else:
        break

print(f"Part (a): {ans_a=}")
print(f"Part (b): {ans_b=}")
print(f"Part (c): {best_n=}, {binom.sf(capacity_c, best_n, p_show)=}, {binom.sf(capacity_c, best_n+1, p_show)=}")


```
```text?code_stdout&code_event_index=2
Part (a): ans_a=0.016126517739814418
Part (b): ans_b=0.4014073805745022
Part (c): best_n=54, binom.sf(capacity_c, best_n, p_show)=0.029369939359098, binom.sf(capacity_c, best_n+1, p_show)=0.09276094534760537

```
To solve these problems, we use the **Binomial Distribution**. 
* Let $n$ be the number of tickets sold.
* Let $p$ be the probability that a passenger shows up for the flight. Given the probability of missing is $0.0957$, the probability of showing up is $p = 1 - 0.0957 = 0.9043$.
* Let $X$ be the number of passengers who show up. $X \sim \text{Binomial}(n, 0.9043)$.

---

### (a) If 61 tickets are sold, what is the probability that 60 or 61 passengers show up?
We need to calculate $P(X=60) + P(X=61)$ for $n=61$.

Using the binomial formula $P(X=k) = \binom{n}{k} p^k (1-p)^{n-k}$:
* $P(X=60) = \binom{61}{60} (0.9043)^{60} (0.0957)^1 \approx 0.0139$
* $P(X=61) = \binom{61}{61} (0.9043)^{61} (0.0957)^0 \approx 0.0022$

$$P(60 \text{ or } 61) = 0.01392 + 0.00221 \approx 0.0161$$

**Probability: 0.0161**

---

### (b) If 65 tickets are sold, what is the probability that a passenger will be "bumped"?
A passenger is bumped if more than 59 people show up ($X > 59$). For $n=65$:
$$P(X > 59) = P(X=60) + P(X=61) + P(X=62) + P(X=63) + P(X=64) + P(X=65)$$
Using the cumulative distribution function (or summing the individual probabilities):
$$P(X > 59) \approx 0.4014$$

**Probability: 0.4014**

---

### (c) For a capacity of 52, how many tickets may be sold to keep the probability of being "bumped" below 5%?
We need to find the largest $n$ such that $P(X > 52) < 0.05$.

* If **$n=53$** tickets are sold: $P(X > 52) = P(X=53) = (0.9043)^{53} \approx 0.0050$. (This is below 5%)
* If **$n=54$** tickets are sold: $P(X > 52) = P(X=53) + P(X=54) \approx 0.0294$. (This is below 5%)
* If **$n=55$** tickets are sold: $P(X > 52) \approx 0.0928$. (This exceeds 5%)

**Maximum tickets that can be sold: 54**