I have the term: $(1 + 2x - x^2)^4.$
The question asks me to find the coefficient of $x^5$.
My solution:
$\sum\limits_{i=0}^4 {4 \choose r} (1)^{4-r}(2x-x^2)^r$
I then factored out x from $(2x-x^2)$, getting $x(2-x)$.
Then, since the terms with the x's are being raised to the $r$th power, I did:
$(x(2-x))^r$, or $x^r(2-x)^r$
I know that I'm dealing with x's, so since I want the exponent to be 5 as the question says, I focus on the x's and multiply them together to get $x^{2r}$, and then I equated 2r to 5. Solving, I got r = 5/2 which can't be because I'm dealing with a binomial coefficient - integers only.
What did I do wrong? My logic makes sense to me, but I don't see why I'm incorrect here.
Thanks.
Since the size of the problem is small, we can count the cases directly. First, there are two partitions of 5 into at most 4 parts with each part at most 2, namely, $5=2+2+1$ and $5=2+1+1+1$. These correspond to the ways you can get $x^5$.
The partition $5=2+2+1$ means you get 2 factors of $-x^2$ from two of the terms, and a factor of $2x$ from another one. You can do this in $\binom42\binom21=12$. So you $12$ terms of the form $(-x^2)^2 2x$; in total $24x^5$.
For $5=2+1+1+1$ there are $\binom41\binom33=4$ cases and the terms are of the form $-x^2(2x) (2x)(2x)=-8x^5$; in total $-32x^5$.
So the $x^5$ term is $$ 24x^5-32x^5= -8x^5. $$
In your method you also need to expand $(2x-x^2)$ with a binomial sum.
Note: Corrections made based on the comment below.