Probability Visualization

How large must n be?

We draw n independent Uniform(0,1) samples and want the probability that at least one falls in the interval [0.7, 0.72] to be at least 95%.

Target interval
[0.70, 0.72]

Its length is 0.02.

Hit probability for one sample
0.02

So a single sample misses with probability 0.98.

Smallest valid sample size
149

This is the first integer that reaches the 95% threshold.

Key idea: use the complement

It is easier to compute the probability that none of the samples land in the interval, then subtract from 1.

P(one sample lands in [0.7,0.72]) = 0.72 - 0.70 = 0.02
P(one sample misses [0.7,0.72]) = 1 - 0.02 = 0.98
P(all n samples miss) = (0.98)^n
P(at least one sample lands in [0.7,0.72]) = 1 - (0.98)^n

Solve the inequality

1 - (0.98)^n ≥ 0.95
(0.98)^n ≤ 0.05
n ln(0.98) ≤ ln(0.05)
n ≥ ln(0.05) / ln(0.98) ≈ 148.28

Therefore, the smallest integer is n = 149.

Interactive check

Move the slider or enter a value for n:


P(at least one hit) = 95.06%
Target: 95%

For n = 149, the probability is 95.06%, so it works.

Check n = 148
94.96%

Just below 95%, so it is not enough.

Check n = 149
95.06%

Just above 95%, so it does work.

Final answer

You need n = 149 samples.