# Probability Theory - random number hit from a pool

With the given data: After picking 30 random natural integers in a pool of X-natural-numbers (numbers do not disappear from the pool after picking). The probability of NOT picking 1 pre-defined specific number should be around a probability of 0,3%.

This is what I'm trying to calculate: The size of the pool

What I want to know: The formula

-

## 2 Answers

It is not entirely clear what the problem is, so I will make an interpretation that I hope is the one you intend. Out of habit, I will use $n$ instead of $X$.

We have a pool of $n$ distinct natural numbers, or indeed any $n$ distinct objects. We suppose that $A$ is one of these objects.

We pick from this pool $30$ times, each time replacing the object that we picked, so that the composition of the pool does not change. The probability that in $30$ trials, we never pick $A$, is $0.003$. We want to know the number $n$ of objects in the pool.

The probability that, on any individual pick, we get the object $A$, is $\dfrac{1}{n}$. So the probability that we don't get $A$ is $1-\dfrac{1}{n}$. The probability that this happens $30$ times in a row is $$\left(1-\frac{1}{n}\right)^{30}.\qquad\qquad (\ast)$$ So we want to solve the equation $$\left(1-\frac{1}{n}\right)^{30}=0.003.$$ This equation can be solved in various ways, including "trial and error." In our particular situation, trial and error is a very good way. If we play with the calculator a bit, using the formula $(\ast)$, we find that if $n=5$, the probability of never getting $A$ is about $0.0012379$, while if $n=6$, the probability is about $0.0042127$. There is no integer $n$ such that the probability is exactly $0.003$. We get closest with $n=6$.

We now describe a more systematic way of solving our equation. Take the logarithm of both sides. I will use logarithm to the base $10$, though I would prefer the natural logarithm (base $e$). We obtain $$30\log\left(1-\frac{1}{n}\right)=\log(0.003).$$ Calculate. We get $$\log\left(1-\frac{1}{n}\right)\approx -0.084096.$$ Recall that if $y=\log x$ then $x=10^y$. We conclude that $$\left(1-\frac{1}{n}\right)\approx 0.823956,$$ which gives $n=5.6803994$. Of course, that is not right, $n$ must be an integer. If we let $n=5$, the probability we never get $A$ is quite a bit less than $0.003$, while if $n=6$, the probability we never get $A$ is greater than $0.003$.

Remark: You might be interested in numbers other than your special $30$ and $0.003$. More generally, suppose that we pick $k$ times, and we want the probability of never getting $A$ to be $p$. Then we need to solve the equation $$\left(1-\frac{1}{n}\right)^{k}=p.$$ Like in our concrete case, we can find the appropriate value of $n$ by using logarithms. In general, like in our concrete case, there will not be an integer $n$ that gives probability exactly $p$. Again, we use logarithms to the base $10$, though any base will do. We get $$k\log\left(1-\frac{1}{n}\right)=\log p,$$ and therefore $$\log\left(1-\frac{1}{n}\right)=\frac{\log p}{k},$$ and therefore $$1-\frac{1}{n}=10^{\frac{\log p}{k}}.$$ Solving for $n$, we obtain $$n=\frac{1}{1-10^{\frac{\log p}{k}}}.$$

Suppose that instead of your $0.003$, we let $p=0.95$. Let $k=30$. Using the above formula, we get $n\approx 585.4$. This could have taken some time to reach by trial and error.

-
thank you into positive infinity for your 2 answers! P.S.: my precious 0.3% -> 99.7% -> is Sigma 3 love – Terence Feb 17 '12 at 21:05
@Terence: Yes, the $0.3$% sounded implausible for a real problem, but you had a big NOT, so I calculated on the basis of $0.003$. With $0.997$ I get about $9985.5$. – André Nicolas Feb 17 '12 at 22:38
you were correct in everything, even about the 0.3%. But if you wondered where I got the 0.3% from: it's from 1 minus 3 times Sigma (normal distribution), I will be applying this in a real life software situation where I need this kind of certainty (~99,7%) – Terence Feb 17 '12 at 23:25
long story short ;) you interpreted my question correctly with the values – Terence Feb 17 '12 at 23:26

1
@Terence: One must be careful: nothing and nobody in the real world is truly normal. Joke aside, there is a serious point. You are using the normal distribution as a model, or as an approximation to the "real" distribution. In (say) the left tail, the normal approximation may be very good in that the true probability is close to $0$, and the normal gives an answer close to $0$. But the ratio of the tail probabilities may be quite far from $1$. Because of poor tail fit between truth and normal approximation in the ratio sense, the calculated $n$ might be quite far away from the truth. – André Nicolas Feb 17 '12 at 23:45

The chance of not picking the predefined integer in our thirty picks $= \left( \dfrac {x-1} {x}\right) ^{30} = 0.3$. Now solve for x.

-

isnt the 0.3 in your answer 30%? – Terence Feb 17 '12 at 18:56
well u have 0,3% in the question so i was n't sure what u meant and i assumed u meant 0.3. Solving with 0.3 i think the answer for x turns out to be 25. If you are interested i can post the calculation. – Hardy Feb 17 '12 at 19:04
30% or 0.3 is not a very unnatural number for this probability in the question. – Hardy Feb 17 '12 at 19:06
$\left( 1-\dfrac {1} {x}\right) ^{30}=0.3$ <=> $30\ln \left( 1-\dfrac {1} {x}\right) =\ln \left( 0.3\right)$ <=> $1-\dfrac {1} {x}=e^{\left( \dfrac {\ln _{0}.3} {30}\right) }$ <=> $x=\dfrac {1} {1-e^{\left( \dfrac {\ln _{0}.3} {30}\right) }}$ – Hardy Feb 17 '12 at 19:21
$x=\dfrac {1} {1-0.9606} = 25.420867390196038892702305462344$ – Hardy Feb 17 '12 at 19:26
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 64, "mathjax_display_tex": 10, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9309329986572266, "perplexity_flag": "head"}