How many variants exist for putting $11$ different pencils into $4$ boxes as for in every box there are at least $2$ pencils. How many variants exist for putting $11$ different pencils into $4$ boxes as for in every box there are at least $2$ pencils.
I've done this in two ways first is I've counted all possible variants of pencils in boxes like for every pencil there are for variants
So in the case if there isn't limitation about minimum number of pencils in the box the answer should be $4^{11}$ and if we remove the number of possible keys which are not allowed, the answer will be $4^{11}-64$
But then I decided to look at this problem from the other corner and saw that possible numbers of pencils in the boxes are
$5,2,2,2$
$4,3,2,2$
$3,3,3,2$
and if we count all the possible keys we will get $1644720$
As the answers are different, I don't know whether the solutions are correct.
So I would like you to help me.
Thank you!
 A: For another approach lets use exponential generating fuctions.
It is said that each boxes must contain at least $2$ elements , so the exponential function for each boxes are $$\frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \frac{x^5}{5!} $$
because if each boxes will have at least $2$ elements , then a boxes has maximum $5$ elements
Then , we should multiply them such that $$\bigg(\frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \frac{x^5}{5!}\bigg)^4  $$
We should look at the coefficient of $[\frac{x^{11}}{11!}]$ or find the coefficient of $[x^{11}]$ and multiply it by $11!$ in the expansion of exponential generating functions such that https://www.wolframalpha.com/input/?i=expanded+form+of+%28x%5E2+%2F+2++%2B+x%5E3+%2F6++%2B++x%5E4+%2F24+%2B+x%5E5+%2F+120+%29%5E4
We saw that the coefficient of $[x^{11}]$ is $\frac{37}{1080}$ ,then $$\frac{37}{1080} \times 11! = 1,367,520$$
A: My answer is based on the assumption that boxes are different. You can divide by $4!$ if the boxes are indistinguishable.
While your both answers are incorrect, the second approach is correct. You may have some calculation errors. The first answer cannot possibly be correct as you are only removing $64$ from $4^{11}$.
In the first approach, we need to remove arrangements where -

*

*one box is empty

*two boxes are empty

*three boxes are empty

*one box has $1$ pencil while others have $2$ or more

*two boxes have $1$ pencil each while other two have $2$ or more

*three boxes have $1$ pencil each while the last one has rest of the pencils.

Take the first case which has one box empty. There are $4$ ways to choose a box and then using Stirling Number of the second kind, there are $3! \cdot  S2[11,3]$ ways to place $11$ pencils in rest $3$ boxes such that none of them are empty. That itself gives us $684024$ arrangements to remove from $4^{11}$.
Coming to the answer using the second approach,
i) Arrangements for $(2, 2, 2, 5)$ -
$ \displaystyle 4 \cdot {11 \choose 5} \cdot \frac{6!}{2^3} = 166320$
ii) Arrangements for $(2, 2, 3, 4)$ -
$\displaystyle {4 \choose 2} \cdot 2 \cdot {11 \choose 4} \cdot {7 \choose 3} \cdot \dfrac{4!}{2^2} = 831600$
iii) Arrangements for $(2, 3, 3, 3)$ -
$ \displaystyle 4 \cdot {11 \choose 2} \cdot \dfrac{9!}{(3!)^3} = 369300$
That is total of $1367520$ arrangements.
