I tried to learn generating functions, but I am a way out of it.
And I know a way to solve problems like that by $S_0 – S_1 + S_2 +\cdots$
Please show me in this way because I don't know GF.
The question is:
A basket has $10$ green balls, $10$ blues and $10$ reds. In how many ways can $10$ balls be selected from the basket so that the number of red balls is odd?
Here is a picture of what I tried to do and obviously I'm getting negative number of solutions.
Best Answer
Let $b$, $g$, and $r$ represent, respectively, the number of blue, green, and red balls that are selected from the basket. We know that $$b + g + r = 10$$ However, we require that $r$ is odd, so there are five cases.
$r = 1$: Then \begin{align*} b + g + 1 & = 10\\ b + g & = 9 \end{align*} which is an equation in the nonnegative integers. The number of solutions of the equation $b + g = 9$ in the nonnegative integers is $$\binom{9 + 2 - 1}{2 - 1} = \binom{10}{1} = 10$$
More generally, the number of solutions of the equation $$b + g = n$$ in the nonnegative integers is $$\binom{n + 2 - 1}{2 - 1} = \binom{n + 1}{1} = n + 1$$
$r = 3$: Then \begin{align*} b + g + 3 & = 10\\ b + g & = 7 \end{align*} which is an equation in the nonnegative integers with $7 + 1 = 8$ solutions.
$r = 5$: Then \begin{align*} b + g + 5 & = 10\\ b + g & = 5 \end{align*} which is an equation in the nonnegative integers with $5 + 1 = 6$ solutions.
$r = 7$: Then \begin{align*} b + g + 7 & = 10\\ b + g & = 3 \end{align*} which is an equation in the nonnegative integers with $3 + 1 = 4$ solutions.
$r = 9$: Then \begin{align*} b + g + 9 & = 10\\ b + g & = 1 \end{align*} which is an equation in the nonnegative integers with $1 + 1 = 2$ solutions.
Total: Since the above cases are mutually exclusive and exhaustive, the number of ways of selecting $10$ balls from the basket if the number of red balls is odd is $$10 + 8 + 6 + 4 + 2 = 30$$
Notice that fixing the value of $r$ reduces the number of variables by $1$, which is where you made your mistake in calculating $S_1$. Also, the problem asks you calculate what you are calling $S_1$. There is no need to apply the Inclusion-Exclusion Principle here.