Series expansion of infinite series raised to the $n$th power

Here is my attempt at a solution, Let $f(x) = \sum_{k=0}^{\infty}a_k x^k$, then we have that \begin{align*} f(x)^n &= \left( \sum_{k=0}^{\infty}a_k x^k \right)^n \\ &= \sum_{k=0}^{\infty} \left(\sum_{\substack{0 \leq r_1,\ldots,r_n \leq k \\ r_1 + \cdots + r_n = k}}a_{r_1} \cdots a_{r_n}\right) x^k \\ \end{align*} Now for any specific choice of $r_1,\ldots,r_n$ satisfying the condition $$0 \leq r_1,\ldots, r_n \leq k,\quad r_1 + \cdots + r_n = k$$ there are, say, $m \leq n$ many distinct elements in the set $S = \{r_1,\cdots,r_n\}$, call these distinct elements $$s_1,\ldots,s_m$$ and define $$N(s_i) = \# \text{ of times $s_i$ appears in $(r_1,\ldots,r_n)$}$$ then we see that the number of times $$a_{r_1}\cdots a_{r_n}$$ is counted is equal to $$C(r_1,\ldots,r_n) := \frac{n!}{N(s_1)! \cdots N(s_m)!} \quad \text{(The multinomial coefficient)}.$$ Thus we have $$f(x)^n = \sum_{k = 0}^{\infty} \left( \sum_{\substack{0 \leq r_1 \leq\ldots \leq r_n \leq k \\ r_1 + \cdots + r_n = k}}C(r_1,\ldots,r_n)a_{r_1} \cdots a_{r_n} \right) x^k$$ Notice that now the inner sum is over a smaller set and hence (in theory) makes the calculation easier.


If you know multinomials, then the result is the same: the series will contain infinite term, but each term will be composed by at maximum $n$ different $a_k$, and you can determine the coefficient of $a_{i_1}^{r_1}\dots a_{i_s}^{r_s}$, with $r_1+\dots+r_s = n$ by the multinomial $$ \frac{n!}{r_1!\dots r_s!} $$