# The letters ABCDEFGH are to be used to form strings of length four

The letters ABCDEFGH are to be used to form strings of length four. How many strings contain the letter A if repetitions are not allowed?

The answer that I have is :

$$\frac{n!}{(n-r)!} - \frac{(n-1)!}{(n-r)!} = \frac{8!}{4!} - \frac{7!}{4!} = 8 \times 7 \times 6 \times 5 - (7 \times 6 \times 5) = 1470$$ strings.

If you could confirm this for me or kindly guide in me the right direction, please do let me know.

-
you have 7!/4! ways of having 3 letter strings (we are excluding A). Then insert A in 4 places for each. So, the answer is $7!/4! \times 4 = 840$. Posted this here because I may have made a mistake. –  picakhu Dec 2 '11 at 21:46
I see your logic, but do you also see my logic ? I do not know which is right , maybe someone else will get in on this. –  Farshid Palad Dec 2 '11 at 22:02
Your second term is incorrect. It should be $(n-1)!/((n-1)-r)!$, not $(n-1)!/(n-r)!$. –  Arturo Magidin Dec 2 '11 at 22:04
If we do it your way (which is fine), note that you should be subtracting "$\dfrac{(n-1)!}{(n-1-r)!}$" which is $7\times 6\times 5\times 4$. –  André Nicolas Dec 2 '11 at 22:08

The answer you have is trying to count as follows: there are $8\times 7\times 6\times 5$ strings of four letters from among ABCDEFGH with no repetitions, and no further restrictions.

If we exclude $A$, then we have $7\times 6\times 5\times 4$ strings of four letters from among BCDEFGH with no repetitions.

So the total number that do include A is equal to the total number, minus those that do not contain $A$.

However, the second term for this count is incorrect: you should have $$\frac{(n-1)!}{((n-1)-r)!} = \frac{7!}{3!},$$ not what you have.

-
Thank you , I see my mistake, I did 7 choose 3 instead of 7 choose 4. Rookie mistake. –  Farshid Palad Dec 2 '11 at 22:07

Fix A first, then the then you have $7$ choices for the remaining $3$ places, then number of possible arrangements: $$7 \times 6 \times 5$$

Now there are exactly $4$ places where the that A possible fit, making the total number of possible arrangements as: $$7 \times 6 \times 5 \times 4 = 840$$

-

I presume I am correct. Here is a detailed proof.

First exclude 'A' and permute the rest (7P3). Which can be done in $\frac{7!}{4!}$ ways.

Then, include 'A' back into those permuted cases. $|X_1|X_2|X_3|$ and as indicated by the vertical lines can be in 4 locations. So, the answer is

$$\frac{7!}{4!} \times 4 = 840$$

-

There are ${7\choose 3}=35$ ways to choose 3 letters from BCDEFGH. Add an "A" to this set and arrange these four distinct letters in $4!$ ways. This gives $35\cdot 24=840$ strings in total.

-