<s>[INST] For $(1 + x + x^2)^6$, find the term which has $x^6$ in it. 
For $(1 + x + x^2)^6$, find the term which has $x^6$ in it.

I tried to use Newton's binomial formula as:
$$
(1 + x + x^2)^6 = \sum_{k = 0}^{6}\left( \binom{6}{k}(1 + x)^{n-k} x^{2k}\right)
$$
and that's all I can think of, other then just to compute it.
 [/INST] When you expand the product you get $3^6$ summands, each summand corresponds to whethere $1,x$ or $x^2$ was picked in each of the factors.
Notice that $6$ is the average "degree", so in order to get $x^6$ you need to select the same number of $1$ as $x^2$, and therefore you need to select an even number of $x$. So if we select $x$ $2i$ times we select $1$ $3-i$ times and $x^2$ also $3-i$ times. The number of ways this can be dome is $\binom{6}{2i,3-i,3-i}$.
We can get that the number of ways to do this is $\sum\limits_{i=0}^3 \binom{6}{2i,3-i,3-i}$.
Hence the answer is $\binom{6}{0,3,3} + \binom{6}{2,2,2} + \binom{6}{4,1,1} + \binom{6}{6,0,0} = 20 + 90 + 30 + 1 = 141$
</s>