<s>[INST] Generating functions for compositions Let $g(n)$ be the number of compositions of n where each part is an odd number. Let $h(n)$ number of compositions of $n$ where each part is either 1 or 2. Using the ordinary generating functions $G(x)$ and $H(x)$, show that $g(n) = h(n-1)$
 [/INST] Let $\mathcal{O}$ denote the class of all odd numbers, so that it has generating function $O(z) = z + z^3 + z^5 + \dots = \dfrac{z}{1-z^2}$. Then the class of compositions into odd parts is
$$\mathcal{G} = \operatorname{S\scriptsize EQ}(\mathcal{O}) \implies G(z) = \frac{1}{1-O(z)} = \frac{1}{1-\frac{z}{1-z^2}} = \frac{1-z^2}{1-z-z^2}$$
where $G(z) = \sum_{n \ge 0} g(n) z^n$ is the generating function for $\mathcal{G}$.
Similarly, let $\mathcal{C}$ denote the class containing just the numbers $1$ and $2$ (so $C(z) = z+z^2$), then the class of compositions into parts equal to $1$ and $2$ is
$$\mathcal{H} = \operatorname{S\scriptsize EQ}(\mathcal{C}) \implies H(z) = \frac{1}{1-C(z)} = \frac{1}{1-z-z^2}$$
where $H(z) = \sum_{n \ge 0} h(n) z^n$ is the generating function for $\mathcal{H}$.
Now you want to prove that $g(n) = h(n-1)$ for $n \ge 1$, or equivalently that $g(n+1) = h(n)$ for $n \ge 0$. We have
$$\sum_{n \ge 0}g(n+1)z^n = \frac{G(z) - g(0)}{z} = \frac1z \left( \frac{1-z^2}{1-z-z^2} - 1\right) = \frac{1}{1-z-z^2} = H(z)$$
which proves the assertion.
</s>