In this article, we are going to learn how to calculate the number of ways in which x balls can be distributed in n boxes. This is one confusing topic which is hardly understood by students. But once mastered, it is the easiest topic of Permutation and Combination.
There can be 4 cases pertaining to this problem.
Case 1: Balls are same; boxes are same
Case 2: Balls are same; boxes are different
Case 3: Balls are different; boxes are same
Case 4: Balls are different; boxes are different
To understand it better, let's take an example.
Example: What is the number of ways in which you can distribute 5 balls in 3 boxes when:
- Balls are same; boxes are same
- Balls are same; boxes are different
- Balls are different; boxes are same
- Balls are different; boxes are different
Solution:
Group |
Permutation of balls (Number of ways of grouping) |
Ways of Distribution of boxes |
Total number |
0,0,5 |
1 |
1 |
1*1=1 |
0,1,4 |
1 |
1 |
1*1=1 |
0,2,3 |
1 |
1 |
1*1=1 |
1,1,3 |
1 |
1 |
1*1=1 |
1,2,2 |
1 |
1 |
1*1=1 |
Hence, total number of ways = 1+1+1+1+1=5.
- When Balls are same; boxes are same
Group |
Permutation of balls(Number of ways of grouping) |
Ways of Distribution of boxes |
Total number |
0,0,5 |
1 |
3!/2!=3 |
1*3=3 |
0,1,4 |
1 |
3!=6 |
1*6=6 |
0,2,3 |
1 |
3!=6 |
1*6=6 |
1,1,3 |
1 |
3!/2!=3 |
1*3=3 |
1,2,2 |
1 |
3!/2!=3 |
1*3=3 |
Hence, total number of ways = 3+6+6+3+3=21.
- Balls are same; boxes are different
Group |
Permutation of balls(Number of ways of grouping) |
Ways of Distribution of boxes |
Total number |
0,0,5 |
1 |
1 |
1*1 |
0,1,4 |
5C1*4C4=5 |
1 |
5*1=5 |
0,2,3 |
5C2* 3C3=10 |
1 |
10*1=10 |
1,1,3 |
5C3* (2!/2)=10 |
1 |
10*1=10 |
1,2,2 |
5C1 *(4!/(2!*2!*2)=15 |
1 |
15*1=15 |
Hence, total number of ways = 1+5+10+10+15=41
- Balls are different; boxes are same
Group |
Permutation of balls(Number of ways of grouping) |
Ways of Distribution of boxes |
Total number |
0,0,5 |
1 |
3!/2!=3 |
1*3=3 |
0,1,4 |
5C1 = 5 |
3!=6 |
5*6=30 |
0,2,3 |
5C2 = 10 |
3!=6 |
10*6=60 |
1,1,3 |
5C3* (2C1/2) = 10 |
3!=6 |
10*6=60 |
1,2,2 |
5C1 *(4!/2!*2!*2)=15 |
3!=6 |
15*6=90 |
Hence, total number of ways = 3+30+60+60+90= 243.
- Balls are different; boxes are different
Feel free to share your doubts from Permutations and Combinations in the comments section below.