<s>[INST] 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.
 [/INST] A short cut or two:
$$(1-z)^4(1+z)^5=(1-z^2)^4(1+z)=(1-4z^2+\cdots)(1+z)=1+z-4z^2+\cdots$$
and
$$(1-z)^6(1+z)^3=(1-z^2)^3(1-z)^3=(1-3z^2+\cdots)(1-3z+3z^2-z^3)
=1-3z+0z^2+\cdots$$
etc.
</s>