General formula for the number of ways different types of balls can be distributed in a box of limited size

18 Views Asked by At

Imagine you have a box in which you can store only 3 balls. and you have m different colored balls. How can I devise a general formula for counting the number of ways the balls can be stored in the box.(you should always fill up the box). For example if we have two types of balls black and white we would have these options: 1) black black black 2) black white white 3) white white white 4) white black black as you can see we don't take into consideration the order of the balls and also you can have more than one ball from each type. The objective is to count all possible combinations of different colors. What would be the general formula for m balls of different color and the box which can store exactly 3 balls