# How to solve this combinatorial problem about selecting letters from different groups?

The English alphabet consists of 26 letters, 6 of which (A, E, I, O, U, Y) are vowels and the remaining 20 are consonants. If each letter has the same probability of being chosen, what is the probability of forming a 7- character string such that 3 of its characters are vowels, 3 of its characters are the letter B, and the remaining one is a consonant different from B?

The # of ways in which we can make any word using 26 letters (With repetition) is 26^7.

Out of the 6 vowels, we need to choose 3 (6C3) and put them in 3 of the 7 places available (order is important) so we have 7!/4!.

There's only one way to choose B, and since it's the same letter the order is not important so we choose 3 places out of the 4 places left.

We have 19 consonants left, we choose one and have only 1 place left for it.

This is the logic I've followed to go through this problem, still I always get a probability of 2.575 *10^-3 which is wrong, the correct answer is 7.154 *10^-5.

• Because the event described in the question specifies nothing about the order, order clearly is not important.
– whuber
Jul 2, 2019 at 19:59
• @whuber but we're talking about strings, let's say a three letter string "abc" is different than "bca"
– user252587
Jul 2, 2019 at 20:01
• That is correct: but when one string is in the event, so are all its permutations; and when a string is not in the event, none of its permutations are: that's a precise statement of what it means for order not to matter (as well as an abstract recipe for writing a formula for the answer, btw). Incidentally, the value 7.154E-5 is an approximation of the exact answer, 17955/250994068.
– whuber
Jul 2, 2019 at 20:03
• Must the vowels all be different? Jul 2, 2019 at 21:00
• @BruceET No, for otherwise the correct answer would not equal the value given.
– whuber
Jul 2, 2019 at 21:04

For solving problems of this nature--where the population consists of non-overlapping groups and the sample (or event) is characterized in terms of membership in these groups--I find it helpful to draw a schematic diagram to keep the details straight:

It means that each group has $$n_i$$ elements from which (somehow) $$k_i$$ elements are to be selected according to the rules of the problem.

In the present application there are $$m=3$$ groups: vowels with $$n_1=6$$ members, the letter $$B$$ with $$n_2=1$$ member, and the remaining consonants with $$n_3=19$$ members, totaling $$n = n_1+n_2+n_3=26.$$

Begin by imagining a particular sample conforming to the problem's rules, keeping track of the sequence of elements. For instance, when sampling from the groups with replacement, you might take $$k_1=3$$ vowels $$A, E, A$$ (in that order), $$k_2=3$$ from the second group (necessarily $$B, B, B$$), and $$k_3=1$$ from the last group, such as $$T,$$ producing the sequence $$AEA\,BBB\,T.$$ The sample size is $$k=k_1+k_2+\cdots+k_n=3+3+1=7.$$

To proceed, you need these simple combinatorial facts:

1. The number of distinct ways of reordering $$k$$ items--the size of the group of permutations of $$k$$ things--is $$k!=k(k-1)(k-2)\cdots(2)(1).$$

2. The Orbit Stabilizer Theorem. The "stabilizer" of a particular sequence is the subgroup of permutations that turn it into a sequence that, for your particular problem, is considered equivalent. This theorem asserts that the number of distinct possible samples is the number of permutations of all positions divided by the number of permutations of the positions that convert a given sample into an equivalent one.

In the present case, because we don't care about the actual sequence of letters, (a) any permutation of the first three positions is immaterial; (b) any permutation of the second three is immaterial; and (c) any permutation of the last position is immaterial.

Thus, the full subgroup of such permutations is obtained by permuting the first three positions in $$k_1!=3!=6$$ ways, the second positions (independently of the first) in $$k_2!$$ ways, and so on, for a total number of possibilities of $$k_1!k_2!\cdots k_m!.$$ This is the size of the stabilizer subgroup.

For instance, we could reorder the first three positions by putting the letter in the first position in second place, the letter in second position into the third place, and returning the letter in the third position to the first place, an operation we might schematically write as $$1\to2\to3\to 1.$$ The resulting partial string is

$$AEA\,\ldots \to AAE\,\ldots$$

This is still an acceptable sample.

Obviously, any permutation of the B's in positions 4, 5, and 6 will yield a sequence of three B's; and there is only one permutation of the final consonant in position 7.

Generally, if there are $$g_1$$ possible ways in which you can fill the first $$k_1$$ positions in the sample (that is, the three vowels), $$g_2$$ possible ways to fill the next $$k_2$$ positions (that is, the three letters $$B$$), and so on, then the total number of distinct samples $$N$$ is obtained by multiplying all these counts (since they are independent sampling operations, one from each group); then multiplying by $$k!$$ to count the effects of all possible permutations of all sample positions; and finally--according to the Orbit Stabilizer Theorem--dividing by the size of the stabilizer subgroup. Thus

$$N = \frac{(g_1 g_2\cdots g_m)\,k!}{k_1!k_2!\cdots k_m!}.\tag{1}$$

Once you understand how to get to this point, you can easily solve a large number of combinatorial problems, including most of those that arise in statistical sampling applications and elementary probability theory.

Now we specialize to the present problem, in which elements are chosen from the groups with replacement. For counting $$g_i,$$ this gives $$n_i$$ choices for each of $$k_i$$ positions, resulting in

$$g_i = n_i\times n_i\times \cdots \times n_i = (n_i)^{k_i}.\tag{2}$$

Putting $$(1)$$ and $$(2)$$ together yields a general formula,

$$N = \frac{(n_1)^{k_1}(n_2)^{k_2}\cdots (n_m)^{k_m}\,k!}{k_1!k_2!\cdots k_m!}.$$

Look at how rapidly we could write down a general answer using only the foregoing concepts!

The specific information in the question, as related previously, is $$n=(6,1,19)$$ and $$k=(3,3,1),$$ resulting in

$$N = \frac{6^{3}1^{3}(19)^{1}\,7!}{3!3!1!} = \frac{2^33^3(19)(2^43^2(5)(7))}{2^23^2}=(2^5)(3^3)(5)(7)(19).$$

Finally, when each such sample is equally probable, their common probability is $$1/n^k = 1/(26)^7.$$ The probability of the event in the question therefore is

$$N\left(\frac{1}{n^k}\right) = \frac{(2^5)(3^3)(5)(7)(19)}{2^7(13)^7} = \frac{(3^3)(5)(7)(19)}{2^2(13)^7} = \frac{17955}{250994068} \approx 7.1536\times 10^{-5}.$$

• Excellent work! Is "population" here the same as the term in statistics? Oct 17, 2019 at 8:03
• @baojieqh Yes, "population" and "sample" are used here in conventional ways.
– whuber
Oct 17, 2019 at 10:13
• Thanks for your detailed answer! Would you please gives some more explanation about "we don't care about the actual sequence of letters" with some concrete examples. I can extract only one interpretation from that expression, which is "A𝐸O𝐵𝐵𝐵𝑇 and AO𝐸𝐵𝐵𝐵𝑇 are the same", is my understanding right? Oct 18, 2019 at 20:54