Combinatorics
This is the branch of mathematics that deals with permutations and combinations. In this page, I only try to build mental models such that the concepts are easier to remember.
- position - Assigning items to different positions.
- choices - Which items are available for assigning items.
Permutationsā
Permutation is an arrangement of objects where the order does matter. Every order is a different permutation.
The word mutation is permutation is enough to build a strong mental model. Here, this means the order of things matter. Any change of order will mutate the arrangement.
The formula of permutation also reflects the same. If there are N available choices and we need to build permutations of size K. In this case, for first position, we've N options, for second position we've N-1 and then N-2, until 1.
So the number of permutations possible is, until K positions are filled. The formula exactly does this. Takes the full factorial of the available choices and removes all unused positions by dividing it. It means, when the problem statement only asks for K permutations(positions) from N available choices, the remaining N-K positions are simply removed from the result.
Even though permutation always speaks about order of items and also formula doesn't allow repeating items, this isn't always true.
Permutations with repetitions is an important use case. For example, when we've a 3 digit number lock, the numbers can be repeated. This means, the above formula isn't valid for finding the number of permutations possible. So every position has all options to chose from. This means, if you have 10 choices to fill in 3 positions then we've permutations.
Combinationsā
Combination is a selection of objects where the order doesn't matter. Every order is the same combination.
The word combination is used so much in day-to-day life that it's easy to remember based on examples.
- Color combination - we just say the same colors in any order make the same combination.
- Food combination - again, the same food items in any order make the same combination.
- Clothing combination - same clothes in any order make the same combination.
Combination formula is same as permutation one but additionally it removes the possible duplicates since order doesn't matter here.
We group all permutations into groups, where each group corresponds to one unique combination of the items.
Division is nothing but grouping. This is exactly what happens here.
Subsetsā
Another important topic that sounds similar to this is the subset. This confuses since the concepts are very similar. Subsets are similar to combination but only difference is the size. A subset can have no elements to all elements.
For a given set of elements with size N, the possible subsets is always .
This is also called a power set since it contains the original set as well as an empty set.
Let the set be
1. Subsets (all sizes):
2. Combinations (size 2):
3. Permutations (size 2):