Permutation and Combination: Distribution of Balls into Boxes

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.
Suggested Action
FREE Live Master Classes by our Star Faculty with 20+ years of experience. Register Now
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:
if (!function_exists('curPageURLAds')) { function curPageURLAds() {$pageURL = 'http';if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://";if ($_SERVER["SERVER_PORT"] != "80") {$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];} else { $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];} return $pageURL;} } $pageURL = curPageURLAds(); $TOP_AD = array("https://www.hitbullseye.com/Quant/Arithmetic-Geometric-Harmonic-Progressions.php", "https://www.hitbullseye.com/Vocab/One-Word-Substitute-List.php", "https://www.hitbullseye.com/Coding-and-Decoding-Questions.php", "https://www.hitbullseye.com/daily-vocabulary-words.php", "https://www.hitbullseye.com/Probability-Examples.php", "https://www.hitbullseye.com/Problems-on-Ages.php", "https://www.hitbullseye.com/Difficult-Syllogism-Questions.php", "https://www.hitbullseye.com/Vocab/List-of-Synonyms.php", "https://www.hitbullseye.com/puzzle/logical-puzzle-questions-with-answers.php", "https://www.hitbullseye.com/Time-and-Work-Questions.php", "https://www.hitbullseye.com/Speed-Distance-Time-Questions.php", "https://www.hitbullseye.com/Simplification-Examples.php", "https://www.hitbullseye.com/Subject-Verb-Agreement-Exercise.php", "https://www.hitbullseye.com/Reading-Comprehension-Practice.php", "https://www.hitbullseye.com/Seating-Arrangement-Questions.php", "https://www.hitbullseye.com/HCF-and-LCM-Questions.php", "https://www.hitbullseye.com/Blood-Relation-Questions-with-Answers.php", "https://www.hitbullseye.com/Reasoning/Painted-Cube-Problem-Formula.php", "https://www.hitbullseye.com/Coding-Decoding-Questions.php", "https://www.hitbullseye.com/Percentage-Practice-Questions.php", "https://www.hitbullseye.com/Alphabetical-Series-Reasoning-Questions.php", "https://www.hitbullseye.com/Profit-Loss.php", "https://www.hitbullseye.com/Adjectives-Exercises.php", "https://www.hitbullseye.com/Odd-One-Out-Questions-with-Answers.php", "https://www.hitbullseye.com/Reasoning-Questions-Seating-Arrangement.php", "https://www.hitbullseye.com/Number-Series-Questions.php", "https://www.hitbullseye.com/Profit-and-loss-Problems.php", "https://www.hitbullseye.com/Time-and-Work-Problems.php", "https://www.hitbullseye.com/Quant/Compound-Interest-Problems.php", ); if (in_array($pageURL, $TOP_AD)) { // { // echo "
// // // //
"; // } // else { // echo "
// // // //
"; // } }
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
Suggested Action:
Kick start Your Preparations with FREE access to 25+ Mocks, 75+ Videos & 100+ Chapterwise Tests.Sign Up Now
Feel free to share your doubts from Permutations and Combinations in the comments section below.
Views:23006