### (and why your locker combination is actually a permutation)

Welcome to the third installment of my Cheat Sheet for Stats. Be sure to check out Part 1 and Part 2.

*Permutations* and *combinations* are useful to someone interested in determining the total number of items from a set or group. This is especially helpful in probability when calculating a denominator and/or numerator.

The difference between a permutation and a combination is simple to understand – if you pay close attention to how the items/objects/people are chosen (and ignore semantics). In this post I’ll give you definitions, formulas, and examples of both permutations and combinations. But first, I’ll discuss the *Fundamental Counting Principle* and *factorials*.

## The Fundamental Counting Principle

Also known as the multiplication counting rule, this principle says to multiply all possible events together to find the total number of outcomes.

A simple example starts with packing for a vacation. Say you pack 4 shirts, 3 pairs of pants, and 2 pairs of shoes. How many possible outfits can you make? (Assume they all match, or you are 5 years old and don’t give a flip.)

The fundamental counting principle says you now have:

**4 * 3 * 2 = 24 possible outfits**

Here’s another example. Let’s say your company requires a 5-value verification code consisting of 3 numerical values and 2 alphabetic values (**in that order **and case sensitive). How many possible verification codes can be produced?

Sometimes it helps to see what is going on:

And visualize the values in each position:

There are 10 total digits to consider (0 – 9) and 26 letters in the alphabet – 52 if case-sensitive. The trick is to multiply to find the total possible outcomes:

**= 2,704,000 different verification codes**

And what if the requirement changed to 3 numbers and 2 letters (same order), but no repeats? We’d have to take away the number of options for each digit/letter as they are used:

**= 1,909,440 different verification codes**

There is a little more math involved if you can put these values in any order and I won’t cover that in this post.

## Factorials

At first glance, a factorial looks like a very excited number. For instance, 5! might appear to be yelling, “FIVE!” (Silly teacher joke – works better in person.) The exclamation point is actually an operator telling us to multiply that number by all integers less than that number down to 1.

## Permutations

Permutations apply the Fundamental Counting Principle to determine the number of ways you can arrange members of a group. The permutation formula calculates the number of arrangements of *n* objects taken* r* at a time:

For example, let’s say you and 29 other people are in the running for 3 distinct prizes. Your names are in a hat and prizes are only given to the first, second, and third names drawn (the best prize being first). The number of ways 30 people can take first, second, and third prize is called a **permutation**. In a permutation, the order in which the items or people are arranged “matters”. (And by *matters*, you could say the order is *noted*, or *apparent.*)

For the prize example, you can calculate this using the formula for permutations:

And this goes back to the fundamental counting principle since a portion of the numerator cancels with the denominator:

Simplifying the expression to **30*29*28 = 24,360** ways 3 individuals can be awarded first, second, and third prize from a group of 30 in a random drawing. If we were merely drawing 3 names all at once with no difference in prizes, it would NOT be considered a permutation.

Luckily you really don’t need to know the formula to calculate a permutation. The Excel function for permutations is **PERMUT**:

Note: There is another Excel function for permutations with repetitions – that one is **PERMUTATIONA**. For this example, you would use that if we drew names for the three prizes and each time the name was returned to the hat, making it possible for the same person to win all 3 times.

## Combinations

Now suppose you and 29 other individuals are in the running for 3 prizes, all with the same value. Your names are in a hat and all three names are drawn at once. Because no order or arrangement is involved, this type of counting technique is called a **combination**. The combination formula **also** calculates *n *objects taken *r* at a time:

For the newest version of our prize example, we are taking 3 names from the hat at one time and there is no difference between prizes. Here is that calculation:

Once the 27! in the numerator and denominator cancel, we are left with the 24,360 in the numerator, but still divide by 3! (which is 3*2 = 6):

Which results in only **4060 possible combinations**.

The Excel function for combinations is **COMBIN**:

## A Locker Combination is Actually a Permutation

Now consider locker combinations. Let’s assume a typical dial lock (Right, left, right) in which there are 39 numbers on the dial and your code has 3 numbers. Does order matter? Absolutely! If you try to open the lock using your 3 number code but in a different order, the locker will not open. So how many possible codes does this locker have?

If numbers couldn’t repeat, we’d have **P(39,3) = 54,834** different codes (or what we call “combinations”). But if numbers could repeat, there are **39*39*39 = 59,319** possible codes – to include repeatable values, apply the **PERMUTATIONA** function in Excel.

## You Try!

Based on what you just learned, can you spot the difference between a combination and permutation? Bonus points if you can calculate the result. (Answers at the end of the post.)

- A board of directors consists of 13 people. In how many ways can a chief executive officer, a director, and a treasurer be selected?
- How many ways can a jury of 12 people be selected from a group of 40 people?
- A GM from a restaurant chain must select 8 restaurants from 14 for a promotional program. How many different ways can this selection be done?
- At Waffle House hash browns can be ordered 18 different ways. How possible orders can be made by choosing only 3 of the 18?
- A locker can have a 4-digit code. How many different codes can we have if there are 25 different numbers and numbers cannot repeat in any given code?

## Answers:

- Permutation. P(13,3) = 1716
- Combination. C(40,12) = 5,586,853,480 order isn’t important here
- Combination. C(14,8) = 3003
- Combination. C(18,3) = 816
- Permutation. P(25,4) = 303,600 (Repeating numbers within a code would give 390,625 different codes.)