Calculating Coefficients of an N Degree Polynomial raised to an Arbitrary Power Suppose you have $(a_0+a_1x+a_2x^2+...+a_nx^n)^k$, and you want to expand and find a formula for the coefficients $\beta_j$ such that $\beta_j$ is the coefficient of the $x^j$ term.
I understand that when the all coefficients $a_1, ..., a_n$ are equal to 1, you would get: $$\beta_j = \sum_{i=0}^{\lfloor\frac{j-n}{k}\rfloor}(-1)^i\binom{n}{i}\binom{j-ik-1}{n-1}$$
but how would you generalize this $\forall a_1, ..., a_n \in \mathbb{R}$?
 A: As indicated by @GerryMyerson we can use the multinomial theorem to extract $[x^j]$, the coefficient of $x^j$ of the multinomial.

We obtain
\begin{align*}
[x^j]&\left(a_0+a_1x+\cdots+a_nx^n\right)^k\\
&=[x^j]\sum_{{t_0+t_1+\cdots+t_n=k}\atop{t_0,t_1,\ldots,t_n\geq 0}}
\binom{k}{t_0,t_1,\ldots,t_n}a_0^{t_0}a_1^{t_1}\cdots a_n^{t_n}x^{t_1+2t_2+\cdots+nt_n}\\
&\color{blue}{=\sum_{{{t_0+t_1+\cdots+t_n=k}\atop{t_1+2t_2+\cdots+nt_n=j}}\atop{t_0,t_1,\ldots,t_n\geq 0}}
\binom{k}{t_0,t_1,\ldots,t_n}a_0^{t_0}a_1^{t_1}\cdots a_n^{t_n}}
\end{align*}

A: The coefficient $\beta_j$ of $x^j$ in $(a_0 + a_1 x + \ldots + a_nx^n)^k$ will be
$$\beta_j = \sum_{r_1 + r_2 + \ldots + r_k = j} a_{r_1} a_{r_2} \cdots a_{r_k}$$
So, for instance, if we look at the $x^4$ coefficient in $(a_0 + a_1 x + a_2 x^2)^3$, we sum over all the (ordered!) ways to write $4$ as a sum of exactly $3$ of our existing indices.

*

*$4 = 2 + 2 + 0$

*$4 = 2 + 0 + 2$

*$4 = 0 + 2 + 2$

*$4 = 1 + 1 + 2$

*$4 = 1 + 2 + 1$

*$4 = 2 + 1 + 1$
so we see
$$
\begin{align}
\beta_4 
&= a_2 a_2 a_0 + a_2 a_0 a_2 + a_0 a_2 a_2 + a_1 a_1 a_2 + a_1 a_2 a_1 + a_2 a_1 a_1 \\
&= 3 a_0 a_2^2 + 3 a_1^2 a_2
\end{align}
$$
Of course, we can check this in a computer algebra system like sage.

To see why this is the case, you might be interested in cauchy products. Particularly since you tagged this question as "generating-functions". You can also find this information in chapter 2 of Wilf's excellent generatingfunctionology.

I hope this helps ^_^
