# How many combinations of four letters each can be made from the word PEPPER?

As the title says. I know that if there is no certain number of letters to choose you would have to just do 6!/3!2!. But what would you do if you have to only choose 4 letters?

-
Taking all three P's leaves two choices ({E} vs {R}), taking two P's leaves two choices ({E, R} vs {E, E}), taking one P leaves one choice ({E, E, R}). – A.E Jun 9 '14 at 1:33
When you say "combination" do you mean this in the mathematical sense? As in order is unimportant? i.e. "PEPP" would be the same combination as "PPEP"? Or do you mean how many different ways can the 4 letters be arranged? – wgrenard Jun 9 '14 at 1:37

The response by user155957 was based on assuming that when you said 'combinations', you really meant 'permutations'. Based on this assumption, that user's response is correct by my reckoning.

Let us assume that when you said 'combinations', you really meant combinations.

In that case, the answer is 5.

If all the letters were distinct, such as they are in 'PENCIL', then the number of combinations possible with 6 distinct letters, taking 4 at a time, is given by the function nCr( 6, 4), which gives 15. However, the word is 'PEPPER', and the letters are not all distinct.

Writing the 'source partition' for the word PEPPER gives:

 P E R
[3,2,1]  <-- source partition


For combinations of 4 letters, we write all three possible 'target partitions' that go with [3,2,1]. These are:

[3,1]
[2,2]
[2,1,1]


Next to these, we list the corresponding selections (which are combinations, NOT permutations!)

[3,1]    PPPE, PPPR
[2,2]    PPEE
[2,1,1]  PPER, EEPR


In conclusion, there are 5 combinations of 4 letters each that can be made from the word PEPPER.

-

Imagine reordering the 6 letters accounting for repetition (getting to the 60 you mentioned in the question). Map those 6 letter words into 4 letter words by taking into account only the initial 4 letters. In some cases you will map multiple 6-letter words into one 4-letter word.

You have 60 ways of reordering the 6 letters. Of these 60, 12 end with "PP", 4 end with "EE" (calculated the sam way you got to the 60). These map 1 to 1; that is one 6-word string into one 4-word string.

All the rest (44 = 60-16) end with 2 different letters- which means that you will be mapping two different 6-letter strings into one 4-letter string.

By looking only at the first 4 letters the 60 6-letter words will be mapped into 38 distinct cases (44/2 + 16).

-
But the OP is asking how many four letter COMBINATIONS can be taken from the multiset {P,P,P,E,E,R}. Here you are correctly giving the number of four letter PERMUTATIONS of the multiset. – Geoffrey Critzer Jun 9 '14 at 14:53
I know, but based on the rest of the text in the answer I thought this is what the person asking the question actually wanted to know. – user155957 Jun 10 '14 at 0:09
@ user155957 Based on the green check mark I'd say you are right. – Geoffrey Critzer Jun 10 '14 at 0:14

If you are familiar with generating functions then there is a simple way to do this. Otherwise there is a longer solution as well.

The number of P's that you can use is at least $1$ and at most $3$. The number of R's that you can use is at least $0$ and at most $1$. The number of E's that you can use is at least $0$ and at most $2$.

Thus you create the following expression where each term is based on the number of times a letter can be used: $$(x+x^2+x^3)(1+x)(1+x+x^2)$$

Now compute the coefficient of $x^4$.

-

Imagine that you have 3 boxes labeled with the letters P,E,R. You also have 4 indistinguishable markers of some sort, like 4 identical balls. Place the balls inside the boxes in every possible way so that there are at most 3 balls in the box labeled P, at most 2 balls inside the box labeled E and at most 1 ball inside the box labeled R. Would you agree that this is the same as the number of combinations of 4 letters from the word PEPPER.

Now without using your computer expand (1 + x + x^2 + x^3)(1 + x + x^2)(1 + x). Would you agree that the coefficient of x^4 in this product is the same number as the number of ways to place the balls into the boxes. See how it's the same problem?

-
the expression for P should not start from $1$ as one has to use at least one P. – Anurag A Jun 9 '14 at 1:43
The contributions to x^4 will not be affected by the presence of the 1 in the first factor (the expression for P). The 1 is necessary so that the other coefficients will also be the number of size n multisets on {P,E,P,P,E,R}. – Geoffrey Critzer Jun 9 '14 at 1:51