# How many strings are there of $4$ or fewer lower case letters that have the letter '$x$' in them?

These problems always fumble me up. Just looking to see if my answer is correct.

I found that:

$4$ letters: $(26^3) \times 4$,
$3$ letters: $(26^2) \times 3$,
$2$ letters: $(26) \times 2$,
$1$ letter: $1$

The sum being $72,385$.

Correct/incorrect?

-
Repetition of the letter 'x' in a particular string is allowed ? –  Quixotic Dec 5 '11 at 20:06
I would start with how many four-digit strings don't contain the letter "x". We have $25 \cdot 25 \cdot 25 \cdot 25$ possibilities, since each position can take on any of $(26 - 1)$ values. Subtract this from $26^4$. The reason that this is easier is that you have to consider four-digit strings that contain exactly one, two three and four "x's". For your "two letter" result, haven't you counted the string "xx" twice? –  The Chaz 2.0 Dec 5 '11 at 20:10
Yes repeating x is allowed. –  Chris Dec 5 '11 at 20:46

When you want to know the number of objects of some kind that contain at least one of something, it’s usually easiest to calculate the number that contain none and subtract that from the total number of objects. In your problem, for example, there are $26^3$ three-letter strings, of which $25^3$ contain no $x$’s, so there must be $26^3-25^3=1951$ three-letter strings containing at least one $x$. The same analysis can be applied to strings of any length: there are $26^k$ possible $k$-letter strings, of which $25^k$ contain no $x$’s, so there must be $26^k-25^k$ $k$-letter strings that contain at least one $x$.

It’s possible to count the number of strings of a given length that contain at least one $x$, but you have to consider multiple cases. Take strings of length three, for instance: a ‘good’ string can have one, two, or three $x$’s. There are $25^2\cdot 3$ that have one $x$, $25\cdot 3$ that have two $x$’s, and just one that has three $x$’s, for a total of $1875+75+1=1951$ ‘good’ three-letter strings. But you can see that this is going to be quite tedious for even moderately long strings.

-
I am just thinking should we assume repetition 'implicitly' in these sorts of problems? –  Quixotic Dec 5 '11 at 20:27
@MaX: In my experience that’s usually what’s intended if it isn’t explicitly ruled out. If I’m in any real doubt or think that the student may not be distinguishing the two possibilities, I’ll say something about it. –  Brian M. Scott Dec 5 '11 at 20:46
$\quad$Thanks :) –  Quixotic Dec 5 '11 at 20:50
Thank you, I know this is a relatively facile for you guys so I appreciate the explanation. –  Chris Dec 5 '11 at 20:58
Chris, this site is for mathematics (and mathematicians!) of all levels, so you are welcome in every sense of the word. –  The Chaz 2.0 Dec 5 '11 at 21:47

It depends on whether the letter 'x' is allowed to repeat or not, in either case your answer seems incorrect.

If repetition of the letter 'x' in a string is allowed:

$4$ letters: $26^{4} - 25^{4}$
$3$ letters: $26^{3} - 25^{3}$
$2$ letters: $26^{2} - 25^{2}$
$1$ letter: $26-25$

If repetition of the letter 'x' in a string is not allowed:

$4$ letters: $26^{\underline{4}} - 25^{\underline{4}}$
$3$ letters: $26^{\underline{3}} - 25^{\underline{3}}$
$2$ letters: $26^{\underline{2}} - 25^{\underline{2}}$
$1$ letter: $26-25$

Here, I have used the falling factorial notation, $n^{\underline k}=\frac{n!}{(n-k)!}$

-
I doubt that Chris is familiar with the falling power notation, so you probably should explain it (or replace it by quotients of factorials). –  Brian M. Scott Dec 5 '11 at 20:23
Shouldn't the 2 letter calculation be 26^2 - 25^2 (top solution for repeating x being allow)? –  Chris Dec 5 '11 at 20:50