A "code" is composed of 20 digits (numbers from 0 to 9), and we want to choose a number randomly. What is the possibility that at least one digit will not show up in the code?

What I did:
We have $10^{20}$ possibilities. Now, I want to choose 9 numbers out of the ten, and choose them randomly, so the possibility is:

$\frac{10\cdot9^{20}}{10^{20}} = \frac{9^{20}}{10^{19}}$

But when I put this in the calculator, I get $1.25\dots$ I thought maybe I need a more precise calculator, but even calculators I found in google returns the same answer.

The possibility isn't supposed to be above 1. What is the problem here?

  • 6
    $\begingroup$ You're counting a lot of things twice. For example, you are counting the number 11111111111111111111 as "no twos", "no threes", "no fours" and so on. $\endgroup$ – 5xum Dec 7 '17 at 11:32
  • $\begingroup$ Probability of a number not being $n$ is $9\over10$. Possibility in a 20-digit sequence is $\left({9\over10}\right)^{20}=0.12157...$ $\endgroup$ – MalayTheDynamo Dec 7 '17 at 11:33
  • $\begingroup$ It's not your calculator. $9^{20} = 1.215\ldots \times 10^{19} > 10^{19}$. $\endgroup$ – Eric Towers Dec 7 '17 at 15:07
  • $\begingroup$ This seems like a variant of the coupon collector's problem. $\endgroup$ – Necreaux Dec 7 '17 at 16:26

For any given digit, the probability the "code" does not contain that digit is indeed $(9/10)^{20}$. But computing the probability that any one of the ten digits is missing requires the inclusion/exclusion principle.

  • Add $10×(9/10)^{20}$, like you did, for the probability that one digit is missing.
  • Subtract $45×(8/10)^{20}$ for the probability that two digits are missing. 45 is the number of ways to choose two digits to omit.
  • Add $120×(7/10)^{20}$ for the probability that three digits are missing. Again, 120 is the number of ways to omit three digits.
  • Continue until adding $10×(1/10)^{20}$ for the probability that nine digits are missing.

The final, correct answer is $0.785262\dots$

  • $\begingroup$ Doesn't the wording "..... a $certain$ digit will not show up ..." imply that a particular digit doesn't show up irrespective of other digits being present or absent ? $\endgroup$ – true blue anil Dec 7 '17 at 12:02
  • $\begingroup$ @trueblueanil Meaning clarified. $\endgroup$ – Parcly Taxel Dec 7 '17 at 12:03
  • $\begingroup$ Was that clarified by OP ?? $\endgroup$ – true blue anil Dec 7 '17 at 12:09
  • 1
    $\begingroup$ I don't think it is right to edit OP's $question$. We can ask for clarifications, or mention that it is our interpretation. $\endgroup$ – true blue anil Dec 7 '17 at 12:12
  • 1
    $\begingroup$ Well the answer was actually "a certain", but I think you answered for both "at least" and "a certain". So I got the other one for a bonus. Thanks :) $\endgroup$ – sheldonzy Dec 7 '17 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.