# How many permutations of any 7 letters contain the string bea?

Bea has written a computer program that randomly generates 7 letters of the alphabet without replacement, what is the chance a random list will contain her name, such as, 'cbeadfk'. Answer as a fully simplified fraction.

My solution is: There are 26 letters in the alphabet and 7 are chosen each time, therefore the number of possible permutations is, 26P7 = 3315312000. We are interested in strings containing B, E, A in that order so we take those letters out of the alphabet and string, leaving 4 positions with 23 letters to choose from. The string bea can appear in 5 different permutations for each arrangement of the remaining 4 letters. So the amount of strings containing bea is (23P4)*5 = 1062600 favourable/total = 1062600/3315312000=1/3120

• Yes, that's correct.
– lulu
Jun 5, 2019 at 10:41
• Thanks, this was my first ever post and I did not expect anyone to be that fast. i had to write the question for an assignment and I had no way of checking my answer. Jun 5, 2019 at 10:43
• No problem. Your calculation is clear and thorough. Might be worth noting that it gets a bit more complicated if you allow replacement, since then there are a few strings that contain $BEA$ twice. If you are looking for practice, you might want to try that calculation.
– lulu
Jun 5, 2019 at 10:48
• With replacement there's 2284932 strings that contain bea, making it a 2284932/26^7 chance? Jun 5, 2019 at 11:04
• How do you get that? For a first pass, your method would still say there were $5$ places to start the $BEA$ and since the other four slots can be occupied by any letter, you get $5\times 26^4=2284880$ which is close to, but not the same as what you wrote. However, even then you have got to subtract off the number of strings in which $BEA$ appears twice as you counted them twice.
– lulu
Jun 5, 2019 at 11:11

Another way to calculate it:

Choosing $$m$$ letters in sequence without replacement from the $$26$$ letters, you have probability $$m/26$$ to choose the letter B. But in order for the seven letters to include “BEA” the letter B has to be among the first five letters chosen. The total probability of that is $$5/26.$$

Given that B is among the first five letters, the probability that the next letter is E is $$1/25.$$ Given B in the first five letters followed by E, the probability that the next letter is A is $$1/24.$$

So altogether the probability of “BEA” within the first seven letters is $$\frac5{26} \cdot \frac1{25} \cdot \frac1{24} = \frac1{3120},$$ which agrees with your answer. I also agree that your method is correct. (It is not an accident that both methods get the same answer!)

• Thanks, I think your method is a lot more elegant so thank you. Jun 5, 2019 at 11:02
• Both methods are good. It is nice to have more than one tool to solve the same problem. Jun 5, 2019 at 11:09

Probability of $$bea????$$: $$\dfrac{1\cdot1\cdot1\cdot23\cdot22\cdot21\cdot20}{26\cdot25\cdot24\cdot23\cdot22\cdot21\cdot20}$$.

Probability of $$?bea???$$ : $$\dfrac{23\cdot1\cdot1\cdot1\cdot22\cdot21\cdot20}{26\cdot25\cdot24\cdot23\cdot22\cdot21\cdot20}$$.

Probability of $$??bea??$$ : $$\dfrac{23\cdot22\cdot1\cdot1\cdot1\cdot21\cdot20}{26\cdot25\cdot24\cdot23\cdot22\cdot21\cdot20}$$.

Probability of $$???bea?$$ : $$\dfrac{23\cdot22\cdot21\cdot1\cdot1\cdot1\cdot20}{26\cdot25\cdot24\cdot23\cdot22\cdot21\cdot20}$$.

Probability of $$????bea$$ : $$\dfrac{23\cdot22\cdot21\cdot20\cdot1\cdot1\cdot1}{26\cdot25\cdot24\cdot23\cdot22\cdot21\cdot20}$$.

Hence in total,

$$\frac{5}{26\cdot25\cdot24}=\frac1{3120}.$$