# Help with difficult problem on permutations/combinations of n lower case letters

Find how many strings of n lowercase letters from the English alphabet contain

a) the letter a?

• is the answer $$26^n - 25^n$$? I got this answer because the total number of letters in the alphabet is $$26^n$$ and the remaining number is $$25$$ because "a" is subtracted from the total number of letters.

b) the letters a and b?

• is the answer $$26^n - 24^n$$?

c) the letters a and b in consecutive positions with a preceding b, with all the letters distinct?

• don't know how to do

d) the letters a and b, where a is somewhere to the left of b in the string, with all the letters distinct?

• don't know how to do
• Welcome to MSE. Your question is phrased as an isolated problem, without any further information or context. This does not match many users' quality standards, so it may attract downvotes, or be put on hold. To prevent that, please edit the question. This will help you recognise and resolve the issues. Concretely: please provide context, and include your work and thoughts on the problem. These changes can help in formulating more appropriate answers. – José Carlos Santos Sep 18 '19 at 6:35
• how is it ensured that a string with contain an "a" if I subtract the total letters from the number of letters with one letter excluded? From this reuslt, it is possible to a string with n,f,y,h,r or any other letter than "a." Is "a" just treated as a letter than needs to be excluded regardless of its position? "a" is the first letter of the alphabet so it is in position 1 – Darren Johnnn Sep 18 '19 at 7:20

For c) since repetition is not allowed, we must choose the $$n-2$$ other letters from the 24 remaining options, which can be done in $$\binom {24}{n-2}$$ ways. Now, taking “$$ab$$” as one unit so they are not separated in any arrangement, we have $$n-1$$ objects to arrange. So, the answer comes out to be: $$\binom{24}{n-2}(n-1)!$$

For d) let us first choose and arrange our other $$n-2$$ characters, which may be done in $$\binom{24}{n-2}(n-2)!$$ ways. Now, we may place $$a$$. There are $$n-1$$ spots left in this string (between the characters and at the termini) and we may assign any of them to $$a$$. The remaining possible spots for $$b$$ depend on where we placed $$a$$ so we must divide it into cases.

If $$a$$ is at spot $$1$$ (to the left of our string of $$n-2$$ other characters) $$b$$ may go to any of the $$n-1$$ (counted similarly) spots to the right of $$a$$. If $$a$$ is at spot $$2$$, $$b$$ may go to any of the $$n-2$$ Basically, if $$a$$ is at spot $$k$$ b has $$n-k$$ choices, so our answer is the earlier factor multiplied by the sum of $$n-k$$ where $$k$$ is a natural number up to $$n-1$$, which comes out as $$n(n-1) - \frac{n(n-1)}2$$ or just $$\frac{n(n-1)}2$$, so our answer is $$\binom{24}{n-2}(n-2)!\frac{n(n-1)}2$$, or $$\binom{24}{n-2}n!\over 2$$

For a you are right.

But for b you must use Inclusion–Exclusion Principle (as you mentioned in the comment with a little mistake): $$26^n-2\times25^n+24^n$$

Option c: The number of string of length $$n-2$$ with distinct letters without a,b is $$P_{n-2}^{24}$$ then you have $$(n-1)$$ position to place ba, so there is $$(n-1)P_{n-2}^{24} = C_{n-2}^{24}(n-1)!$$ strings. The right side of equality can achieve directly if we do as @Certainly not a dog said. Obviously for $$n \geqslant 25$$ there is no string!

Option d: The number of string of length $$(n-2)$$ with distinct letters without a,b is $$P_{n-2}^{24}$$ then you have $$(n-1)$$ places for the first of a,b, and then produce $$(n)$$ places for the later one. Symmetrically half of them is desired, so there is $$n(n-1)/2P_{n-2}^{24}=C_2^nP_{n-2}^{24}=\frac{C_{n-2}^{24}n!}{2}$$ strings. If you first choose positions of a,b that is $$C_2^n$$, and after that place others, the middle equation produces directly. If you first choose $$(n-2)$$ other letters, then sort them with a,b, and then consider exactly in half of them is desired, the right equation is achieved directly. Obviously for $$n \geqslant 25$$ there is no string!

• By the way for "a" and "b" why is it 26^n - 25^n. The letter remaining could be z,t,q,h or any other letter than a. How is it ensured that the number from this subtraction is "a?" Is it cause "a" is just treated as a number subtracted from another? – Darren Johnnn Sep 18 '19 at 7:13
• If you choose any other letter the answer is the same. Once you can read it in this way: The number of all string with length $(n)$ that the set of their letters has exactly $25$ elements. – Ali Ashja' Sep 18 '19 at 7:27
• shouldn't the answer for question b be, 26^n−2*25^n-24^n, not 26^n - 24^n – Darren Johnnn Sep 18 '19 at 7:33
• Yes, you are right, but with a little mistake. I correct my answer. Also explain how it coincides with @Certainly not a dog answer, that may assume as different values mistakenly. – Ali Ashja' Sep 18 '19 at 8:03
• Wait, is 25^n + 25^n - 24^n the same as 26^n−2*25^n-24^n because of subtraction rule used for the 25^n + 25^n - 24^n? (total with no a + total with no a - similar objects) (Wait ignore this! nvm I made a mistake) – Darren Johnnn Sep 18 '19 at 8:06