Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Factorial, Permutation, Combination

Factorial

The factorial, n!n!, can be understood as “you have nn objects to arrange — how many ways to do it?”

A concrete example here:

We have A, B, C three objects arranged in order has 6 possible orderings,

  1. ABC

  2. ACB

  3. BAC

  4. BCA

  5. CAB

  6. CBA

Another equivalent way to see it is: “place three objects into three slots”:

That is 3×2×13 \times 2 \times 1, which is exactly what 3!3! means.

Thus, for any positive integer nn, we have

n!=n×(n−1)×(n−2)×⋯×2×1n! = n \times (n-1) \times (n-2) \times \dots \times 2 \times 1

Three notes need your attention.

First, the factorial is often written in recursive form

n!=n×(n−1)!0!=1n! = n \times (n-1)! \\ 0! = 1

Second, 0!=10! = 1 in the definition.

It’s quite intuitive: if n!n! counts how many ways to arrange nn objects, then 0!0! asks how many ways to arrange 0 objects. The answer is exactly 1 — [the empty arrangement], right?

Third, the factorial is generally defined for non-negative integers. However, if you want to extend and talk about arbitrary real numbers, you have to extend the definition via analytic continuation to get the Gamma function (which it’s out of the scope of this article here).

Permutation

A permutation, nPr{}^nP_r, answers: “pick rr objects from nn and arrange them in order — how many arrangements?”

Continuing with our concrete example: picking 1 from {A, B, C} to arrange gives 3 arrangements,

  1. A

  2. B

  3. C

And picking 2 to arrange gives 6 arrangements,

  1. AB

  2. AC

  3. BA

  4. BC

  5. CA

  6. CB

If you’ve internalized the slot perspective, this is easy to explain — think of it as “placing three objects into one/two slots”:

For one slot: the first slot can take any of the three objects, which is naturally 3, i.e. 3P1{}^3P_1.

For two slots: the first slot takes any of three; the second slot has only two left, giving 3×23 \times 2, i.e. 3P2{}^3P_2.

The permutation formula is

nPr=n!(n−r)!{}^nP_r = \frac{n!}{(n-r)!}

But what does this actually mean?

Translated into plain language, this formula says: “Arrange all nn objects, but we don’t care about the ordering of the (n−r)(n-r) objects we didn’t pick” — we don’t care, so we divide them out.

That’s a rather satisfying way to think about it.

Returning to the slot view:

When we place three objects but only fill one slot, we start by caring about how all three are ordered. But once the first slot is decided, we no longer care how the remaining two are ordered, hence

3P1=3!2!=3×2×12×1=3{}^3P_1 = \frac{3!}{2!} = \frac{3 \times 2 \times 1}{2 \times 1} = 3

Similarly, when we place three objects into two slots, we start by caring about the ordering of all three. Once the first two are decided, we don’t care how the last one is ordered, hence

3P2=3!1!=3×2×11=3×2=6{}^3P_2 = \frac{3!}{1!} = \frac{3 \times 2 \times 1}{1} = 3 \times 2 = 6

Combination

Finally, let’s look at the combination, nCr{}^nC_r.

If you’ve understood the two sections above, we can jump straight into what the combination formula is saying:

nCr=n!(n−r)! r!=nPrr!{}^nC_r = \frac{n!}{(n-r)!\, r!} = \frac{{}^nP_r}{r!}

So the combination says:

“Arrange all nn objects, but we don’t care about the ordering of the (n−r)(n-r) objects we left out, and we also don’t care about the ordering of the rr objects we picked.”

In other words, once the objects are in the slots, we don’t even care how they’re arranged within the slots. That is so-called a combination!

Hence, the more common way to introduce it is: a combination means “choosing”. (However, directly defining combination in this way may lose the connection with the expression of the formula)

So from {A, B, C}, choosing 2 gives 3 possible selections:

  1. AB

  2. AC

  3. BC

3C2=3P22!=3!(3−2)! 2!=3×2×11×2×1=3{}^3C_2 = \frac{{}^3P_2}{2!} = \frac{3!}{(3-2)!\,2!} = \frac{3 \times 2 \times 1}{1 \times 2 \times 1} = 3

Finally, the combination formula is often written as

nCr=n!(n−r)! r!=n×(n−1)×⋯×(n−r+1)r!{}^nC_r = \frac{n!}{(n-r)!\, r!} = \frac{n \times (n-1) \times \dots \times (n-r+1)}{r!}