Computing the coefficient of the term of a certain degree in a polynomial Given the polynomial
${1\over8}((1+z)^9 + 3(1-z)^4(1+z)^5 + (1-z)^6(1+z)^3)$
(which is the weight enumerator of a code)
how do I find out the coefficient of $z^2$?
The solution given is ${1 \over 8}(36-12+0) = 3$.
I got $36$ for the $z^2$ coefficient of $(1+z)^9$ using the Binomial Theorem, but I don't know how to get $-12$ for the $z^2$ coefficient of $3(1-z)^4(1+z)^5$. By using the Binomial Theorem separately on $(1-z)^4$ and $(1+z)^5$ I get the following two polynomials, repsectively:
$z^4-4z^3+6z^2-4z+1$
$z^5+5z^4+10z^3+10z^2+5z+1$
I am unsure what to do next, or even if this is going in the right direction.

We can work this out by establishing a general formula for
$$(1-z)^m(1+z)^n=(1-mz+\frac{m(m-1)}2-\cdots)(1+nz+\frac{n(n-1)}2z^2+\cdots).$$
The $z^2$ term has the coefficient
$$\frac{m(m-1)}2-mn+\frac{n(n-1)}2=\frac{(m-n)^2-(m+n)}2.$$
Hence,
$$9,0\to 36\\4,5\to-4,\\6,3\to0$$ and the solution is
$$\frac{36-3\cdot4}8.$$
