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!

  • $\begingroup$ If this is a homework problem, please provide context in terms of what you've tried so far, and how it's worked out. $\endgroup$ – 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$.

  • $\begingroup$ 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. $\endgroup$ – Brian Tung Apr 19 '15 at 19:30
  • 1
    $\begingroup$ Assuming problem 1 is asking for the number of strings that contain either x or 1. There are 35^8 strings that do not contain x. There are 35^8 strings that do not contain 1. There are 34^8 that do not contain either. So there are 36^8 - (2*35^8 - 34^8) that contain either. $\endgroup$ – Geoffrey Critzer Apr 19 '15 at 21:30

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.