# Counting and Probability String Length

Consider strings that can be made up from the set $\{a, b, c, d, e, f, \cdots, z, 0, 1, 2, \cdots, 9\}$

1) How many strings of length 8 contain either the letter '$x$' or '$1$'?

2) What is the probability that given a random string of length $8$, the string will contain exactly $1$ '$y$'?

3) How many strings of length $8$ contain at least one '$w$'?

I do not know how to approach problems like this. I know that for each string position, there are 36 possibilities. However, how can I use the multiplication rule when a string must contain either one character or another? Thank you!

• If this is a homework problem, please provide context in terms of what you've tried so far, and how it's worked out. – Brian Tung Apr 19 '15 at 18:53

1)If only two characters "$x$" and "$1$" are allowed, then we can have exactly $2^8$ strings.
2)There are in total $36^8$ strings of length $8$. The number of strings with exactly one "$y$" is $8\cdot 35^7$, that is there are $8$ possible places for the "$y$", and in the rest we can use $35$ characters. Hence, the required probability is $\frac{36^8}{8\cdot 35^7}$.
3)One way to count it is to consider reversely, how many strings have no "$w$". We can get the answer: $36^8-35^8$.
• I think it's possible that problem $1$ is asking for the number of strings that contain either $x$ or $l$, not those that contain only $x$ or $l$. Hard to tell from the given wording. (To be sure, it would then seem to be a duplicate of problem $3$.) Your answer for problem $2$ is correct, except that you gave the reciprocal of the probability. – Brian Tung Apr 19 '15 at 19:30