Finding sum of expressions involving coefficients of terms in the expansion $(1+x+x^2)^n$

Solution 1:

Let $f(x) = (1 + x + x^2)^n$, and let $g(x) = f(x)/x$.

  • For 1, consider $g(1) + g(\omega) + g(\omega^2)$, where $\omega = e^{2 \pi i/3}$.
  • For 2, consider $f(i) + f(-i)$.