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