# Probability question involving r-digit numbers

• September 21st 2010, 08:05 PM
Zennie
Probability question involving r-digit numbers
What is the probability that a random r-digit number (such that r is greater than or equal to 3) contains at least one 0, at least one 1, and at least one 2.

An explanation of how to do this would be much appreciated!
• September 21st 2010, 08:45 PM
undefined
Quote:

Originally Posted by Zennie
What is the probability that a random r-digit number (such that r is greater than or equal to 3) contains at least one 0, at least one 1, and at least one 2.

An explanation of how to do this would be much appreciated!

One way to solve is with inclusion-exclusion.

I assume leading zeroes are not allowed.

# of r-digit numbers having no 0's is 9^r, for no 1's it's 8*9^(r-1) and same for no 2's.

# of r-digit numbers having no 0's and no 1's is 8^r, same for no 0's and no 2's, and for no 1's and no 2's it's 7*8^(r-1).

The number of r-digit numbers having no 0's, 1's, or 2's is 7^r.

Apply $|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C| \,.$

This gives you the complement set of what you're really trying to count, so subtract it from 9*10^(r-1), alternatively calculate probability and subtract it from 1.