Consider lists of length 4 made with symbols A,B,C,D,E,F,G. How many are there if repetition is allowed and the list has an E

combinatoricsdiscrete mathematicssolution-verification

This question was from the Book of Proof by Richard H. I initially thought I can do $(1 \cdot 7^3) \cdot 4 = 1372$, because I thought if one entry has E, then all other entries can have any symbol.

I understood I was wrong when I read the solution:

Now we seek the number of length-$4$ lists where repetition is allowed and the list must contain an E. Here is our strategy: By Part (a) of this exercise there are $7 \cdot 7 \cdot 7 \cdot 7 = 7^4 = 2401$ lists with repetition allowed. Obviously this is not the answer to our current question, for many of these lists contain no E. We will subtract from $2401$ the number of lists that do not contain an E. In making a list that does not contain an E, we have six choices for each list entry (because we can choose any one of the six letters A, B, C, D, F or G). Thus there are $6 \cdot 6 \cdot 6 \cdot 6 = 6^4 = 1296$ lists without an E. So the answer to our question is that there are $2401 − 1296 = 1105$ lists with repetition allowed that contain at least one E.

but I am still not sure why my approach would have $267$ more lists. I guess I don't understand what $(1 \cdot 7^3) \cdot 4$ would represent.

Best Answer

To list the difference between your attempt and the solution, consider the number of strings that have exactly $i$ Es:

  • Exactly $1$ E: $(1\cdot 6^3)\cdot 4 = 864$
  • Exactly $2$ Es: $6^2\cdot \binom42 = 216$
  • Exactly $3$ Es: $6^1\cdot \binom43 = 24$
  • Exactly $4$ Es: $6^0\cdot \binom 44 = 1$

The given solution sums the above counts:

$$864+216+24+1 = 1105 \text{}$$

While your attempt incorrectly overcounted strings, by counting each string the number of times E appears:

$$864\cdot 1+216\cdot2+24\cdot3+1\cdot 4 = 1372$$