I came across a question which asked me to find the coefficient of $x^{2n}$ in the following polynomial:
$$(\sum\limits_{i=0}^{n-1} x^i )^{2n+1}$$
My approach was to isolate every term, i.e. if we choose $x^2$ , n times and 1 n times again, we get a part of the coefficient of $x^{2n}$. Doing the same for $x^4$, n/2 times and iterating this process over and over would take a lot of time and the answer will be in the form of a sigma which maybe reduced as well.
However, the answer given was rather simple
Required form of answer
${2n+1}\choose{2}$-${{2n+1}\choose{1}}{{3n}\choose{n}}$+${4n}\choose{2n}$
My questions
- (if possible)How should I proceed with my method so that I reach the same results?
- Any other method to precisely find the number of solutions for the equation $$(\sum\limits_{i=1}^{2n+1} x_i )=2n$$ where all $0\leq x_i\leq n-1$
You actually want the number of solutions in non-negative integers to the equation
$$\sum_{i=1}^{2n+1}x_i=2n\;.\tag{1}$$
This can be found by a combination of stars and bars calculations and an inclusion-exclusion calculation.
Without the upper limit of $n-1$ this has $\binom{2n+(2n+1)-1}{(2n+1)-1}=\binom{4n}{2n}$ solutions in non-negative integers by the usual stars and bars calculation. For each $k=1,\ldots,2n+1$ we need to subtract the number of solutions in which $x_k\ge n$. These are in bijective correspondence with solutions to
$$\sum_{i=1}^{2n+1}x_i=2n-n=n\;,$$
and by a similar calculation there are $\binom{3n}{2n}=\binom{3n}n$ of them for each $k$. Thus, we need to subtract $(2n+1)\binom{3n}n=\binom{2n+1}1\binom{3n}n$ to correct for overcounting. However, any solution to $(1)$ in which two of the $x_i$ exceed the upper bound have now been subtracted twice and need to be added back in. For each pair of indices $k$ and $\ell$ there is just one solution to $(1)$ in which $x_k\ge n$ and $x_\ell\ge n$, so we must add $\binom{2n+1}2$ to correct the excessive subtraction in the first correction. And now we’re done, since $(1)$ has no solutions in which more than two of the $x_i$ exceed the upper bound: the final result is
$$\binom{4n}{2n}-\binom{2n+1}1\binom{3n}n+\binom{2n+1}2\;.$$