In how many ways can we select $r$ doughnuts from a box of a dozen doughnuts that has $2$ apple fritters, $3$ sprinkled, $3$ jelly and $4$ glazed?”
For this question, I'm supposed to come up with a generating function to determine the number of ways. Here is what I came up with so far:
I have four entities in this box of a dozen doughnuts. Apple Fritters, Sprinkled, Jelly, and Glazed doughnuts.
Then let $e_1$ be the Apple Fritters, $e_2$ be the Sprinkled doughnuts, $e_3$ be the Jelly doughnuts, and $e_4$ be the Glazed doughnuts for:
$e_1 + e_2 + e_3 + e_4 = r$.
And then, with the constraints of $0 \le e_1 \le 2, 0 \le e_2, e_3 \le 3, 0 \le e_4 \le 4 $, I get:
$(1 + x^1 + x^2)(1 + x^1 + x^2 + x^3)^2(1 + x^1 + x^2 + x^3 + x^4) $
for a generating function. Is this correct?