# If we select a random integer number of the set $[1000000]$ what is the probability of the number selected contains the digit $5$?

If we select a random integer number of the set $[1000000]$ what is the probability of the number selected contains the digit $5$?

My work:

We know the sample space $S:$"The set of number of 1 to 1000000" and $|S|=1000000$
Let $E$ the event such that $E:$"The set of number contains the digit 5 in $[1000000]$" We need calculate $|E|$.

I know in $[100]$ we have $5,15,25,35,45,50,51,52,53,54,55,56,57,58,59,65,75,85,95$ then we have 19 numbers contains the digit $5$ in the set $[100]$

Then in $[1000]-[500]$ we have 171 numbers have the digit 5. this implies [1000] have 271 number contains the digit 5.

. . .

Following the previous reasoning we have to $[10000]$ have 3439 number contains the digit 5.

Then, $[100000]$have 40951 number contains the digit 5.

Moreover, $[1000000]$ have 468559 number contain the digit 5.

In consequence the probability of we pick a digit contain the number 5 in the set $[1000000]$ is 0.468

Is correct this?

How else could obtain $|E|$?

Thanks

• I assume you mean $1$ to $1000000$? – Remy Mar 28 '18 at 20:32
• Yes is that @Remy – Bvss12 Mar 28 '18 at 20:33
• Among the integers $\{0,1,2,3,\dots,999999\}$ there are $9^6$ numbers without any $5$'s. Can you see why? Adjusting and looking instead at $\{1,2,3,\dots,1000000\}$ it remains $9^6$ don't have a $5$. – JMoravitz Mar 28 '18 at 20:34
• I think you take the complement, no? @JMoravitz – Bvss12 Mar 28 '18 at 20:35
• Temporarily allow leading zeroes to be considered and count how many six-digit strings there are using digits $\{0,1,2,3,4,6,7,8,9\}$. Apply rule of product with the steps "pick the first digit", "pick the second digit", etc... – JMoravitz Mar 28 '18 at 20:37

Notice that $P(\text{contains 5})=1-P(\text{doesn't contain 5})$. The latter is easily calculated by calculating the probabilities that each individual digit is not 5. Hence,
\begin{align} P(\text{doesn't contain 5})&=\left(\frac{9}{10}\right)^6\\ &=\frac{531441}{1000000} \end{align} and \begin{align} P(\text{contains 5})&=1-P(\text{doesn't contain 5})\\ &=1-\frac{531441}{1000000}\\ &=\frac{468559}{1000000} \end{align} which corresponds with the answer you got.