Number of $n-$letter words over a $3-$letter alphabet $\{a,b,c\}$ using each letter at least once There has been a similar question before for a fixed length. However I need a solution for an arbitrary length. There was an answer for arbitrary length using generating functions, however since it is rather complicated and unintuitive for me, I was wondering if it is possible to achieve a solution without using generating functions.
My idea would be to count the number of words of length n, namely $3^n$ and subtract something that accounts for the requirement that each letter must be used at least once. Specifically we have $3$ letters that are fixed and $3^{n-3}$ letters that are free. So my solution is $3! \cdot 3^{n-3}$ for $n \geq 3$, which gives wrong results. Where is my error?

We can use the inclusion-exclusion principle to solve this question.
The number of words with maximum three letters equals $3^n$. However, we need to remove combinations that include exactly two unique letters, or one unique letter only.
In the former case, there are three ways of selecting two letters, and $2^n$ possible combinations. However, these also include the cases in which only a single letter appears; we need to remove those again.
In the latter case, there are only three possible combinations (each letter simply appears $n$ times).
Overall, we find that the number of words of length $n$ equals:
$$3^n - \left[{3 \choose 2} 2^n - 2 {3 \choose 2} 1^n \right] - {3 \choose 1} 1^n = 3^n - 3 \cdot 2^n + 3$$
