Combinations are sets of objects that are unordered. Permutations were concerned with order. In a permutation the values 1234, 2341, 3412 and 4321 are treated as different. However, in Combinations, they are treated as 1 result.

If you’re curious about the Latex Markdown to create the equation above, it is simply:

$${n}C{r} = \frac{n!}{r! (n-r)!}$$

The above syntax is presented by the Pierian Data team via their Udemy Course. However, other statistical sites represent the Combination formula as:

Differences between Permutations

A permutation problem would be like a password or a license plate… which would be considered unique values even if the same characters are reused in different order. In other words “0AB2” is different than “A2B0.” In these cases of unique order of characters giving unique values – permutations are used.

However, if we were working with a question like, “if football has 11 players per team and we have 22 players to choose from, how many combinations are available?”

In the above question, we don’t care about order… whether “person 1, person 2 and person 7” are picked for Team 1, vs “person 2, person 7 and person 1” … well to us those two outcomes are the same (they are the same people.) Basically we want to know how many combinations are available if we create a team of 11 people (subset) of a group (population) of 22 people.

In this case the answer is calculated like so:

factorial(22) / (factorial(11) * factorial(22-11))

>>> 705432.0

from scipy.speacial import comb
comb(22,11)

>>> 705432.0

With Repetition

There are only unique people, so we can’t add “Tim” twice to the team of 11 players (if there’s only one Tim.) What if we’re talking about ice-cream toppings? Let’s say we have 8 ice cream toppings available, but we can only pick 3 from the 8. How many combinations would there be?

from scipy.special import comb
comb(8,3, repetition=True)

>> 120.0

# Compare the above if we didn't count repetition:
comb(8,3)

>> 56.0

To be clear, repetition means we can reuse the same item over and over again… Think of this as a subset of the item from a greater population, and you can keep picking said subset item over and over… like having these ice cream toppings available:

  • Sprinkles
  • Chocolate
  • Strawberry Sauce
  • Whipped Cream
  • Banana
  • Skittles
  • M&M’s
  • Sardines

Choice #1 could be: Sprinkles, Banana, Banana (double banana)

Choice #2 could be: Banana, Sardines, Whipped Cream (Unique items)

Choice #3 could be: Sardines, Sardines, Sardines (triple sardines)

This is different from non-repetitive (such as with teams) which would be like:

  • Team #1: Jack, Bill, Susan
  • Team #2: Greg, Bill, Jason
  • Team #3: Sarah, Susan, Mark

These are individual people and can not be counted twice (assuming one unique person per name.)

Compare with Permutations

If we really cared about order (such as item 1, item 2 and item 3 are different than item 3, item 2 and item 1) then the formula could be calculated in scipy as follows:

from scipy.special import perm
perm(22,11)

>>> 28158588057600.0

The above permutation calculation makes no sense when we’re talking about people on a team… it doesn’t matter if Bill and Ted or Ted and Bill are picked. It’s all the same. But it goes to explain the difference in the calculation.

Leave a Reply

Your email address will not be published. Required fields are marked *