TITLE: How to find the total number of distinct terms in a certain expansion?
QUESTION [5 upvotes]: We know that $(1+x)^2$ has $3$ distinct terms because $(1+x)^n$ has $n+1$ terms going by the popular expansion starting from ${}_nC_0$ to ${}_nC_n$.
How do we find total number of distinct terms in expressions like $(a+b+c+f)^{40}$ and what's the generalized result?

REPLY [3 votes]: The Multinomial Theorem states that $$\left(\displaystyle\sum_{i=1}^k x_i\right)^n = \displaystyle\sum_{n_1 + \dots + n_k = n} \binom{n}{n_1, \dots, n_k}x_1^{n_1}\dots x_k^{n_k}$$ where $$\binom{n}{n_1, \dots, n_k} = \frac{n!}{n_1!\dots n_k!}.$$ So the number of terms in the expansion is equal to the number of non-negative solutions to the equation $n_1 + \dots + n_k = n$, which is $\displaystyle\binom{n+k-1}{n}$ as is proved here.