The Problem

You generate \( n \) independent random variables \( X_1, X_2, \dots, X_n \), each uniformly distributed over \( [0,1] \).

Question: How large must \( n \) be so that at least one sample falls in the interval \( [0.7, 0.72] \) with probability at least 95%?


Step-by-Step Solution

Step 1: Probability of a Single Hit

The probability that a single sample \( X_i \) lands in \( [0.7, 0.72] \) is:

\[ P(\text{hit}) = 0.72 - 0.7 = 0.02 \]


Step 2: Probability None Hit

The probability that none of the \( n \) variables fall in \( [0.7, 0.72] \):

\[ P(\text{no hits}) = (1 - 0.02)^n = 0.98^n \]

We want:

\[ 1 - 0.98^n \ge 0.95 \Rightarrow 0.98^n \le 0.05 \]


Step 3: Solve for \( n \)

Take logs:

\[ \log(0.98^n) \le \log(0.05) \Rightarrow n \cdot \log(0.98) \le \log(0.05) \]

\[ n \ge \frac{\log(0.05)}{\log(0.98)} \approx \frac{-1.3010}{-0.00877} \approx 148.36 \]

Round up:

\[ \boxed{n = 149} \]


Final Answer

You need to generate at least:

\[ \boxed{149} \]

independent \( \mathrm{Uniform}(0,1) \) variables to ensure with 95% confidence that at least one falls in \( [0.7, 0.72] \).


Reference