I've tried to solve the following question by using generating functions.I know It's pretty simple to do it with Inclusion–exclusion principle but I insist to solve it with other technique as well.
Q: how many combination to spread 10 balls into 5 boxes when in each box there is at least one ball.
A: $ (x+x^2+x^3+x^4...)^5 = x^5(1+x+x^2+x^3...)^5 = x^5 \frac{1}{(1-x)^5} = x^5 \sum_{i=0}^\infty \binom{n+5-1}{5-1}x^n$
I want the coefficient of $x^{10}$ so $n=5$ which is $\binom{9}{4} = 126$
sadly it isn't the same answer like the Inclusion–exclusion principle, i guess my series isn't right but I can't see why.
This is small enough to check by hand which of your results (if either) is correct.
$6$: $5$ arrangements
$5$, $2$: $5\cdot4=20$ arrangements
$4$, $3$: $5\cdot4=20$ arrangements
$4$, $2$, $2$: $5\cdot\binom42=30$ arrangements
$3$, $3$, $2$: $5\cdot\binom42=30$ arrangements
$3$, $2$, $2$, $2$: $5\cdot4=20$ arrangements
$2$, $2$, $2$, $2$, $2$: $1$ arrangement
The total is $126$, so the error seems to be in your application of the inclusion–exclusion principle.