Get the coefficient of $x^n$ in the binomial expansion

binomial-coefficients

I have this statement:

Get the coefficient of $x^n$ in $(1-x+x^2)(1+x)^{2n-1}$

My development was:

Note that all exponents of $(1+x)^{2n-1}$ will be modified by $+2$ by $x^2$ and $+1$ by $x$

Then the to get $x^n$ i need the $x^{n-2}$ term in the binomial expansion of $(1+x)^{2n-1}$.

The $x^{n-2}$ term is given by $1^{2n-1-c} \cdot x^{c} \cdot \binom{2n-1}{c}$ And $c$ need to take the value of $x-2$, then i will get: $\binom{2n-1}{x-2}x^{n-2}\cdot(x^2-x+1) = \binom{2n-1}{x-2}( x^n – x^{n-1} +1)$, Therefore the sign of $x^n$ is $\binom{2n-1}{x-2}$.

But according to the guide, my answer is incorrect and i don't know what is wrong with my development. Thanks in advance.

Best Answer

You have the right basic idea. However, in your case, $c$ would take the value of $n - 2$, not $x - 2$. Also, note with the $1$ term in the left factor, you will use the coefficient of $x^n$ term in $(1 + x)^{2n-1}$. Similarly, with the $-x$ term, you will subtract the coefficient of $x^{n-1}$ term in $(1 + x)^{2n-1}$, and finally with the $x^2$ term, you will add the coefficient of the $x^{n-2}$ term of $(1 + x)^{2n-1}$. Putting this together gives that the coefficient of $x^n$ is

$$\binom{2n-1}{n} - \binom{2n-1}{n - 1} + \binom{2n-1}{n - 2} \tag{1}\label{eq1A}$$

Related Question