We can raise a sum to the power of $n$ quickly and easily using Pascal's triangle, due to the binomial theorem:

$$(a+b)^n = \sum_{i=0}^n {n \choose i} a^i b^i$$

For sums of more than one term, we can still do this kind of thing, using multinomial coefficients. For example:

$$(a+b+c)^n = \sum_{i,j,k \in \mathbb{N}}{n \choose i,j,k} a^i b^j c^k,$$

where the multinomial coefficient is assumed to be $0$ if $n \neq i+j+k$.

But there's a related problem that I don't know how to do quickly. Suppose we wish to raise a univariate polynomial to the power of $n$. For example, suppose we're trying to find

$$(ax^2+bx+c)^2.$$

It would be nice to have a quick way of doing this. There's a slow way, of course: using the multinomial theorem and collecting like terms, we can show that this is $$a^2 x^4+2ab x^3+(2ac+b^2)x^2+2bc x+c^2.$$

This formula is quite useful for pen-and-paper/mental arithmetic. In particular, suppose we're trying to square a three digit number, like $431$. Let $x=10$. Then:

$$431^2 = (4x^2+3x+1)^2 = 16 x^4+24x^3+17x^2+6x+1$$

$$= x^5+8x^4+5x^3+7x^2+6x+1 = 185761,$$ which the calculator confirms the correctness of.

Anyway, suppose I wish to *cube* a *four* digit number, or something like that, it would be nice to have a way of writing down the formula for $$(ax^3+bx^2+cx+d)^3$$ that's quicker than using the multinomial formula and then carefully collecting like terms.

Question.Is there a quick way of finding the coefficients in an expression like $(ax^3+bx^2+cx+d)^3$?