Finding the coefficient of $x^m$ in $(x+x^2+x^3+.....+x^i)^n$

646 Views Asked by At

EDIT:

My doubt may be silly but if the expansion of $(1-x)^{-n}$ is infinite, how come wolfram displayed 11 terms?

Wolfram result

Can anybody help to solve the whole equation?


I'm trying to solve this question.

I have an equation $(x+x^2+x^3+x^4+x^5+x^6)^2$ [ Taken 6-sided die x 2].

I want to find the coefficient of $x^5$.

I have reduced the equation to $x^2(1-x^6)^2(1-x)^{-2}$.

For $(1-x)^{-2}$,

$$(1-x)^{-2}=\sum_{k\ge0}(-1)^k\binom{-2}{k}x^k=\sum_{k\ge0}\binom{2+k-1}{k}x^k $$

I got -> $1+2x+3x^2$

For $(1-x^6)^2$

$$(1-x^6)^2=\sum_{k\ge0}(-1)^k\binom{2}{k}x^{6k}$$

I got -> $1-2x^6+x^{12}$

So my equation will be$$x^2(1+2x+3x^2)(1-2x^6+x^{12})$$

Am I correct till here? Because when I multiply all the terms I'm getting $$x^2+2x^3+3x^4-2x^8-4x^9-6x^{10}+x^{14}+2x^{15}+3x^{16}$$

Where am I going wrong?

2

There are 2 best solutions below

1
On BEST ANSWER

This GitHub repository solved my problem.

3
On

$$\left(\sum_{i=1}^n a_i\right) ^2 = \sum_{i,j=1}^n a_i a_j$$ by distributive law, so with $a_i = x^i$ and $n=6$ you have $$\left(\sum_{i=1}^6 x^i\right) ^2 = \sum_{i,j=1}^6 x^{i+j} $$ and therefore $$(\mbox{coefficient of $x^5$}) = |\{(i,j) \in \{1,\ldots, 6\}:i+j=5\}|$$ You can count that by hand.

For a more general case, you just need to count the number of ways natural $m$ can be expressed as a sum of $k$ naturals, which is a well known problem with an easy recursion formula, see this other question or on wikipedia.