Is there an easy way to expand something like (x + x^2 + x^3)^6 ?
Thanks in advance!
Is there an easy way to expand something like (x + x^2 + x^3)^6 ?
Thanks in advance!
My approach avoids multinomials:
Let's play with it a bit: $$\begin{align} (x+x^2+x^3)^6 &= x^6(1+x+x^2)^6\\ &= x^6\frac{((1-x)(1+x+x^2))^6}{(1-x)^6}\\ &= \frac{x^6(1-x^3)^6}{(1-x)^6} \\ \end{align}$$ The numerator and denominator can now be expanded with the binomial theorem, and then long division will simplify the expression. (This is the way I would do it.)
Another approach: $$\begin{align} (x+x^2+x^3)^6 &= (x+(x^2+x^3))^6 \\ &= x^6+6x^5(x^2+x^3) + 15x^4(x^2+x^3)^2 \\ & +\, 20x^3(x^2+x^3)^3 + 15x^2(x^2+x^3)^4 + 6x(x^2+x^3)^5 + (x^2+x^3)^6 \end{align}$$
Now, each of the binomials can be expanded as above.
There is a very compact solution for expanding an all-ones polynomial with no constant term presented here, demonstrated with SymPy/Python below:
>>> from sympy import binomial
>>> Limits = lambda i,j: range(i,j+1) # to give values i-j
>>> list(Limits(1,3))
>>> [1, 2, 3]
>>> k=3 # for x + x2 + x3
>>> n=6
>>> [sum((-1)*ibinomial(n,i)binomial(r-ik-1,n-1)
... for i in Limits(0,(r-n)//k)) for r in Limits(n,k*n)]
[1, 6, 21, 50, 90, 126, 141, 126, 90, 50, 21, 6, 1]
In your case having row 6 and diagonal 5 (down through row 13) of Pascal's triangle will help with the binomials.