So far I am thinking it would be $3!×3^5×\dbinom{4}{3}×6$ but I have a feeling I'm missing something.
- $3!$ - to make sure all $3$ of the $4$ are included.
- $3^5$ - as the other five numbers can be any of the $3$.
- $\dbinom{4}{3}$ - number of ways you can select $3$ of $4$.
- $6$ - number of places $3!$ could be.
Thanks in advance.
We must choose three of the four characters to include in the sequence.
There are $3^8$ sequences of length $8$ using these three characters, but some of them use fewer than three characters. We must exclude them.
In what follows, we will assume that the three characters used in the sequence have already been selected. We will count sequences of length eight that use all three of the selected characters.
There are $\binom{3}{1}$ ways to exclude one of the selected characters and $2^8$ ways to form a sequence of length eight with the remaining two characters. Hence, there are $\binom{3}{1}2^8$ sequences of length eight that exclude one of the selected characters.
However, if we subtract the number of sequences that do not contain a particular character from the number of sequences that be formed with the three selected characters, we will have subtracted too much since we subtract those sequences from which two of the selected characters are missing twice, once for each way we could designate one of those characters as the missing one. Thus, we must add them back.
There are $\binom{3}{2}$ ways to exclude two of the three selected characters and one way to fill all eight positions in the sequence with the remaining selected character. Hence, there are $\binom{3}{2}1^8$ sequences from which of the selected characters have been excluded.
By the Inclusion-Exclusion Principle, the number of sequences of length eight that use all three of the selected characters is $$3^8 - \binom{3}{1}2^8 + \binom{3}{2}1^8$$
Since there are $\binom{4}{3}$ ways to select which three of the four characters will appear in the sequence, the number of sequences of length eight that contain exactly three of the four characters is $$\binom{4}{3}\left[3^8 - \binom{3}{1}2^8 + \binom{3}{2}1^8\right]$$