The idea: does the order of the pick matter?

Pick 3 of the 5 letters A, B, C, D, E. If the three picks fill different places (gold, silver, bronze; the digits of a code), then ABC and BAC are different answers: these are permutations. If only the group matters (a committee, a hand of cards, pizza toppings), ABC and BAC are the same answer, the set {A, B, C}: these are combinations. The canvas lists both for the same letters, one first letter per step, then slides the 60 permutations into 10 blocks, one above each combination.

Left: three places filled one after the other with 5, 4 and 3 choices, 5 times 4 times 3 is 60 ordered picks. Right: the 6 orders ABC, ACB, BAC, BCA, CAB, CBA all become the one set A B C, so 60 divided by 6 is 10 sets
Ordered picks multiply the choices for each place (5 × 4 × 3 = 60); every set of 3 is counted 3! = 6 times among them, so there are 60 ÷ 6 = 10 sets.

Permutations: multiply the choices

The first place can take any of the 5 letters, the second any of the 4 left, the third any of the 3 left: 5 × 4 × 3 = 60. In general, the number of ordered picks of k from n without repeats is

P(n, k) = n · (n − 1) ··· (n − k + 1) = n! / (n − k)!

On the canvas each row of the top lane is one first letter: 12 arrangements start with A, 12 with B, and so on, because the other two places can be filled in 4 × 3 = 12 ways. Picking all n letters gives n! orders (Demo: all 3 of 3: 6 orders, 1 set).

Combinations: divide by k!

Write each set once, with its letters in increasing order: ABC, ABD, …, CDE. That is the bottom lane. It finishes before the top lane: no set of 3 can start with D, because two letters after D are needed and only E is left. Every set of k letters can be put in order in k! ways, so the top lane is the bottom lane with each set repeated k! times:

C(n, k) = P(n, k) / k! = n! / (k! (n − k)!)

That is the grouping step: sorting the letters of ACB, BAC, BCA, CAB and CBA gives ABC, so all six land in the block above {A, B, C} (Demo: 3 of 5: 60 ÷ 6 = 10; Demo: pairs of 4: 12 ÷ 2 = 6). C(n, k) is the binomial coefficient, also read "n choose k". See Permutations / Combinations / Subsets (Backtracking) for the recursion that generates both lists.

With repetition the division fails

If a letter may be picked again (a PIN, a scoop of ice cream of the same flavour twice), there are 5 choices for every place: 5³ = 125 ordered picks. The sets are now multisets such as AAB. But the blocks are no longer the same size: ABC still has 6 orders, AAB has only 3 (AAB, ABA, BAA), because swapping the two A's changes nothing, and AAA has just 1. So 125 ÷ 3! = 20.8 is not a count (Demo: repeats allowed). The canvas shows 10 blocks of 6, 20 blocks of 3 and 5 blocks of 1: 60 + 60 + 5 = 125. The number of multisets comes from "stars and bars": choosing k items from n kinds with repeats is the same as placing n − 1 bars among k stars, so

C(n + k − 1, k) = C(7, 3) = 35

Three blocks: the set A B C has 6 orders, the multiset A A B has 3 orders AAB ABA BAA, the multiset A A A has 1 order. With repeats the blocks have different sizes, so dividing 125 by 6 gives 20.8, a wrong count; the true number is 35
With repeats a block's size is k! divided by the ways to swap equal letters: 6, 3 or 1. Dividing by 3! only works when every block has 6.

Pascal's rule

Split the 10 sets by whether they contain E. Sets with E need 2 more letters from A–D: C(4, 2) = 6. Sets without E take all 3 from A–D: C(4, 3) = 4. So C(5, 3) = C(4, 2) + C(4, 3) = 10 (Demo: Pascal's rule, orange = contains E). This is exactly the rule that builds Pascal's triangle: each number is the sum of the two above it, and row 5 reads 1, 5, 10, 10, 5, 1.

Which one to use

QuestionOrder matters?Repeats?Count
Gold, silver, bronze among 8 runnersyesnoP(8, 3) = 336
A 4-digit PINyesyes10⁴ = 10,000
A 3-person committee from 8nonoC(8, 3) = 56
3 scoops from 5 flavoursnoyesC(7, 3) = 35
Lottery: 6 numbers of 49nonoC(49, 6) = 13,983,816

A quick test: swap two of the picks. If the answer changes, count permutations; if it is the same answer, count combinations.

Common mistakes

  • Dividing by k! when repeats are allowed. It only works when every group has the same size.
  • Calling a combination lock a combination. Its code 4-1-7 is ordered, and digits can repeat: it counts 10³ permutations with repetition.
  • Mixing up P(n, k) and n^k. The first forbids repeats (5 × 4 × 3), the second allows them (5 × 5 × 5).

See also Catalan Numbers, another count built from C(2n, n).

What the page leaves out

The canvas stops at 5 letters and picks of 3, so every arrangement fits on screen. It leaves out arrangements of a word with repeated letters (MISSISSIPPI: 11! / (4! 4! 2!)), circular arrangements (divide by n), derangements, the multinomial coefficients, Stirling numbers for splitting a set into groups, generating functions, and how large these numbers get (C(100, 50) has 30 digits).