# In how many ways can we select $r$ crayons from six different colors (red, yellow, blue, green, purple, orange), with an odd number of red and yellow?

I need to make a generating function for the following:

In how many ways can we select $r$ crayons from six different colors (red, yellow, blue, green, purple, orange), with an odd number of red and yellow?

Here is what I have so far:

$6$ colors to choose $r$ crayons from makes $e_1 + e_2 + e_3 + e_4 + e_5 + e_6 = r$

Now, on the basis that we just choose $r$ crayons , then we'd have $(1 + x^1 + x^2 + ... + x^n)^6$.

But, where I get stuck is on the constraint of an odd number of red and yellow. I know that a general tried and true formula for an odd number is $2n + 1$. Considering this fact, then for determining an odd amount, would it be legal for me to do this:

$2(1 + x^1 + x^2 + ... + x^n) + 1$

And furthermore have $(2(1 + x^1 + x^2 + ... + x^n) + 1)^2(1 + x^1 + x^2 + ... + x^n)^4$ as a generating function?

• Why the downvote, people? This is a well-formatted question which shows effort on OP's part, no? – Bobson Dugnutt Feb 15 '16 at 8:19

## 1 Answer

HINT: a generating function that only use odd values of some crayon $f_{\text{odd}}$ must contain

$$f_{\text{odd}}(x)=x^1+x^3+x^5+...=\sum_k x^{2k+1}=x\sum_k (x^2)^k$$

Multiply all six $f$-crayons, with different $f$ depending on the constrain.