Distributing n balls into k boxes so that every box has an even number of balls

combinationscombinatoricsdiscrete mathematicsmodular arithmetic

How many ways can you distribute n balls into k boxes so that every box has an even number of balls?

Well, so far I think than n must be an even number. And I know that it basically starts with a simple equation:

$$x_1 + x_2 + x_3 + \cdots + x_k = n$$
where
$$x_i\equiv 0\pmod 2$$
Normally I would use a combination with repetition but since there has to be an even number of balls in every box I don't know what to do.

Best Answer

Of course $n$ must be even. Then distribute $\frac{n}{2}$ balls over $k$ boxes (no conditions) and double the amounts in all boxes. This gives all such even distibutions and so the problem is equivalent to the $\frac{n}{2}$ over $k$ boxes problem for even $n$. For $n$ odd there are no solutions.