Fundamental Counting: Permutations & Combinations

Study Sheet

Fundamental Counting: Permutations & Combinations

Competition counting & probability, Unit 1

Addition & Multiplication Principles

Concept
The two rules that power all of counting

Multiplication Principle (AND). If a task splits into a sequence of independent stages, and stage ii can be done in nin_i ways regardless of the earlier choices, then the whole task can be done in

n1n2n3nkn_1 \cdot n_2 \cdot n_3 \cdots n_k

ways. Use it when you make choice 1 and choice 2 and

Addition Principle (OR). If the outcomes split into disjoint cases (no outcome lands in two cases at once), add the counts of the cases:

A1+A2++Ak.|A_1| + |A_2| + \cdots + |A_k|.

Use it when an outcome comes from case 1 or case 2 or

Example
Worked example: license plates

A plate has 2 letters (AA--ZZ) followed by 3 digits (00--99). How many plates are possible?

Solution. Five independent stages: 2626101010=676,00026 \cdot 26 \cdot 10 \cdot 10 \cdot 10 = 676{,}000. Now suppose the first symbol may be either a letter or a digit (so 26+10=3626+10=36 choices) while the rest stay as before: the count becomes 362610336 \cdot 26 \cdot 10^3. The “either/or” at one stage is an addition inside a multiplication.

Example
Worked example: casework by a special digit

How many 3-digit numbers (100--999) contain at least one digit equal to 77?

Solution. Complementary counting is cleanest: total 3-digit numbers =900=900. Those with no 77: first digit has 88 choices (11--99 except 77), the other two have 99 each, giving 899=6488\cdot 9 \cdot 9 = 648. So the answer is 900648=252900-648 = 252.

Tip

Pitfall. The multiplication principle requires the number of ways at each stage to be constant, not the specific choices. If choosing AA first changes how many options remain at stage 2 (versus choosing BB), you must split into cases and add.

Factorials & Permutations

Concept
Ordered arrangements

n!=n(n1)(n2)21n! = n(n-1)(n-2)\cdots 2 \cdot 1 counts the orderings of nn distinct objects, with 0!=10! = 1.

A permutation of kk objects chosen from nn distinct objects (order matters, no repetition) is

P(n,k)=n!(nk)!=n(n1)(nk+1)k falling factors.P(n,k) = \frac{n!}{(n-k)!} = \underbrace{n(n-1)\cdots(n-k+1)}_{k\text{ falling factors}}.

Read it as: fill kk ordered slots, with nn choices for the first, n1n-1 for the next, and so on.

Example
Worked example: podium finishes

In a race of 88 runners, how many ways can the gold, silver, and bronze medals be awarded (no ties)?

Solution. Order matters and there is no repetition, so

P(8,3)=876=336.P(8,3) = 8 \cdot 7 \cdot 6 = 336.
Example
Worked example: arrange with a restriction

How many ways can 55 distinct books be lined up on a shelf if the dictionary must be on one of the two ends?

Solution. Place the dictionary first: 22 end choices. Arrange the other 44 books in the remaining slots: 4!=244! = 24. Total 224=482 \cdot 24 = 48. Handle the restricted object first.

Tip

Tip. P(n,n)=n!P(n,n) = n! because 0!=10!=1. When a problem says “arrange,” “order,” “line up,” or “rank,” you are almost always in permutation territory.

Combinations

Concept
Unordered selections

A combination chooses kk objects from nn distinct objects when order does not matter:

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

Dividing by k!k! removes the k!k! orderings of each chosen set. Key identities:

(nk)=(nnk),(n0)=(nn)=1,k=0n(nk)=2n.\binom{n}{k} = \binom{n}{n-k}, \qquad \binom{n}{0}=\binom{n}{n}=1, \qquad \sum_{k=0}^{n}\binom{n}{k} = 2^{n}.
Example
Worked example: forming a committee

From 1010 people, how many ways can we choose a committee of 44?

Solution. Order is irrelevant: (104)=109874321=210.\binom{10}{4} = \frac{10\cdot 9\cdot 8\cdot 7}{4\cdot 3\cdot 2\cdot 1} = 210.

Example
Worked example: choosing with two groups

A club has 66 freshmen and 55 seniors. How many 44-person committees have exactly 22 freshmen?

Solution. Choose 22 of 66 freshmen and 22 of 55 seniors: (62)(52)=1510=150\binom{6}{2}\binom{5}{2} = 15\cdot 10 = 150. (Multiplication principle joins two independent choices.)

Tip

Pitfall. (nk)\binom{n}{k} counts sets, not sequences. If you ever find yourself later imposing an order on a chosen set, you probably wanted a permutation, or you must multiply by the number of orderings.

Permutations with Identical Objects

Concept
Arrangements when some items repeat

The number of distinct arrangements of nn objects, where there are n1n_1 identical objects of type 1, n2n_2 of type 2, …, nrn_r of type rr (with n1++nr=nn_1 + \cdots + n_r = n), is the multinomial coefficient

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

Each group of identical objects contributes a k!k! overcount that must be divided out.

Example
Worked example: rearranging a word

How many distinct arrangements of the letters in MISSISSIPPI are there?

Solution. There are 1111 letters: M×1, I×4, S×4, P×2M{\times}1,\ I{\times}4,\ S{\times}4,\ P{\times}2. So

11!1!4!4!2!=39,916,800124242=34,650.\frac{11!}{1!\,4!\,4!\,2!} = \frac{39{,}916{,}800}{1\cdot 24\cdot 24\cdot 2} = 34{,}650.
Example
Worked example: lattice paths

How many shortest grid paths go from (0,0)(0,0) to (4,3)(4,3) moving only right (R) or up (U)?

Solution. Every path is a sequence of 44 R's and 33 U's, so we arrange 77 steps:

7!4!3!=(73)=35.\frac{7!}{4!\,3!} = \binom{7}{3} = 35.

Lattice-path counting is really “permutations with identical objects” in disguise --- a favorite contest trick.

Tip

Tip. The multinomial coefficient collapses to (nk)\binom{n}{k} when there are only two types (a “kk of one kind, nkn-k of the other” string). Choosing positions and arranging identical objects are the same act.

Circular Permutations

Concept
Seating around a table

Arrangements around a circle count only relative position: rotating everyone one seat gives the same arrangement. Fixing one person to kill the nn rotations gives

circular arrangements of n distinct objects=(n1)!.\text{circular arrangements of } n \text{ distinct objects} = (n-1)!.

If arrangements that are mirror images (reflections) are also considered identical --- as with a bracelet or necklace of beads --- divide by an additional 22:

(n1)!2(n3).\frac{(n-1)!}{2}\quad (n \ge 3).
Example
Worked example: round table

In how many ways can 66 people sit at a round table if only relative order matters?

Solution. (61)!=5!=120(6-1)! = 5! = 120.

Example
Worked example: keyed seating

55 couples sit around a round table so that partners are adjacent. How many seatings (rotations equivalent)?

Solution. Treat each couple as a block: arrange 55 blocks around the circle in (51)!=24(5-1)! = 24 ways, then order the two partners within each block: 25=322^5 = 32. Total 2432=76824 \cdot 32 = 768.

Tip

Pitfall. Decide up front whether reflections count as the same. Seats fixed to the table (labeled chairs, a head of table, a clock face) make it linear again --- use n!n!, not (n1)!(n-1)!.

Order Matters vs. Order Doesn't (Choosing vs. Arranging)

Concept
The master decision

Before counting, ask: does swapping two chosen items produce a different outcome?

  • 2pt
  • Yes \Rightarrow order matters \Rightarrow arrangement/permutation: P(n,k)=n!(nk)!P(n,k)=\dfrac{n!}{(n-k)!}.
  • No \Rightarrow order irrelevant \Rightarrow selection/combination: (nk)=n!k!(nk)!\dbinom{n}{k}=\dfrac{n!}{k!(n-k)!}.

The bridge between them: P(n,k)=(nk)k!P(n,k) = \binom{n}{k}\cdot k!. First choose the set, then arrange it.

Example
Worked example: same numbers, different question

From 99 students:

  • 2pt
  • How many ways to pick a 33-person study group?   (93)=84\binom{9}{3}=84 (order doesn't matter).
  • How many ways to pick a President, VP, and Treasurer?   P(9,3)=987=504P(9,3)=9\cdot 8\cdot 7 = 504 (distinct roles \Rightarrow order matters).

Notice 504=843!=846504 = 84 \cdot 3! = 84\cdot 6.

Tip

Tip. Titles, ranks, ordered slots, and positions signal “order matters.” Committees, teams, hands of cards, and subsets signal “order doesn't.”

Going Deeper: Subtleties, Overcounting & Symmetry

Concept
Necklaces vs. circular arrangements

A circular arrangement treats only rotations as identical: (n1)!(n-1)!. A necklace (or bracelet) treats rotations and reflections as identical: (n1)!2\frac{(n-1)!}{2} for n3n\ge 3. Always confirm whether the object can be physically flipped over. A round-table seating cannot be flipped (people keep their left/right neighbors distinct), but a bracelet of beads can.

Example
Worked example: overcounting by symmetry

How many distinct triangles can be drawn using 88 points on a circle as vertices (no three collinear)?

Solution. A triangle is just an unordered choice of 33 vertices, so (83)=56\binom{8}{3}=56. If you had counted ordered triples 876=3368\cdot 7\cdot 6 = 336, you would be overcounting each triangle by its 3!=63! = 6 vertex orderings: 336/6=56336/6 = 56. Recognizing the hidden symmetry factor is the whole game.

Example
Worked example: division-into-groups trap

In how many ways can 66 distinct players be split into 33 unlabeled pairs?

Solution. If the pairs were labeled (Court 1, 2, 3), the count would be (62)(42)(22)=1561=90\binom{6}{2}\binom{4}{2}\binom{2}{2} = 15\cdot 6\cdot 1 = 90. But the 3!3! orderings of the (identical-status) pairs are the same partition, so divide: 90/3!=1590/3! = 15. Dividing by the arrangements of interchangeable groups is the most common contest overcount.

Example
Worked example: complementary & inclusion--exclusion

How many 44-digit numbers (1000--9999) have at least one repeated digit?

Solution. Total =9000=9000. All-distinct: 9987=45369\cdot 9\cdot 8\cdot 7 = 4536 (first digit 11--99, then any unused digit including 00). At least one repeat =90004536=4464=9000 - 4536 = 4464. When “at least one” appears, subtract the “none” case.

Tip

Big picture --- recognizing when order matters. Every basic counting problem reduces to three questions, asked in order:

  • 2pt
  • Are stages joined by AND (multiply) or OR (add)? Split disjoint cases; never let one outcome fall into two cases.
  • Within a stage, does order matter? Yes \Rightarrow permutation P(n,k)P(n,k); No \Rightarrow combination (nk)\binom{n}{k}; repeats among items \Rightarrow divide by each group's factorial.
  • Did symmetry make me overcount? Rotations (÷n\div n), reflections (÷2\div 2), and interchangeable groups (÷k!\div k!) each demand a division. When in doubt, count an easy way with order, then divide out exactly the symmetries you introduced.

The Bijection Principle

Concept
Count a hard set by matching it to an easy one

If there is a bijection (a one-to-one, onto pairing) between a finite set AA and a finite set BB, then A=B|A| = |B|. So to count a difficult set AA, build a reversible dictionary that turns each object of AA into exactly one object of an easier-to-count set BB --- and back again. The whole method is: define the map, check it is invertible, count BB.

The lattice-path count you already met is a bijection in disguise: paths \longleftrightarrow words in R's and U's. Most “clever” contest counts are really the discovery of the right bijection.

Example
Worked example: stars and bars via a bijection

How many ways can we write x1+x2+x3+x4=10x_1 + x_2 + x_3 + x_4 = 10 with each xix_i a nonnegative integer?

Solution. Encode a solution as a row of 1010 stars split into 44 groups by 33 bars, e.g.

x1=2  x2=3  x3=0  x4=5.\underbrace{\star\star}_{x_1=2}\ \mid\ \underbrace{\star\star\star}_{x_2=3}\ \mid\ \underbrace{}_{x_3=0}\ \mid\ \underbrace{\star\star\star\star\star}_{x_4=5}.

Every solution gives exactly one such string of 1010 stars and 33 bars, and every string decodes to exactly one solution --- a bijection. Counting the strings is a “permutations with identical objects” problem on 1313 symbols:

(10+33)=(133)=286.\binom{10+3}{3} = \binom{13}{3} = 286.

In general x1++xk=nx_1 + \cdots + x_k = n (nonnegatives) has (n+k1k1)\binom{n+k-1}{k-1} solutions.

Example
Worked example: subsets with no two consecutive elements

How many subsets of {1,2,,12}\{1,2,\dots,12\} contain no two consecutive integers?

Solution. Suppose we pick kk elements a1<a2<<aka_1 < a_2 < \cdots < a_k with each gap ai+1ai2a_{i+1}-a_i \ge 2. Define bi=ai(i1)b_i = a_i - (i-1). This subtracts off the forced gaps, and the map {ai}{bi}\{a_i\}\mapsto\{b_i\} is a bijection onto the kk-element subsets of {1,2,,12(k1)}={1,,13k}\{1,2,\dots,12-(k-1)\} = \{1,\dots,13-k\} with no restriction. Hence the count for each kk is (13kk)\binom{13-k}{k}, and summing over all kk:

k0(13kk)=(130)+(121)+(112)+(103)+(94)+(85)+(76)=1+12+55+120+126+56+7=377.\sum_{k\ge 0}\binom{13-k}{k} = \binom{13}{0}+\binom{12}{1}+\binom{11}{2}+\binom{10}{3}+\binom{9}{4}+\binom{8}{5}+\binom{7}{6} = 1+12+55+120+126+56+7 = 377.

(These are Fibonacci numbers --- a bijection can expose hidden structure, not just a number.)

Tip

Tip. To trust a bijection, exhibit the inverse: describe how to recover the original object from its image. If you cannot decode uniquely, the map is not a bijection and A=B|A|=|B| may fail. “Shift the indices” (bi=ai(i1)b_i = a_i - (i-1)) is the single most useful bijection trick for turning a spacing constraint into a free choice.

Counting Functions Between Finite Sets

Concept
Every function is an assignment; count the assignments

Let X=n|X| = n (the domain) and Y=m|Y| = m (the codomain). Think of each element of XX as choosing a target in YY.

  • 2pt
  • All functions XYX \to Y: each of the nn inputs picks any of mm outputs independently, giving @@BLOCK0@@
  • Injective (one-to-one) functions: distinct inputs need distinct outputs, so fill the nn inputs with a falling factorial of choices: @@BLOCK1@@ which is 00 when n>mn > m (pigeonhole: too many inputs to keep distinct).
  • Surjective (onto) functions: every output in YY must be hit at least once. There is no bare product formula; inclusion--exclusion (a later unit) gives @@BLOCK2@@
Example
Worked example: three formulas, one setup

Let X={1,2,3,4}X = \{1,2,3,4\} and Y={a,b,c}Y = \{a,b,c\}, so n=4n=4, m=3m=3.

Solution.

  • 2pt
  • All functions: 34=813^4 = 81.
  • Injective functions: impossible, since n=4>3=mn=4 > 3 = m; count =0=0.
  • Surjective functions: j=03(1)j(3j)(3j)4=34324+3140=8148+3=36.\displaystyle\sum_{j=0}^{3}(-1)^j\binom{3}{j}(3-j)^4 = 3^4 - 3\cdot 2^4 + 3\cdot 1^4 - 0 = 81 - 48 + 3 = 36.

Sanity check: a surjection from a 44-set onto a 33-set forces exactly one output to be used twice. Choose the doubled output (33 ways), choose which 22 of the 44 inputs share it ((42)=6\binom{4}{2}=6), then biject the remaining 22 inputs to the remaining 22 outputs (2!=22!=2): 362=363\cdot 6\cdot 2 = 36. ✓

Tip

Tip. “Number of functions” problems are pure multiplication-principle problems wearing a costume: the domain elements are the independent stages. Watch the direction --- functions XYX\to Y give mnm^n, not nmn^m. The base is the size of the codomain (the menu); the exponent is the size of the domain (the diners).

The Multinomial Coefficient as a Distribution

Concept
One coefficient, three readings

For nonnegative integers with k1+k2++kr=nk_1 + k_2 + \cdots + k_r = n, define

(nk1,k2,,kr)=n!k1!k2!kr!.\binom{n}{k_1,\,k_2,\,\dots,\,k_r} = \frac{n!}{k_1!\,k_2!\cdots k_r!}.

This single number counts three equivalent things:

  • 2pt
  • Arrangements: distinct orderings of nn objects where kik_i are of type ii (the MISSISSIPPI idea).
  • Distributions: ways to deal nn distinct objects into rr distinct labeled boxes so box ii receives exactly kik_i objects.
  • Ordered set partitions: ways to split {1,,n}\{1,\dots,n\} into an ordered list of blocks of sizes k1,,krk_1,\dots,k_r.

It also names the coefficients in the Multinomial Theorem

(x1+x2++xr)n=k1++kr=n(nk1,,kr)x1k1x2k2xrkr.(x_1 + x_2 + \cdots + x_r)^{n} = \sum_{k_1+\cdots+k_r = n} \binom{n}{k_1,\dots,k_r}\, x_1^{k_1}x_2^{k_2}\cdots x_r^{k_r}.
Example
Worked example: a specific coefficient

Find the coefficient of x3y2z2x^{3}y^{2}z^{2} in the expansion of (x+y+z)7(x + y + z)^{7}.

Solution. Here n=7n=7 with exponents (k1,k2,k3)=(3,2,2)(k_1,k_2,k_3) = (3,2,2), which sum to 77:

(73,2,2)=7!3!2!2!=5040622=210.\binom{7}{3,2,2} = \frac{7!}{3!\,2!\,2!} = \frac{5040}{6\cdot 2\cdot 2} = 210.
Example
Worked example: dealing cards into hands

In how many ways can a standard 5252-card deck be dealt into four labeled hands (North, East, South, West) of 1313 cards each?

Solution. This is a distribution of 5252 distinct objects into 44 labeled boxes of size 1313:

(5213,13,13,13)=52!(13!)4.\binom{52}{13,\,13,\,13,\,13} = \frac{52!}{(13!)^{4}}.

If instead the four hands were unlabeled (just a partition into four piles of 1313, no seat names), we would divide by the 4!4! orderings of the interchangeable piles: 52!(13!)44!\dfrac{52!}{(13!)^{4}\,4!}.

Tip

Identity worth knowing. The multinomial factors through binomials:

(nk1,k2,,kr)=(nk1)(nk1k2)(nk1k2k3)(krkr).\binom{n}{k_1,k_2,\dots,k_r} = \binom{n}{k_1}\binom{n-k_1}{k_2}\binom{n-k_1-k_2}{k_3}\cdots\binom{k_r}{k_r}.

This is just “fill box 11, then box 22 from what remains, …” --- the multiplication principle. Summing all multinomials of order nn gives rnr^{n} (set x1==xr=1x_1=\cdots=x_r=1 in the theorem), matching the “each of nn objects picks one of rr boxes” count.

Orientation: The Twelvefold Way

Concept
Distributing balls into boxes --- the master chart

Almost every elementary counting problem is “put nn balls into mm boxes.” The answer depends on two switches --- are the balls distinguishable? are the boxes distinguishable? --- and on any restriction (no limit / at most one per box / at least one per box). The resulting 2×2×32\times 2\times 3 grid is the classic Twelvefold Way. Reading it now shows how the tools of this unit fit together and previews later units.

1.5

Here S(n,k)S(n,k) is a Stirling number of the second kind (partitions of a set into kk nonempty blocks), pm(n)p_m(n) counts partitions of the integer nn into exactly mm positive parts, and [][\,\cdot\,] is 11 if the condition holds and 00 otherwise.

Example
Worked example: reading four cells of the chart

Distribute balls into 33 boxes; compare the four “any” entries for small cases.

Solution.

  • 2pt
  • Distinct balls, distinct boxes, n=4n=4: functions {1,2,3,4}{\{1,2,3,4\}\to\{box1,_1,box2,_2,box3}_3\}, so 34=813^4 = 81.
  • Identical balls, distinct boxes, n=4n=4: stars and bars, (4+314)=(64)=15\binom{4+3-1}{4} = \binom{6}{4} = 15.
  • Distinct balls, identical boxes, n=4n=4 into at most 33 nonempty groups: S(4,1)+S(4,2)+S(4,3)=1+7+6=14S(4,1)+S(4,2)+S(4,3) = 1 + 7 + 6 = 14.
  • Identical balls, identical boxes, n=4n=4 into at most 33 parts: partitions of 44 with 3\le 3 parts: 4, 3+1, 2+2, 2+1+14,\ 3{+}1,\ 2{+}2,\ 2{+}1{+}1, so 44.

Same phrase, four genuinely different answers --- the two “distinguishable?” switches are everything.

Tip

Big picture. The top row (distinct/distinct) is this unit's home turf: functions, falling factorials, and surjection counts. The second row (identical balls, distinct boxes) is the stars-and-bars world of the next unit. The bottom two rows introduce set partitions (S(n,k)S(n,k)) and integer partitions (p(n)p(n)), the subject of still later units. When a problem stumps you, first locate its cell: are the balls alike? are the boxes alike? is there a per-box constraint?

Formulas, Proofs & Tips

Tip
Counting: arrangements and selections
P(n,r)=n!(nr)!,(nr)=n!r!(nr)!P(n,r)=\frac{n!}{(n-r)!},\qquad \binom{n}{r}=\frac{n!}{r!\,(n-r)!}

What it means. Permutations count ordered arrangements; combinations count unordered selections.

Example. P(5,2)=5!3!=20P(5,2)=\tfrac{5!}{3!}=20 and (52)=10\binom52=10.

Why it works. Filling rr ordered slots from nn items gives n(n1)(nr+1)=n!(nr)!n(n-1)\cdots(n-r+1)=\tfrac{n!}{(n-r)!} choices. If order does not matter, every group of rr has been counted r!r! times — once per arrangement — so divide by r!r!.

Tip. Ask "would swapping two picks give a different outcome?" Yes \to permutation. No \to combination.