How many 4 letter words can we make from BANANAS
Using exponential generating functions, since there are 3 A's, 2 N's, 1 B, and 1 S, we get
$g_e(x)=\left(1+x+\frac{x^2}{2!}+\frac{x^3}{3!}\right)\left(1+x+\frac{x^2}{2!}\right)(1+x)^2=1+4x+7x^2+\frac{43}{6}x^3+\frac{19}{4}x^4+\cdots$,
so there are $(4!)(\frac{19}{4})=\color{red}{114}$ words of length 4.
Alternatively, we can consider the number of A's used:
1) 3 A's: There are 3 choices for the remaining letter, giving $4\cdot3=12$ cases
2) 2 A's: With 2 N's, there are 6 cases, and with BN, SN, or SB we get $3\cdot12=36$ additional cases
3) 1 A: with 2 N's, we get $2\cdot12=24$ cases, and with NBS we get $4!=24$ additional cases
4) 0 A's: this gives $4\cdot3=12$ cases
Therefore the total is given by $12+42+48+12=\color{red}{114}$ cases.
You can make a distinct four letter string from $\sf AAABNNS$ by selecting then arranging: $$\sf (AAA[B|S|N]) \mid (AANN) \mid ([AA|NN]BS) \mid ([AAN|NNA][B|S]) \mid (ANBS)$$
Count the ways for each case, then add.
- Triple and singleton (3 choice of singletons)
- $\binom 11\binom 3 1\frac{4!}{3!~1!}$
- Two pair
- Pair and two singletons
- Four singletons
Okay, bring out the big and boring guns.
We can have:
No multiple letters. Thus words using B,A,N,S. There are $4!$ such words.
One pair of double letters. That letter can be be A or N, and for the remaining two letters we can omit (A or N), B, or A. So there are $2*3$ choices of letters and for each choice of letter there are $4*3$ ways to place the two non repeating letters. So $6*4*3$ such words.
Two pairs of A and N. There are ${4 \choose 2}$ choices to arrange AANN.
Three letters. A and then N,B,S for the remaining letter. That is $3$ chooses of letters and $4$ choices of where to put the one non repeating letter. $3*4$ total.
So there are $4! + 6*4*3 + {4\choose2} + 3*4 = 24 + 72 + 6 + 12 = 114$ total.