# How many strings of four letters have x in them

1. Dec 11, 2016

### Mr Davis 97

1. The problem statement, all variables and given/known data
How many strings of four lowercase letters have x in them?

2. Relevant equations

3. The attempt at a solution
It seems that there are two ways of doing this. First, there are four ways to choose where the x goes, and then there are 25^3 number of ways to choose what the other letters are. So in total there would be 4(25)^3 = 62500 ways.

But another valid way would be to count the complement. That is, there are 26^4 strings of four lowercase letters, and there are 25^4 strings of lowercase letters with no x. Thus 26^4 - 25^4 = 66351 would be how many lowercase letters have an x.

These two numbers obviously don't match. So what could I be doing wrong?

2. Dec 11, 2016

### Staff: Mentor

Is the question "How many strings of four lowercase letters have exactly one x in them?" It makes a difference whether there is exactly one occurrence of this letter or if there can be two or more of these letters in the string.

3. Dec 11, 2016

### Mr Davis 97

Ah! I read the question wrong. Does this mean that first answer is incorrect, as it deals with the case of having exactly one, while second answer is correct, since it deals with the case of having at least one x?

4. Dec 11, 2016

### Staff: Mentor

The first calculation you did is for exactly one x. There are four ways to choose where the x goes, times the 25 other possibilities in the other three positions. IOW, $\binom 4 1 \cdot 25^3 = 62,500$. Your other calculation allows for at least one, but no more than four x's to appear.

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted