Permutation and Combination

Most of us are already introduced to permutation and combination in high school math classes. I understand clearly what they separately define. But I get confused easily between their equations because they never made sense to me. This post is my attempt to make sense of the following equations.
\(\begin{align*} P_{n,r} &= \frac{n!}{(n-r)!} \\ C_{n,r} &= \frac{n!}{(n-r)!\ r!} \end{align*}\)

Permutation

I will attempt to figure out the number of ways to select 2 characters out of 3. The characters are {ABC}, \(n=3, r=2\). How many ways can I select 2 out of 3 characters? The answer is given by the permutation equation. Let me break it down to options. During the first selection, I have 3 options {ABC}, which will leave me 2 options for the second and for the final selection only 1 option will be left. As I get 3 options for the first, and for each of those first options, I get 2 sub-options, I have a total of \(3 \times 2 = 6\) options. However, it is not close to the \(P_{n,r}\) equation, but we will reach there. Now let me select 3 out of 3. We can assume the pattern will hold, \(3 \times 2 \times 1 = 6\) options again. Similarly, 3 options to select 1 out of 3. Notice that, we are only multiplying \(r\) numbers (even though we don’t know what those numbers are) for selecting \(r\) out of \(n\). This is where the equation makes sense. \(n!\) gives us all the ways to select \(n\) out of \(n\).

\(x!\) is read as ‘x factorials’. A factorial of a number is defined as \(x! = x \times (x-1) \times (x-2) \times ... \times 1\). Here is an example, \(5! = 5 \times 4 \times 3 \times 2 \times 1 = 120\)

Let’s make the example set {ABCDE}. For selecting 5 out of 5, I will have \(5! = 5 \times 4 \times 3 \times 2 \times 1\) options. To select 3 out of those 5, \(5 \times 4 \times 3\) options are available, which do not have \(2 \times 1\) in it, meaning \(5!\) is getting divided by \(2 \times 1 = 2! = (5-3)!\) . There is a simple explanation for this division. Look at the numerator, we are selecting 5 characters when we only wanted 3. And, I have seen in earlier examples with {ABC} that for each first options there are 2 more sub-options. In the numerator, while selecting each 3rd character, instead of stopping, it also has \(2!\) more sub-options and selecting them. Consider an iteration for example, while selecting 3 out of 5 in {ABCDE}, one of the iteration of \(5!\) will select B, select D, select C and then continue on to select E and A. And another iteration will select B, select D, select C and then select A and E. Those sub-options {AE,EA} are extra and I don’t want them in my counting. As those two characters were selected in \(2!\) ways, to remove them, put the same in denominator.

Combnination

Permutation gave us ways to select \(r\) out of \(n\) characters. \(P_{3,3}\) of {ABC} is {ABC, ACB, CAB, BAC, BCA, CBA}. Note that, these are samne characters only in different order. So, order matters in permutation, unlike combination. \(C_\{3,3\}\) of {ABC} is 1, only {ABC}. How does combination achieve this? From, the equation we see that it first calculates \(P_{n,r}\) and then divides by \(r!\) . In previous section, we learned that to remove some subset of permutation, we divide. The only thing to understand here is which permutations are we removing? For \(C_{3,3}\) , we see that result 1 comes from \(\frac{3!}{3!\ 0!} = \frac{6}{6}\) . It is evident by the same numerator and denominator that what is essentially happening here is, \(\frac{\{ABC, ACB, CAB, BAC, BCA, CBA\}}{\{ABC, ACB, CAB, BAC, BCA, CBA\}}\) . It seems the denominator is duplicates of the parent characters {ABC} (remember, order does not matter here, ABC, BCA is same thing in combination). And how many ways can 2 characters be duplicate, for example, {AB}? That will be \(2!\) ways, {AB,BA}. That is why for \(C_{3,2}\) , \(P_{3,2}\) is divided by \(2!\) . We first get all the ways to select 2 characters out of 3 (which is \(P_{3,2}\) ), and then divide by how many ways 2 characters can be duplicated.




Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • Multimodal LLMs on top of LLaMA 3
  • Paper Notes / Contrastive Predicting Coding
  • আমার ইরাস্মুসে আবেদন
  • Creating emails using EmailMessage in Python 3.8
  • ভেক্টর