document.write( "Question 1161858: Suppose that the probability that a passenger will miss a flight is 0.0957. Airlines do not like flights with empty​ seats, but it is also not desirable to have overbooked flights because passengers must be​ \"bumped\" from the flight. Suppose that an airplane has a seating capacity of 59 passengers.
\n" ); document.write( "​(a) If 61 tickets are​ sold, what is the probability that 60 or 61 passengers show up for the flight resulting in an overbooked​ flight?
\n" ); document.write( "​(b) Suppose that 65 tickets are sold. What is the probability that a passenger will have to be​ \"bumped\"?
\n" ); document.write( "​(c) For a plane with seating capacity of
\n" ); document.write( "52 ​passengers, how many tickets may be sold to keep the probability of a passenger being​ \"bumped\" below 5​%?
\n" ); document.write( "

Algebra.Com's Answer #854411 by CPhill(2264)\"\" \"About 
You can put this solution on YOUR website!
```python?code_reference&code_event_index=2
\n" ); document.write( "from scipy.stats import binom\r
\n" ); document.write( "\n" ); document.write( "# Constants
\n" ); document.write( "p_miss = 0.0957
\n" ); document.write( "p_show = 1 - p_miss\r
\n" ); document.write( "\n" ); document.write( "# (a) n=61, capacity=59, find P(k=60) + P(k=61)
\n" ); document.write( "n_a = 61
\n" ); document.write( "p_60 = binom.pmf(60, n_a, p_show)
\n" ); document.write( "p_61 = binom.pmf(61, n_a, p_show)
\n" ); document.write( "ans_a = p_60 + p_61\r
\n" ); document.write( "\n" ); document.write( "# (b) n=65, capacity=59, find P(k > 59)
\n" ); document.write( "n_b = 65
\n" ); document.write( "capacity_b = 59
\n" ); document.write( "ans_b = binom.sf(capacity_b, n_b, p_show) # sf is 1 - cdf, so P(X > 59)\r
\n" ); document.write( "\n" ); document.write( "# (c) capacity=52, find max n such that P(k > 52) < 0.05
\n" ); document.write( "capacity_c = 52
\n" ); document.write( "threshold = 0.05
\n" ); document.write( "best_n = 52
\n" ); document.write( "for n in range(53, 100):
\n" ); document.write( " prob_bumped = binom.sf(capacity_c, n, p_show)
\n" ); document.write( " if prob_bumped < threshold:
\n" ); document.write( " best_n = n
\n" ); document.write( " else:
\n" ); document.write( " break\r
\n" ); document.write( "\n" ); document.write( "print(f\"Part (a): {ans_a=}\")
\n" ); document.write( "print(f\"Part (b): {ans_b=}\")
\n" ); document.write( "print(f\"Part (c): {best_n=}, {binom.sf(capacity_c, best_n, p_show)=}, {binom.sf(capacity_c, best_n+1, p_show)=}\")\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "```
\n" ); document.write( "```text?code_stdout&code_event_index=2
\n" ); document.write( "Part (a): ans_a=0.016126517739814418
\n" ); document.write( "Part (b): ans_b=0.4014073805745022
\n" ); document.write( "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\r
\n" ); document.write( "\n" ); document.write( "```
\n" ); document.write( "To solve these problems, we use the **Binomial Distribution**.
\n" ); document.write( "* Let $n$ be the number of tickets sold.
\n" ); document.write( "* 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$.
\n" ); document.write( "* Let $X$ be the number of passengers who show up. $X \sim \text{Binomial}(n, 0.9043)$.\r
\n" ); document.write( "\n" ); document.write( "---\r
\n" ); document.write( "\n" ); document.write( "### (a) If 61 tickets are sold, what is the probability that 60 or 61 passengers show up?
\n" ); document.write( "We need to calculate $P(X=60) + P(X=61)$ for $n=61$.\r
\n" ); document.write( "\n" ); document.write( "Using the binomial formula $P(X=k) = \binom{n}{k} p^k (1-p)^{n-k}$:
\n" ); document.write( "* $P(X=60) = \binom{61}{60} (0.9043)^{60} (0.0957)^1 \approx 0.0139$
\n" ); document.write( "* $P(X=61) = \binom{61}{61} (0.9043)^{61} (0.0957)^0 \approx 0.0022$\r
\n" ); document.write( "\n" ); document.write( "$$P(60 \text{ or } 61) = 0.01392 + 0.00221 \approx 0.0161$$\r
\n" ); document.write( "\n" ); document.write( "**Probability: 0.0161**\r
\n" ); document.write( "\n" ); document.write( "---\r
\n" ); document.write( "\n" ); document.write( "### (b) If 65 tickets are sold, what is the probability that a passenger will be \"bumped\"?
\n" ); document.write( "A passenger is bumped if more than 59 people show up ($X > 59$). For $n=65$:
\n" ); document.write( "$$P(X > 59) = P(X=60) + P(X=61) + P(X=62) + P(X=63) + P(X=64) + P(X=65)$$
\n" ); document.write( "Using the cumulative distribution function (or summing the individual probabilities):
\n" ); document.write( "$$P(X > 59) \approx 0.4014$$\r
\n" ); document.write( "\n" ); document.write( "**Probability: 0.4014**\r
\n" ); document.write( "\n" ); document.write( "---\r
\n" ); document.write( "\n" ); document.write( "### (c) For a capacity of 52, how many tickets may be sold to keep the probability of being \"bumped\" below 5%?
\n" ); document.write( "We need to find the largest $n$ such that $P(X > 52) < 0.05$.\r
\n" ); document.write( "\n" ); document.write( "* If **$n=53$** tickets are sold: $P(X > 52) = P(X=53) = (0.9043)^{53} \approx 0.0050$. (This is below 5%)
\n" ); document.write( "* If **$n=54$** tickets are sold: $P(X > 52) = P(X=53) + P(X=54) \approx 0.0294$. (This is below 5%)
\n" ); document.write( "* If **$n=55$** tickets are sold: $P(X > 52) \approx 0.0928$. (This exceeds 5%)\r
\n" ); document.write( "\n" ); document.write( "**Maximum tickets that can be sold: 54**
\n" ); document.write( "
\n" );