# How to find number of solutions using generating functions

I need to find the number of solutions to the following equation

$x_1+x_2+x_3+x_4 = n$ where $x_1 = 2k, \space x_2 \in \{0,1,2\}, \space x_3=3q, \space x_4 \in \{0,1\}$

Using generating functions. The biggest problem I'm having with approaching this problem is the fact that the equation is being set equal to $n$ and not a specific number.

Thanks!

• Find the coefficient of the $x^n$ term in the expansion of the product of useful terms. What counts as useful in this case has to do with the number and types of options available for each term. For example, $(1+x)$ corresponds to an option of $0$ or $1$. Meanwhile $(1+x+x^2)$ corresponds to an option of $0$ or $1$ or $2$. Notice $(1+x+x^2)(1+x)=1+2x+2x^2+x^3$ corresponds with the number of ways of getting the totals $0,1,2,3$ respectively by adding $z_1$ and $z_2$ with $z_1\in\{0,1,2\}$ and $z_2\in \{0,1\}$. Any guesses as to how to represent $x_3$ needing to be multiples of $3$? – JMoravitz Dec 5 '16 at 1:17
• As an aside, Generatingfunctionology is a good free resource for information on all sorts of generating functions. – JMoravitz Dec 5 '16 at 1:24
• Funny, you accept an answer 4 hours after it is posted, although, according to a comment of yours, it is not what you wished for. Please explain. – Did Dec 5 '16 at 12:32
