Question 1163935: A box contains 6 balls, 3 are blue and 3 are red. Balls are drawn successively without replacement. If random variable X is number of draws until last red ball is obtained. Find the probability density function of random variable X?
Answer by CPhill(2264) (Show Source):
You can put this solution on YOUR website! ```python?code_reference&code_event_index=2
import math
def nCr(n, r):
if r < 0 or r > n:
return 0
return math.comb(n, r)
def calculate_pmf():
N = 6
R = 3
results = {}
total_combinations = nCr(N, R)
for k in range(3, 7):
# Ways to have 2 red balls in first k-1 slots * 1 red ball in kth slot
ways = nCr(k-1, 2)
prob = ways / total_combinations
results[k] = (ways, prob)
return results, total_combinations
pmf, total = calculate_pmf()
print(f"{total=}")
for k, (ways, prob) in pmf.items():
print(f"X={k}: Ways={ways}, Prob={prob}")
```
```text?code_stdout&code_event_index=2
total=20
X=3: Ways=1, Prob=0.05
X=4: Ways=3, Prob=0.15
X=5: Ways=6, Prob=0.3
X=6: Ways=10, Prob=0.5
```
To find the probability mass function (PMF) of the random variable $X$, which represents the number of draws until the last red ball is obtained, we can use combinatorial counting.
### 1. Identify the Parameters
* Total number of balls: $N = 6$
* Number of red balls: $R = 3$
* Number of blue balls: $B = 3$
* Random variable $X$: The draw number at which the **3rd** red ball is pulled.
The range of $X$ is $\{3, 4, 5, 6\}$.
* $X=3$ is the earliest possible draw (if the first three balls are all red).
* $X=6$ is the latest possible draw (if two blue balls are drawn before the final red ball).
### 2. Logic for $P(X=k)$
For the $k$-th draw to contain the last red ball, two conditions must be met:
1. The $k$-th ball drawn must be **Red**.
2. In the previous $k-1$ draws, there must have been exactly **2 Red balls** (and $k-3$ Blue balls).
The total number of ways to arrange 3 red balls and 3 blue balls in 6 positions is:
$$\text{Total Outcomes} = \binom{6}{3} = \frac{6 \times 5 \times 4}{3 \times 2 \times 1} = 20$$
The number of successful outcomes for a specific $k$ is the number of ways to choose 2 positions for the red balls out of the first $k-1$ positions:
$$\text{Favorable Outcomes} = \binom{k-1}{2}$$
### 3. Calculate the Probabilities
We apply the formula $P(X=k) = \frac{\binom{k-1}{2}}{20}$ for each $k$:
* **For $X=3$:**
$$P(X=3) = \frac{\binom{3-1}{2}}{20} = \frac{\binom{2}{2}}{20} = \frac{1}{20} = 0.05$$
* **For $X=4$:**
$$P(X=4) = \frac{\binom{4-1}{2}}{20} = \frac{\binom{3}{2}}{20} = \frac{3}{20} = 0.15$$
* **For $X=5$:**
$$P(X=5) = \frac{\binom{5-1}{2}}{20} = \frac{\binom{4}{2}}{20} = \frac{6}{20} = 0.30$$
* **For $X=6$:**
$$P(X=6) = \frac{\binom{6-1}{2}}{20} = \frac{\binom{5}{2}}{20} = \frac{10}{20} = 0.50$$
### 4. Summary of the Probability Density Function (PMF)
The probability density (mass) function is given by:
| $x$ | $P(X=x)$ |
| :--- | :--- |
| 3 | $1/20$ ($0.05$) |
| 4 | $3/20$ ($0.15$) |
| 5 | $6/20$ ($0.30$) |
| 6 | $10/20$ ($0.50$) |
| Other | $0$ |
**Check:** $0.05 + 0.15 + 0.30 + 0.50 = 1.0$. The sum of probabilities equals 1, confirming the distribution is valid.
|
|
|