This site is a work in progress. New lessons are added regularly. Contact us

Counting Principles, Permutations, and Combinations

Learning goals

  • Multiply the stage counts when each is independent of the past
  • Add case counts that overlap nowhere and miss nothing
  • Ask whether order matters and whether repeats are allowed
  • Compute P(n,k)P(n,k) as a product of exactly kk factors
  • Divide by k!k! to forget the order, giving (nk)\dbinom{n}{k}
  • Count the unwanted and subtract, for at least one

The multiplication principle

Start with the rule you already trust and state it precisely enough to prove, because the precision is what lets you use it in cases where a careless version fails.

The multiplication principle. Suppose each object you want to count is built by a sequence of kk decisions. Suppose decision ii can be made in nin_i ways no matter how the earlier decisions came out. Suppose finally that different sequences of decisions build different objects, and that every object is built by exactly one sequence. Then the number of objects is

n1×n2××nk.n_1 \times n_2 \times \cdots \times n_k.

Why a sequence of independent decisions multiplies#

Add the stages one at a time. With a single decision the count is n1n_1, which is the claim for k=1k = 1.

Now suppose the first k1k-1 decisions produce exactly N=n1n2nk1N = n_1 n_2 \cdots n_{k-1} different partial objects, and bring in the last decision. Each of those NN partial objects can be finished in exactly nkn_k ways, since that is the hypothesis. The hypothesis says the number of options at the last stage does not depend on what came before it.

Those completions are all different, and for two separate reasons. Two completions of the same partial object differ in the final decision, so they are different. Two completions of different partial objects already differed before the final decision was made, so they are different too. And nothing is missed: any finished object comes from exactly one partial object, namely its own first k1k-1 decisions, followed by one last decision.

So the finished objects fall into NN groups of nkn_k, one group per partial object, and the total is N×nk=n1n2nkN \times n_k = n_1 n_2 \cdots n_k. Since each new stage multiplies the running total by its own option count, the product formula holds for every kk.

Read the hypothesis carefully, because the whole lesson leans on it. It says the number of options at each stage must not depend on the earlier choices. It does not say the options themselves must stay the same. When you seat people in chairs, which people remain for the second chair depends entirely on who took the first. But how many remain does not change with who took the first: it is always one fewer. That distinction is exactly what makes permutations legal, and it is why “the choices are independent” is a sloppy way to state the rule.

One companion rule handles the problems that break into cases. If the objects you want split into groups that overlap nowhere and leave nothing out, then the total is the sum of the group counts. That is the addition principle, and in practice the two rules divide the work like this. A sequence of decisions multiplies (“this and then that”), while a split into separate cases adds (“either this kind or that kind”).

The simplest use of the multiplication principle is the one where nothing changes between stages. Suppose you fill kk slots, and each slot independently takes any of nn values, with repetition allowed. Then every stage offers the same nn options, and the product collapses to a power:

n×n××nk slots=nk.\underbrace{n \times n \times \cdots \times n}_{k \text{ slots}} = n^k.

A four-digit PIN has 104=10,00010^4 = 10{,}000 settings, and a string of kk letters drawn from a 2626-letter alphabet has 26k26^k possibilities. In both cases a digit or a letter can be reused as often as you like.

Permutations, or filling slots without repetition

Now forbid repetition. An arrangement, or permutation, of kk objects chosen from nn distinct objects is a way of filling kk ordered slots using each object at most once. Write P(n,k)P(n, k) for how many there are.

Fill the slots left to right. The first slot accepts any of the nn objects. Whatever you put there is gone, so the second slot accepts any of the remaining n1n - 1. The third accepts n2n - 2, and so on. The counts shrink by one at every step, and the multiplication principle applies because the number remaining is the same no matter which particular objects were used up. By the time you reach the kk-th slot you have already placed k1k - 1 objects, so it accepts n(k1)=nk+1n - (k-1) = n - k + 1 of them:

P(n,k)=n(n1)(n2)(nk+1).P(n, k) = n(n-1)(n-2)\cdots(n-k+1).
The shrinking slot count for a permutationOrdered slots holding n, n minus 1, n minus 2, down to n minus k plus 1 choices, multiplied together to give P(n, k) with exactly k factors.slot 1slot 2slot 3slot knn - 1n - 2n - k + 1××××each object placed is used up, so every slot has one choice fewerk factors in all, ending at n - k + 1
Filling k ordered slots from n distinct objects. Each object placed is used up, so the counts drop by one. There are exactly k factors, and the last is n - k + 1 because k - 1 objects are already gone by the time the final slot is filled.

Count the factors, since this is where the formula is usually mangled. There is one factor per slot, so there are kk of them, and they run n,n1,n, n-1, \ldots down to nk+1n-k+1. For P(9,4)P(9, 4) that is four factors, 9×8×7×69 \times 8 \times 7 \times 6, stopping at 94+1=69 - 4 + 1 = 6 and not at 55.

What the factorial counts. Set k=nk = n and you are arranging all nn objects, using every one of them:

P(n,n)=n(n1)(n2)1=n!.P(n, n) = n(n-1)(n-2)\cdots 1 = n!.

You met n!n! in the binomial theorem lesson as a piece of notation. This is what it counts: the number of ways to put nn distinct objects in a row. Five books have 5!=1205! = 120 orders, and ten books have 10!=3,628,80010! = 3{,}628{,}800 of them.

The closed form. The product n(n1)(nk+1)n(n-1)\cdots(n-k+1) is the top of a factorial with its tail chopped off, so put the tail back by multiplying and dividing by (nk)!(n-k)!:

P(n,k)=n(n1)(nk+1)×(nk)(nk1)1(nk)(nk1)1=n!(nk)!.P(n, k) = \frac{n(n-1)\cdots(n-k+1) \times (n-k)(n-k-1)\cdots 1}{(n-k)(n-k-1)\cdots 1} = \frac{n!}{(n-k)!}.

The numerator is now the full factorial n!n!, and the denominator cancels precisely the factors you did not want. So

P(n,k)=n!(nk)!.P(n, k) = \frac{n!}{(n-k)!}.

Why 0!=10! = 1 is forced. Look closely at what that cancellation is allowed to say. The tail (nk)(nk1)1(n-k)(n-k-1)\cdots 1 is an honest product of positive whole numbers only when k<nk < n, so the derivation above establishes the closed form for k<nk < n and reaches no further. The case k=nk = n is precisely the one it misses, and it is the case where 0!0! would have to mean something. So do not pretend the formula already covers it. Ask instead what value would let one formula cover it.

The slot count is not in doubt: arranging all nn objects gives P(n,n)=n!P(n, n) = n!. If the single closed form is to serve the edge case as well, it must return that same number, and there it reads n!/(nn)!=n!/0!n!/(n-n)! = n!/0!. Setting the two equal, n!=n!/0!n! = n!/0!, leaves exactly one possible value:

0!=1.0! = 1.

That is what “forced” means here. The value is not picked for convenience; it is the only one under which the formula and the count do not contradict each other. The binomial theorem lesson took 0!=10! = 1 as the convention that made its formula come out right at the edges, and this is the reason the convention had no choice. It also agrees with what the factorial means, since n!n! counts the arrangements of nn objects. And there is exactly one way to arrange no objects at all, the empty arrangement in which you do nothing.

Worked example 1 Count the license plates

A plate shows three letters followed by three digits. The letters must all be different, but the digits may repeat. How many plates are possible?

Treat the six characters as six stages and watch which counts shrink. The letters cannot repeat, so the letter stages offer 2626, then 2525, then 2424 options. The digits may repeat, so every digit stage keeps all 1010 options.

26×25×24×10×10×10.26 \times 25 \times 24 \times 10 \times 10 \times 10.

The letters contribute P(26,3)=26×25×24=15,600P(26, 3) = 26 \times 25 \times 24 = 15{,}600 and the digits contribute 103=1,00010^3 = 1{,}000, so

15,600×1,000=15,600,000.15{,}600 \times 1{,}000 = 15{,}600{,}000.

There are 15,600,00015{,}600{,}000 plates. The single question that decided every stage count was whether a character may be reused. Shrink the count when it may not, hold it fixed when it may.

Worked example 2 Line up 4 of 9 books

Nine different books sit in a box, and four of them will stand in a row on a shelf. How many different shelves are possible?

The shelf is ordered, since swapping two books produces a visibly different shelf, and no book can appear twice. That is a permutation of 44 objects chosen from 99, so fill four slots with shrinking counts:

P(9,4)=9×8×7×6=3,024.P(9, 4) = 9 \times 8 \times 7 \times 6 = 3{,}024.

The closed form gives the same number, and it is worth seeing the cancellation once:

P(9,4)=9!(94)!=9!5!=9×8×7×6×5!5!=3,024.P(9, 4) = \frac{9!}{(9-4)!} = \frac{9!}{5!} = \frac{9 \times 8 \times 7 \times 6 \times 5!}{5!} = 3{,}024.

In practice never expand 9!9! in full. Cancel 5!5! first and only four factors survive, which is the shrinking product you started with.

Check your understanding

A club of 1010 members elects a president, a secretary, and a treasurer, and no member may hold two offices. In how many ways can the three offices be filled?

Answer choices

Combinations, or forgetting the order

A permutation cares about order. Very often you do not. A committee of three is the same committee however you list its members, and a hand of cards is the same hand however it was dealt. A set of three chosen factors is the same set however you name them. What you want to count then is not an ordered list but a set.

Notation. For 0kn0 \le k \le n, the symbol (nk)\binom{n}{k}, read ”nn choose kk”, is the number of kk-element subsets of an nn-element set. This is not a new symbol. In the binomial theorem lesson it counted the ways to choose which kk of the nn factors of (x+y)n(x+y)^n donate their yy. And a choice of factors is nothing more than a set of kk factors picked out of nn. Same act, same count, same number. What is new here is a way to compute it directly.

The tool that computes it is the mirror image of the multiplication principle.

The division principle. Suppose a procedure produces NN outputs in total, and suppose every output is produced by exactly one object. Suppose also that every object you actually want to count is produced exactly dd times, with the same dd for every object. Then the number of objects is N/dN / d.

Why an even overcount can simply be divided away#

Sort the NN outputs into piles, putting two outputs in the same pile exactly when they came from the same object. Every output lands in exactly one pile, since it came from exactly one object, so the piles overlap nowhere and together hold all NN outputs.

By hypothesis each object is produced exactly dd times, so each pile holds exactly dd outputs. Let MM be the number of piles, which is the number of objects. Counting the outputs pile by pile gives MM groups of dd, so N=M×dN = M \times d, and therefore M=N/dM = N / d.

The requirement that dd be the same for every object is the whole content of the rule. If some objects were produced twice and others three times, the piles would be uneven and no single division could repair the count.

Now count (nk)\binom{n}{k} by deliberately overcounting it. The trick is to count something you already know how to count, the ordered lists, in two different ways.

The direct count of (nk)=n!k!(nk)!\binom{n}{k} = \dfrac{n!}{k!\,(n-k)!}#

Fix nn and kk with 0kn0 \le k \le n, and let LL be the collection of ordered lists of kk distinct objects drawn from the nn available. We count LL twice.

First count: fill the slots. A list is kk ordered slots filled without repetition, so by the shrinking slot argument there are

L=P(n,k)=n!(nk)!|L| = P(n, k) = \frac{n!}{(n-k)!}

lists in all.

Second count: choose, then order. Build the same list in two stages instead. First choose the set of kk objects that will appear in it, which by definition can be done in (nk)\binom{n}{k} ways. Then choose the order in which to write that set out, which is an arrangement of kk distinct objects in kk slots, so it can be done in P(k,k)=k!P(k, k) = k! ways.

The multiplication principle applies to these two stages, because the second stage offers k!k! orders no matter which set the first stage produced. And the two stages build every list exactly once. Each list determines its own set (its entries) and its own order (how they are written), so no list is built twice and none is missed. Hence

L=(nk)×k!.|L| = \binom{n}{k} \times k!.

Equate the two counts. The same collection was counted both times, so

(nk)×k!=n!(nk)!,\binom{n}{k} \times k! = \frac{n!}{(n-k)!},

and dividing by k!k! isolates the number we wanted:

(nk)=P(n,k)k!=n!k!(nk)!.\binom{n}{k} = \frac{P(n,k)}{k!} = \frac{n!}{k!\,(n-k)!}.

That is the second, independent proof of the closed form that the binomial theorem lesson promised you. There the formula was verified indirectly, by showing that n!/(k!(nk)!)n!/(k!\,(n-k)!) obeys Pascal’s rule and matches at the ends of each row, so it had to agree with the triangle everywhere. Here it came straight out of counting, with no recurrence anywhere in sight. The two arguments meet at the same formula from opposite directions.

Look at what the division did. Every set of kk objects was built k!k! times, once for each order in which its members could be listed. Dividing by k!k! collapses those k!k! lists back into the single set they all describe. Dividing by k!k! is the act of forgetting the order. That sentence is the difference between a permutation and a combination, and there is nothing else to it.

Twenty-four ordered lists collapse into four setsEach 3-element subset of a 4-element set appears in 6 orderings, so 24 ordered lists divided by 6 gives 4 subsets.P(4, 3) = 24 ordered lists, grouped by the set of letters they use{A, B, C}{A, B, D}{A, C, D}{B, C, D}ABCACBBACBCACABCBAABDADBBADBDADABDBAACDADCCADCDADACDCABCDBDCCBDCDBDBCDCB6 orders6 orders6 orders6 ordersevery set counted 3! = 6 times, so 24 / 6 = 4 sets
The 24 ordered lists of 3 letters chosen from A, B, C, D, sorted by which set of letters they use. Every set appears exactly 3! = 6 times, once per ordering, so the number of sets is 24 divided by 6, which is 4.

The picture is the proof in miniature. Choosing 33 letters from {A,B,C,D}\{A, B, C, D\} gives P(4,3)=24P(4,3) = 24 ordered lists, they fall into columns of 3!=63! = 6 that differ only by rearrangement, and so the number of sets is

(43)=246=4.\binom{4}{3} = \frac{24}{6} = 4.

Two facts drop out for free. Choosing which kk objects to take is the same act as choosing which nkn - k objects to leave, so (nk)=(nnk)\binom{n}{k} = \binom{n}{n-k}. The formula agrees because swapping kk with nkn-k just swaps the two factorials in the denominator. And at the edges, (n0)=(nn)=1\binom{n}{0} = \binom{n}{n} = 1, since there is one way to take nothing and one way to take everything. The formula produces those 11‘s only because 0!=10! = 1, which is the same forcing you saw a moment ago.

Here is the whole scheme on one page. Suppose you make kk picks from nn objects.

The kk picks areRepetitionHow many ways
orderedallowednkn^k
orderednot allowedP(n,k)=n!(nk)!P(n,k) = \dfrac{n!}{(n-k)!}
unorderednot allowed(nk)=n!k!(nk)!\dbinom{n}{k} = \dfrac{n!}{k!\,(n-k)!}

The missing fourth row, unordered picks with repetition allowed, needs a tool this lesson does not build, so leave it for a later course. The three rows above answer nearly everything. The two questions you must answer before choosing a row are whether rearranging your picks changes the outcome, and whether an object may be used twice. Neither question settles the row by itself. The first two rows are both ordered, so the order question alone leaves you stuck between them, and only the repetition question tells them apart.

Worked example 3 Choose a delegation of 5 from a club of 12

A club of 1212 members sends 55 delegates to a conference. The delegates have no titles and no ranks, so the delegation is just a set of five people. How many delegations are possible?

Rearranging the same five people gives the same delegation, so order does not matter and this is (125)\binom{12}{5}. Use the closed form, cancelling 7!7! against the tail of 12!12! before multiplying anything:

(125)=12!5!7!=12×11×10×9×85×4×3×2×1.\binom{12}{5} = \frac{12!}{5!\,7!} = \frac{12 \times 11 \times 10 \times 9 \times 8}{5 \times 4 \times 3 \times 2 \times 1}.

Five factors on top counting down from 1212, and 5!5! underneath. The numerator is 95,04095{,}040 and the denominator is 120120:

(125)=95,040120=792.\binom{12}{5} = \frac{95{,}040}{120} = 792.

There are 792792 delegations. Had the five delegates instead been given five distinct jobs, the answer would have been P(12,5)=95,040P(12,5) = 95{,}040, which is exactly 120120 times larger. That factor of 120120 is one for each of the 5!5! ways to hand out the jobs to a fixed set of five people.

Check your understanding

The same club of 1010 members instead sends a committee of 33 members, with no offices and no ranks. How many committees are possible?

Answer choices

Worked example 4 Build a committee with a required mix

A department has 77 women and 55 men, and it must form a committee of 33 women and 22 men. How many committees are possible?

Break the build into two stages, choosing the women and then the men. Neither group is ordered, so each stage is a combination:

(73)=7×6×53×2×1=35,(52)=5×42×1=10.\binom{7}{3} = \frac{7 \times 6 \times 5}{3 \times 2 \times 1} = 35, \qquad \binom{5}{2} = \frac{5 \times 4}{2 \times 1} = 10.

The multiplication principle now applies, because whichever three women are chosen, there are still 1010 ways to choose the men:

35×10=350.35 \times 10 = 350.

There are 350350 committees. Notice that the two stages multiply even though each stage was itself computed by a division. Combinations are ordinary numbers once you have them, and they slot into the multiplication principle like any other stage count.

Arranging objects that are not all distinct

The permutation formula assumed every object was distinguishable. Real problems break that assumption constantly, and the repair is the division principle again.

How many distinguishable arrangements does the word BANANA have? If the six letters were all different the answer would be 6!=7206! = 720, but they are not. There are three A’s and two N’s, and swapping two A’s produces the identical string. So 720720 is an overcount, and the question is by how much.

Arrangements of nn objects with repeats#

Suppose nn objects come in rr types, with n1n_1 copies of the first type, n2n_2 of the second, and so on up to nrn_r, where n1+n2++nr=nn_1 + n_2 + \cdots + n_r = n. Copies of the same type are identical. We count the distinguishable arrangements.

Tag the copies to make them temporarily distinct: call the three A’s of BANANA A1,A2,A3A_1, A_2, A_3. All nn tagged objects are now different, so they have n!n! arrangements.

Group those n!n! tagged arrangements by the untagged word they produce. Two tagged arrangements produce the same word exactly when they place the same type in the same positions. Two arrangements that produce the same word differ only in how the tags are distributed among the positions of each type. For a fixed word, the tags of type 11 can be scattered over its n1n_1 positions in n1!n_1! ways. The tags of type 22 can be scattered over the word’s n2n_2 positions in n2!n_2! ways, and so on. These choices are independent, so by the multiplication principle each word arises from exactly

n1!×n2!××nr!n_1! \times n_2! \times \cdots \times n_r!

tagged arrangements. That number is the same for every word, since it depends only on the type counts.

The division principle now applies with N=n!N = n! and d=n1!n2!nr!d = n_1!\,n_2!\cdots n_r!, so the number of distinguishable arrangements is

n!n1!n2!nr!.\frac{n!}{n_1!\,n_2!\,\cdots\,n_r!}.

For BANANA, n=6n = 6 with three A’s, two N’s, and one B:

6!3!2!1!=7206×2×1=72012=60.\frac{6!}{3!\,2!\,1!} = \frac{720}{6 \times 2 \times 1} = \frac{720}{12} = 60.

Sixty arrangements, not 720720. Divide by the factorials of the repeat counts, not by the repeat counts themselves: the three A’s contribute 3!=63! = 6, not 33.

This formula quietly contains the binomial coefficient. Take just two types, kk objects of one kind and nkn - k of the other, say kk letters Y and nkn-k letters X. The count of arrangements is

n!k!(nk)!=(nk),\frac{n!}{k!\,(n-k)!} = \binom{n}{k},

which is no coincidence at all. Arranging kk Y’s and nkn-k X’s in a row is precisely choosing which kk of the nn positions hold a Y. Back in the binomial theorem those positions were the factors of (x+y)n(x+y)^n that donate their yy. The same number keeps answering the same question in different clothes.

Worked example 5 Arrange the letters of MISSISSIPPI

The word MISSISSIPPI has 1111 letters. How many distinguishable arrangements are there?

Count the letters by type first, and check that the counts add to 1111:

M×1,I×4,S×4,P×2,1+4+4+2=11.\text{M} \times 1, \qquad \text{I} \times 4, \qquad \text{S} \times 4, \qquad \text{P} \times 2, \qquad 1 + 4 + 4 + 2 = 11.

Had all 1111 letters been different there would be 11!11! arrangements. Each actual word is produced 1!×4!×4!×2!1! \times 4! \times 4! \times 2! times by the tagged letters, so divide:

11!1!4!4!2!=39,916,8001×24×24×2=39,916,8001,152.\frac{11!}{1!\,4!\,4!\,2!} = \frac{39{,}916{,}800}{1 \times 24 \times 24 \times 2} = \frac{39{,}916{,}800}{1{,}152}.

Carry out the division:

39,916,8001,152=34,650.\frac{39{,}916{,}800}{1{,}152} = 34{,}650.

There are 34,65034{,}650 arrangements. The 1!1! for the single M is harmless, since 1!=11! = 1, but writing it down is a cheap way to make sure the type counts really do add up to 1111.

Complementary counting

Some sets are far easier to count by counting what you do not want. If every object either has a property or fails to have it, then those two cases overlap nowhere and cover everything. So the addition principle says the two counts add to the total. Rearranged, that is complementary counting:

(objects with the property)=(all objects)(objects without it).(\text{objects with the property}) = (\text{all objects}) - (\text{objects without it}).

The flagship case is at least one. The opposite of “at least one” is “none”. And “none” is usually a single clean count, while “at least one” splits into a pile of cases (exactly one, exactly two, exactly three, and so on). Counting the total and subtracting the “none” case replaces all of that work with one subtraction.

It is also a guard against a specific and very common error. Faced with “at least one woman on the committee”, the tempting move is to appoint one woman first, then fill the rest of the committee freely. That method builds a committee with two women twice, once for each woman it could have appointed first. The division principle cannot repair the damage, because committees with three women are built three times and the overcount is uneven. The next example shows the two answers side by side.

Worked example 6 At least one woman on the committee

A committee of 44 is chosen from 66 men and 55 women. How many committees contain at least one woman?

The group has 1111 people in total, and a committee is an unordered set of 44, so there are

(114)=11×10×9×84×3×2×1=7,92024=330\binom{11}{4} = \frac{11 \times 10 \times 9 \times 8}{4 \times 3 \times 2 \times 1} = \frac{7{,}920}{24} = 330

committees in all. The committees without a woman are made entirely of the 66 men:

(64)=6×5×4×34×3×2×1=15.\binom{6}{4} = \frac{6 \times 5 \times 4 \times 3}{4 \times 3 \times 2 \times 1} = 15.

Every committee either has at least one woman or has none, never both, so subtract:

33015=315.330 - 15 = 315.

There are 315315 committees with at least one woman.

Now watch the tempting method fail. Appoint one of the 55 women, then fill the remaining 33 seats from the other 1010 people, giving 5×(103)=5×120=6005 \times \binom{10}{3} = 5 \times 120 = 600. That is nearly double the truth, because a committee holding the women Ana and Bea is produced twice. That committee is produced once by appointing Ana first and once by appointing Bea first, while a committee holding three women is produced three times. The overcount is uneven, so no single division fixes it. Subtracting the complement never runs into this problem.

Check your understanding

A coin is flipped 66 times, giving 26=642^6 = 64 possible sequences of heads and tails. In how many of them does at least one head appear?

Answer choices

Common mistakes

Practice

Multiple Choice Questions (MCQ)

Progressively harder sets of questions. Each opens on its own page.

Free Response Questions (FRQ)

Longer questions in parts, to be worked out on paper. Progressive hints, the answer on its own so you can check yourself and try again, then the full worked solution, plus a rubric to mark your own work against.

Free response Work it out on paper 5 questions Start →
More practice (optional)

Extra sets, as hard as the Challenge set. Each one opens on its own page.

More resources (optional)

Other explanations of this lesson, if you want a second take.

A bit of history (Optional)

Gamblers had been counting this way for a century before anyone called it a subject. Every problem got its own clever trick. The tricks did not add up to anything.

Gottfried Leibniz, a young German lawyer, gave the field its name at twenty. His 1666 essay De Arte Combinatoria took the art of combinations far beyond dice. He wanted to break every idea into parts and recombine them to reach all possible truths. The essay promised far more than it delivered. The phrase survived anyway, and combinatorics still carries it.

The theorems came later, from a Swiss professor named Jacob Bernoulli. His Ars Conjectandi was printed in 1713, eight years after he died. Its second part walks through permutations and combinations in order. It proves the rules rather than collecting them, and that is the moment a bag of gambling answers became a subject.

Ordinary language never caught up. A combination lock will not open unless you enter its numbers in one exact order. By the words of this lesson that is not a combination lock at all. It is a permutation lock, and the everyday name preserves the confusion that dividing by k!k! was invented to remove.