Question: Find the number of ways of forming 4 letter words using the letters of the word "RAMANA"
This can be solved easily by taking different cases.
- All 3 'A's taken: remaining one letter can be chosen in $^3C_1$ ways. Total possibilities $=^3C_1\cdot\frac{4!}{3!}=12$
- Only 2 'A's taken: remaining two letters out of {R,M,N} can be chosen in $^3C_2$ ways. Total possibilities $= ^3C_2\cdot\frac{4!}{2!}=36$
- Only one A: Number of ways: $4!=24$
Total $=72$.
But my teacher solved it like this. He found the coefficient of $x^4$ in $4!\cdot(1+\frac{x}{1!})^3(1+\frac{x}{1!}+\frac{x^2}{2!}+\frac{x^3}{3!})$ which also came out to be $72$.
Why does this work? Also, if I avoid the factorials, I get number of combinations. That is, number of combinations $=$ coefficient of $x^4$ in $(1+x)^3(1+x+x^2+x^3)$