Probability & Statistics Ch.2 Section 3 Question 20

· Mohammad-Ali Bandzar

Solutions for “Probability and Statistics: The Science of Uncertainty” (Second Edition). These are solutions I have come up with; I offer no guarantee of accuracy.

Question

Suppose that there is a loop in a computer program and that the test to exit the loop depends on the value of a random variable X. The program exits the loop whenever XAX \in A, and this occurs with probability 1/3. If the loop is executed at least once, what is the probability that the loop is executed five times before exiting?

Solution

Since we are calculating the number of failures before the first success and all trials are independent, we use the Geometric distribution.

From Example 2.3.4 in the textbook:

pX(x)=P(X=x)=(1θ)xθp_X(x) = P(X=x) = (1-\theta)^x\theta

Where:

  • θ = probability of success (exiting) = 1/3
  • x = number of failed events (loop iterations) before success

We want 4 failures before a success (5 total executions, with the 5th causing the exit):

P(X=4)=(113)4(13)P(X=4) = \left(1 - \frac{1}{3}\right)^4 \left(\frac{1}{3}\right)

=(23)4(13)= \left(\frac{2}{3}\right)^4 \left(\frac{1}{3}\right)

=1681×13= \frac{16}{81} \times \frac{1}{3}

P(X=4)=162430.0658P(X=4) = \frac{16}{243} \approx 0.0658