In the box are 4 red balls, 5 blue balls and 2 yellow balls. How many possible solutions there are to get 7 balls from box to have at least 1 red ball and exactly 2 blue balls?
I'm not sure I am doing it correct. My answer is:
Taking blue possibility is
$1 +x^2$
Taking red possibility is
$(1 + x^1 + x^2 + x^3 + x^4)$
Taking yellow possibility is
($1+x^1+x^2$)
So the generating function looks like
$ (1 +x^1 + x^2 + x^3 + x^4)* (1+x^1+x^2)* (1+ x^2) $
And the coefficient of x^7 is 3
So there are only 3 ways to take them
This same problem i got with exercise:
Using generation function show on how much possibilities you can throw n points on k dices.
I was trying to do this like:
n - number of points
k - number of dices
I made function for this, but I dont know what to do later.
$(x^1+x^2+x^3+x^4+x^5+x^6)^k$ // 6 walls in dice
And here i'm stuck.
I do not think your first example is correct. We have between $1$ and $4$ red balls, exactly $2$ balls, and at most $2$ yellow balls. You have an extra $1$ in two of your expressions (I am not sure why).
$$[x^7](x+x^2+x^3+x^4)(x^2)(1+x+x^2) = 2$$
Your answer to the dice question is exactly correct. You can make it a little more compact
$$(x+x^2+x^3+x^4+x^5+x^6)^k = \left(\frac{x^7-1}{x-1}\right)^k$$