University Mathematics — Year 1 · Bachelor Year 1
2Counting
Counting finite sets sounds elementary — and quickly becomes subtle. This chapter defines cardinality properly (through bijections, in the spirit of Chapter 1), establishes the handful of counting principles from which everything follows, and derives the classical counts: lists, permutations, subsets, binomial coefficients.
2.1 Cardinality of finite sets
Definition 2.1 (Finite set, cardinality)
For , write . A set is finite when or there is a bijection from onto for some ; this is unique (Theorem 2.2) and is the cardinality of , written (with ).
Theorem 2.2 (Cardinality is well defined)
If , there is no bijection from onto . More precisely, if there is no injection from into .
Proof. We prove by induction on the statement: for all , there is no injection . For the target is empty and : no map exists at all. Assume the statement for , and suppose is an injection with . If the value is not attained, is an injection into , contradicting the induction hypothesis. Otherwise for exactly one ; swap and (formally: compose with the transposition of the two values), so that the new injection has . Then the restriction of to is an injection into with — contradiction again. ∎
Corollary 2.3 (Pigeonhole principle)
If , no map is injective: some two elements of share their image.
Proof. Write , with , and choose bijections and . If were injective, would be an injection from into (a composition of injections, Proposition 1.26), contradicting Theorem 2.2. ∎
Remark 2.4 (Interlude: why the swap in the theorem’s proof?)
The proof of Theorem 2.2 contains the chapter’s first genuinely clever move, worth replaying slowly. The obstacle: to apply the induction hypothesis one wants to delete the last point of the source and the last point of the target, but may send some other point to , and then deleting the target point damages the map elsewhere. The cure: compose with the transposition of the two values and — a bijection of the target, so injectivity is preserved — after which the troublesome value sits at the harmless position , and both deletions are clean. This “normalize first, then cut” pattern recurs: it is how the derangement recurrence redirects in the weekend problem of this chapter, and how permutations are patched throughout Chapter 7’s problem on the symmetric group.
Proposition 2.5 (Injections, surjections and cardinality)
Let be finite sets with , and . Then
Proof. Suppose injective. Then is a bijection from onto , so . If missed a point of , then would be an injection of into , a set of cardinality — impossible by the pigeonhole principle. So : is surjective, hence bijective.
Suppose surjective. Choose for each one preimage ; then , so is injective (Proposition 1.26). By the previous paragraph applied to (the cardinalities are equal), is bijective. From we get , so is bijective. Finally, a bijective map is by definition both injective and surjective, which closes the cycle of implications. ∎
Example 2.6 (Finiteness is essential)
On a finite set, Proposition 2.5 is a powerful shortcut: any injective map from to itself is automatically a permutation of — half of bijectivity comes for free. Both implications collapse on infinite sets: is injective from to but misses , and the map sending and for is surjective but not injective. Whenever this proposition is invoked, the finiteness hypothesis is doing real work — a theme that the weekend problem of Chapter 1 explores from the other side, where infinite sets are precisely those admitting such self-maps.
Example 2.7 (Half the work, for free)
Consider the map on sending to the remainder of upon division by ; its table of values is
Is a bijection? Injectivity alone suffices (Proposition 2.5): if and have the same remainder, divides , and since is prime and does not divide , it divides (Euclid’s lemma, used at High School level here and proved in Chapter 6); with this forces . Surjectivity comes free — no need to solve for each , though the table confirms every value appears exactly once. The shortcut is a workhorse: it proves the invertibility of modular multiplication (Chapter 6), powers the pairing in Wilson’s theorem, and returns in linear algebra as “an endomorphism of a finite-dimensional space is injective iff surjective” (Chapter 19).
2.2 The counting principles
Proposition 2.8 (Sum and product rules)
Let be finite sets.
Proof. (1) Concatenate enumerations: if and with no repetition, then enumerates without repetition (disjointness). Induction extends this to pieces.
(2) is the disjoint union of and , and is the disjoint union of and ; so .
(3) is the disjoint union, over , of the sets , each of cardinality ; apply (1).
(4) A map from to is exactly the choice of the -tuple ; this correspondence is a bijection, and by (3) and induction.
(5) Subsets of correspond bijectively to maps (send to its indicator function); apply (4). ∎
Example 2.9 (Complement counting)
How many -digit PIN codes (digits –, order matters, repetition allowed) contain at least one repeated digit? Counting them directly means juggling the cases “exactly one pair, two pairs, a triple, a quadruple” — five overlapping configurations. Count the complement instead: all codes number (product rule), the codes with four distinct digits number (-arrangements), so the answer is
Nearly half of all PINs repeat a digit. The insight: whenever a count is phrased with “at least” or “not all”, try the complement first — the sum rule guarantees that , and the complement is often a single clean configuration.
Example 2.10 (Lattice paths)
Count the shortest paths from the corner to the corner of a grid, moving only one step right (R) or one step up (U) at a time. Every such path takes exactly steps, of which are R and are U; conversely, any word of length in the letters R, U with four R’s describes exactly one path. The paths therefore correspond bijectively to the choices of the positions of the R’s:
The insight is the encoding: the count became trivial the moment each path was translated into a word, i.e. a subset of positions — one more instance of the slogan that a correct count is a disguised bijection (Method 2.19).
2.3 Lists, permutations, subsets
Definition 2.11 (Arrangements, permutations, combinations)
Let be a set with and let .
- A -arrangement of is an injective -tuple of elements of (an ordered selection without repetition);
- a permutation of is a bijection from to itself — equivalently, an -arrangement;
- a -combination is a subset of with elements (an unordered selection without repetition). Their number is written , read “ choose ” .
Theorem 2.12 (The three counts)
With and :
- the number of -arrangements of is ;
- the number of permutations of is ;
- .
Proof. (1) Choose the first coordinate ( ways), then the second ( remaining choices), …, then the -th ( choices). Formally, induct on . For there are one-term injective tuples. Assume the count for . Each -arrangement is obtained from exactly one -arrangement — its truncation — by appending a last coordinate outside , for which exactly values are available. The -arrangements are thus partitioned, by truncation, into classes of common size indexed by the -arrangements, and the sum rule gives
(2) is (1) with .
(3) Each -subset orders into distinct -arrangements, and every -arrangement arises from exactly one subset: so . ∎
Example 2.13 (Round tables: quotienting by symmetry)
In how many ways can guests sit around a round table, two seatings being identical when each guest has the same left and right neighbors — i.e. up to rotation? Each circular seating corresponds to exactly linear seatings (cut the circle at any of the places), so the linear orders collapse in groups of :
Equivalently: seat one distinguished guest anywhere (killing the rotational freedom), then order the remaining guests clockwise. For : tables. The two solutions illustrate the two standard cures for overcounting: divide by the exact number of repetitions, or break the symmetry by pinning one object down. Both require the group-of-repetitions size to be the same for every configuration — which the proof of the formula above used as well, with in place of .
Example 2.14 (Adding a constraint)
Continuing the round table: among the tables of guests, how many seat two given guests and apart (not adjacent)? Count the complement. Tables where and sit together: glue them into a single block — objects around the table, i.e. circular arrangements — then order the pair inside its block ( ways): adjacent tables. Hence
tables keep them apart. Sanity checks: gives (around a triangle, everyone touches everyone) and gives , easily listed by hand. The gluing trick — treat a forced block as one object, then count its internal arrangements — is the standard cure for adjacency constraints, linear or circular.
Proposition 2.15 (Basic identities)
For :
Proof. First identity: is a bijection between -subsets and -subsets. Pascal’s rule: fix an element ; the -subsets split into those containing (choose the others: ) and those avoiding (). Third identity: both sides count all subsets of , split by size on the left (Proposition 2.8 (1) and (5)). ∎
Theorem 2.16 (Binomial theorem)
For all in a commutative ring (say or ) and :
Proof. Expanding distributively yields one term per choice, in each factor, of either or : the term appears once for each way of choosing which of the factors contribute — that is, times. (Alternatively: induct on using Pascal’s rule.) ∎
Example 2.17
Two classical specializations: recovers ; , gives for : among the subsets of a nonempty set, exactly half have even cardinality.
Example 2.18 (One identity, two proofs)
The specialization , of the binomial theorem reads
Here is the same identity with no algebra at all. The right side counts the words of length over the alphabet (product rule). Classify each word by the set of positions carrying a nonzero letter: choosing with costs , then each position of independently carries or : ways. The sum rule over gives the left side. Beyond the pleasure of agreement, the two proofs have different virtues: the algebraic one generalizes to any value of , the combinatorial one explains the formula and adapts to constraints (forbid the letter in the last position, say) that no substitution captures. Keeping both techniques active is the practical skill this chapter trains.
Method 2.19 (Which count applies?)
Before computing, answer two questions about the selection: does the order matter, and are repetitions allowed?
| order matters | order does not matter | |
|---|---|---|
| no repetition | ||
| [6pt] repetition allowed | (Exercise 2.10) |
Then hunt for a bijection or a partition reducing the problem to these model counts; a correct count is a disguised bijection.
Remark 2.20 (Common pitfalls in counting)
- Summing non-disjoint cases. The sum rule requires a partition; if configurations can satisfy two cases at once, they are counted twice — the cure is inclusion–exclusion (Theorem 2.24) or a finer case split.
- Ordered versus unordered. Choosing “a committee of two” is , not : decide before computing whether the selection carries an order, and if an ordered count is easier, divide by the number of orderings at the end — but only when every unordered object arises from the same number of ordered ones.
- Multi-stage choices that are not independent. The product rule needs the number of options at each stage to be independent of the previous choices. “Choose a captain, then a different vice-captain” is fine (); “choose two players who get along” is not a two-stage product at all.
- Double-counting by construction. Building each object twice — e.g. counting hands with at least one ace as (choose an ace) (choose more cards) — overcounts hands with two aces. “At least” almost always calls for the complement (Example 2.9).
Example 2.21 (Poker-style count)
From a -card deck, the number of -card hands is . Hands containing exactly one ace: choose the ace ( ways) then cards among the non-aces: . The product rule applies because the choice splits into independent stages.
Method 2.22 (Double counting)
To prove an identity between two counting expressions, find a single finite set that both sides count — typically a set of pairs — and evaluate its cardinality in two different orders. The prototype is the handshake lemma: at a party, count the pairs (person, hand shaken). Summing over people gives (each person ’s number of handshakes); summing over handshakes gives twice the number of handshakes (each involves two people). Hence is even — so the number of people who shook an odd number of hands is always even, a nontrivial conclusion obtained with no formula at all. The same engine runs Exercise 2.12 and several questions of the weekend problem below.
Example 2.23 (The average subset)
What is the average cardinality of a subset of an -element set , all subsets being equally likely? Double count the pairs with : summing over subsets gives , the total we want; summing over elements gives (each of the elements lies in exactly half of the subsets — pair each containing with ). Hence
subsets are, on average, half-full — as the symmetry (which pairs sizes and ) also predicts. Two proofs, one answer, and both avoid the direct computation of Exercise 2.5: a well-chosen pairing often replaces an identity.
2.4 Inclusion–exclusion
Theorem 2.24 (Inclusion–exclusion)
For finite sets :
For : .
Proof. Fix an element of the union and count its contribution to the right-hand side. Let , of cardinality . The element is counted once in exactly when , with sign ; its total contribution is
by Example 2.17. So each element of the union is counted exactly once. ∎
Example 2.25 (Counting coprime integers)
How many integers of are coprime to ? An integer shares a factor with exactly when it is divisible by , or , so count the complement of , where collects the multiples of . Within , the multiples of number whenever divides — no floor functions needed — and , etc. Inclusion–exclusion:
so integers are coprime to . It is instructive to regroup the computation as a product:
expanding the three parentheses reproduces exactly the eight signed terms of inclusion–exclusion, one per subset of . This product form defines Euler’s totient function, whose arithmetic role appears with Chapter 6’s congruences and is developed in the Year 2 volume.
Example 2.26 (Derangements)
A derangement is a permutation with no fixed point. Let be the set of permutations of fixing ; then , and inclusion–exclusion counts the permutations with at least one fixed point; the derangements number
Since (see Chapter 17), about of all permutations are derangements, whatever is.
Remark 2.27 (Where this chapter is used)
Binomial coefficients are the most heavily reused objects of this chapter: they drive the binomial theorem in Chapter 8 (expansion of ), the Leibniz formula for the -th derivative of a product in Chapter 14, and the coefficients of Taylor expansions in Chapter 16. Permutations return as a group — with the signature built from counting inversions — in Chapter 7, and the signature in turn defines determinants in Chapter 22. Inclusion–exclusion and the counting principles are the finite backbone of discrete probability, developed in the Year 2 volume; the derangement numbers of Example 2.26 are studied in depth in the weekend problem below.
2.5 Exercises
Exercise 2.1 ★
A license plate consists of two letters (A–Z), then three digits, then two letters. How many plates are possible? How many with no repeated letter among the four?
Solution
Solution of Exercise 2.1.
Independent stages and the product rule: plates. With the four letters pairwise distinct, the letter stages form a -arrangement of the alphabet: ways, so plates.
Exercise 2.2 ★
How many anagrams (rearrangements of the letters, meaningful or not) has the word orange? And banana?
Solution
Solution of Exercise 2.2.
orange has distinct letters: anagrams. banana has letters with repetitions ( a’s, n’s, b): each anagram is determined by the positions of the a’s ( choices), then of the n’s among the remaining spots (), the b taking the last spot: anagrams (equivalently ).
Exercise 2.3 ★
A committee of people is chosen from women and men. How many committees: in total? with exactly women? with at least one man?
Solution
Solution of Exercise 2.3.
Total: . Exactly women: choose them () and men (): committees. At least one man: complement of “no man”, .
Exercise 2.4 ★
Prove that in any group of people, two share their birth month; and that among any integers chosen from , two are consecutive. (Pigeonhole both times: name the boxes.)
Solution
Solution of Exercise 2.4.
Birthdays: the boxes are the months; people into boxes force two in the same box (Corollary 2.3).
Consecutive integers: the boxes are the pairs , which partition . Choosing integers puts two in the same pair, and the two elements of a pair are consecutive.
Exercise 2.5 ★
Compute . Hint: differentiate , or use (prove it).
Solution
Solution of Exercise 2.5.
For ,
Summing and reindexing with :
by Proposition 2.15. (Alternative: differentiate and set .)
Exercise 2.6 ★★
How many strictly increasing maps are there from to ? Deduce the number of increasing (not necessarily strictly) maps. Hint for the second count: increasing .
Solution
Solution of Exercise 2.6.
A strictly increasing map is determined by its image, a -subset of (list the subset in increasing order); conversely every -subset gives exactly one such map. Hence strictly increasing maps.
If is merely increasing, set . Then is strictly increasing (between consecutive arguments, gains and gains ) with values in ; and recovers from any strictly increasing into . This is a bijection, so there are increasing maps.
Exercise 2.7 ★★
(Vandermonde) Prove, by counting -subsets of a set split into two blocks of sizes and :
Deduce .
Exercise 2.8 ★★
How many integers in are divisible by or or ? (Inclusion–exclusion; counts the multiples of , etc.)
Solution
Solution of Exercise 2.8.
Let be the multiples of in , so . Inclusion–exclusion (Theorem 2.24) with , noting etc.:
So integers are divisible by , or .
Exercise 2.9 ★★
Count the surjections from a set of elements onto a set of elements; then onto a set of elements. Hint: count the non-surjective maps with inclusion–exclusion on the missed values.
Solution
Solution of Exercise 2.9.
Onto elements: all maps except the constant maps: surjections.
Onto elements: by inclusion–exclusion on the missed values, the number of maps from a -set to a -set missing at least one value is ; total maps ; surjections: . (Check: a surjection from onto elements doubles up exactly one value: choose the doubled value (), the pair mapping to it (), and a bijection for the rest (): .)
Exercise 2.10 ★★
(Stars and bars) Prove that the number of -selections of objects with repetition, order ignored — equivalently, the number of with — is . Hint: encode a solution as a row of stars and bars.
Solution
Solution of Exercise 2.10.
A solution of in encodes as a row of stars and bars: write stars, a bar, stars, a bar, …, ending with stars. This is a bijection onto the words of length using stars and bars, and those words are determined by the positions of the stars: . Selections with repetition correspond to solutions of the equation ( = number of copies of object ), so the count is the same.
Exercise 2.11 ★★★
Prove the formula of Example 2.26 for in detail, and deduce (also prove this identity directly by classifying permutations by their fixed-point set).
Solution
Solution of Exercise 2.11.
With , a permutation in fixes every and permutes the other points freely: . Inclusion–exclusion:
since there are subsets of size . Hence
For the second identity: classify the permutations of by their fixed-point set . For a fixed -subset , the permutations with are exactly the derangements of the complement: of them. Summing over the choices of for each : .
Exercise 2.12 ★★★
For , prove by a double count of pairs (subset, marked element):
For the second: count pairs of marked elements, equal or not.
Solution
Solution of Exercise 2.12.
First identity. Count the pairs where () and . By size of : pairs. By choosing the marked element first: choices for , then any subset of the remaining elements to complete : pairs.
Second identity. Count the triples with (possibly ). By size: . Directly: either ( triples, previous count) or ( ordered choices, then any subset of the other elements: ). Total
2.6 Problem: Derangements, or the misaddressed letters
Problem 2.1
A secretary puts letters into addressed envelopes at random: what is the chance that nobody receives the right letter? This classical question (Montmort, 1708) leads to the derangement numbers of Example 2.26. The inclusion–exclusion formula is only the opening move: this problem develops the recurrences that compute , two further independent proofs of the formula, the striking theorem that is the integer nearest to , the full distribution of fixed points of a random permutation, and the curious arithmetic of the sequence . Throughout, denotes the number of derangements (fixed-point free permutations) of , with the convention (the empty permutation has no fixed point).
Part I — Small cases and the fixed-point census.
- Compute directly, and by listing the derangements of grouped by the value of . (You should find .)
- For , show that the number of permutations of with exactly fixed points is .
- Verify the census for : compute and check that they sum to . Which is more likely for four letters: no match, or exactly one match?
By double counting (Method 2.22) the pairs with , show that
on average, a random permutation has exactly one fixed point, whatever is.
Part II — Two recurrences and two new proofs of the formula.
Prove combinatorially, for :
(Classify the derangements of by , then by whether ; in the case , build a bijection with the derangements of by redirecting the preimage of to .) Check the recurrence numerically up to .
Setting , deduce from question 5 that , and conclude the second recurrence:
From question 6, prove by induction the formula of Example 2.26,
— a proof wholly independent of inclusion–exclusion.
(Binomial inversion) Let and be two sequences such that for all . Prove that
(First establish the trinomial revision , then use the alternating row sum of Example 2.17.)
- Apply question 8 to the identity of Exercise 2.11 to obtain a third proof of the formula for .
Part III — The nearest integer to . Admit for this part — the theory is built in Chapter 17 — that where , with the strict alternating-series bound for every .
- Show that for all .
- Deduce the headline theorem: for every , is the integer nearest to . Why does the argument need ?
- Determine the sign of the error: show that exactly when is even. (Locate the first neglected term of the alternating series.)
- Compute through with the recurrence of question 5, then check against (, ).
- (The hat-check probability) Let be the probability that a uniformly random permutation is a derangement. Show and compute to five decimal places. Comment: why is the answer to Montmort’s question essentially independent of — already for a dozen letters?
Part IV — The distribution of fixed points.
Fix . Show that the proportion of permutations of with exactly fixed points satisfies
(These limiting values, summing to , form the Poisson distribution of parameter , a central object of the probability course in the Year 2 volume.)
- By double counting the triples where are both fixed by , show that for . Combined with question 4: the average of is , so the “spread” (variance) of the number of fixed points equals — again independent of , again matching the Poisson law.
- Compute the proportion of permutations having at least one fixed point for (as fractions and to four decimal places), and compare with .
- Show directly — no limits needed — that , and deduce that the probabilities of question 14 oscillate: and , the even (resp. odd) values decreasing (resp. increasing) toward the common limit .
- (Secret Santa) people each draw one name from a hat; if anyone draws their own name, the whole drawing is restarted from scratch. Using the standard fact that an event of probability takes on average attempts, estimate the average number of complete drawings needed, and conclude that the procedure costs about drawings on average, essentially independently of .
Part V — The arithmetic of , and a synthesis.
- Refine question 5: show that for fixed , the derangements of with number exactly , independently of . Deduce that divides for every .
- Prove that is odd if and only if is even. (Work modulo in the recurrence of question 6.)
- Prove that for , and check the congruence on the last digit of .
- Show from question 6 that for , so the ratio of consecutive derangement numbers is almost exactly ; explain in one sentence why this is consistent with .
- Where exactly did this problem use: (i) the product and sum rules; (ii) double counting; (iii) the binomial theorem; (iv) the admitted alternating-series bound? One sentence each.
- Synthesis. The formula for now has three proofs (inclusion–exclusion, recurrence plus induction, binomial inversion). In a short paragraph, compare what each proof explains: which one computes fastest, which one generalizes to other fixed-point counts, and which one reveals why appears in a problem about envelopes.
Solution
Solution of Problem 2.1.
1. (the only permutation fixes ), (the swap), (in one-line notation: and ). For , group by : with the derangements are , , ; with : , , ; with : , , . Three in each group: .
2. A permutation with exactly fixed points is determined by the choice of its fixed-point set ( ways) together with its restriction to the complement, which must be a permutation of points with no fixed point ( ways). The two choices are independent and the correspondence is bijective: .
3. ; ; ; (three fixed points force a fourth); . Sum: . No match ( cases) beats exactly one match ( cases) — narrowly.
4. Count the pairs with . For fixed , the permutations fixing are the permutations of the other points: of them. Hence the number of pairs is , and this number is also . Dividing by the number of permutations: the average number of fixed points is exactly , for every .
5. Let be a derangement of and : possible values. Case : the points and swap, and restricted to the remaining points is an arbitrary derangement of them: possibilities. Case : let ; here and . Define on by for and . Then is a permutation of (the value has been replaced by the missing value ), and it is a derangement: , and elsewhere. Conversely, from a derangement of and the value , one recovers by setting , and elsewhere: a bijection, giving possibilities. Summing over : . Numerically: , .
6. From question 5, , so
Since , induction gives , i.e. for .
7. Induction on . Base: . Step: assuming ,
which is the formula. No inclusion–exclusion was used: only the combinatorial recurrence of question 5.
8. Trinomial revision, by factorials:
Now substitute and exchange the two finite sums:
The inner sum is the expansion of (binomial theorem, Theorem 2.16): it vanishes for and equals for . Only survives, and the right-hand side is , as claimed.
9. By the symmetry , the identity of Exercise 2.11 rewrites as . Apply question 8 with and :
reindexing by : the formula a third time.
10. (question 7), so
11. For , , and the inequality of question 10 is strict: lies at distance from , so it is the unique nearest integer. For the bound only gives distance , and indeed the claim fails there: has nearest integer , while .
12. is an alternating series with strictly decreasing terms, so its sign is the sign of its first term . Hence has the sign of : for even, and ; for odd, .
13. ; ; ; . Check: , whose nearest integer is — and , as question 12 predicts for even .
14. . For : (five decimals), against ; the gap is below . The bound collapses so fast that the probability is fixed to many decimal places already for a dozen letters: the answer “about ” is, for every practical purpose, independent of — the famous surprise of the problem.
15. By question 2 and :
as with fixed, since . The limit values () are the weights of the Poisson distribution of parameter .
16. Count the triples with , , . Choosing the ordered pair first: ways; the permutations fixing both and are the permutations of the remaining points: of them. Total: . Summing instead over first counts, for each , the ordered pairs of distinct fixed points: . Hence the stated identity; dividing by , the average of is , so the average of is and the variance is .
17. The proportions : for , ; for , ; for , . All within a percent of , oscillating around it.
18. Directly:
and the parenthesis is . For even the difference is negative: , so ; for odd it is positive: Combined with question 12 (evens above , odds below) and question 14 (distance to tends to ): the two staircases squeeze between them.
19. One complete drawing is a uniform random permutation, valid when it is a derangement: probability . By the quoted fact, the average number of drawings until success is , and question 14 gives up to an error that is negligible already for small . So a Secret Santa with restarts costs on average about complete drawings — whether the office has people or .
20. Fix and run question 5’s classification on the value . If : the remaining points carry an arbitrary derangement, ways. If : redirect the preimage to exactly as in question 5; this is a bijection with the derangements of the points : ways. Total , the same for every . Summing over the values of : , which displays the factor : .
21. Claim: is odd iff is even. Induction using , i.e. . Base: is even, odd: claim holds. If is even, is even and : odd, as claimed. If is odd, then is even, so is odd by hypothesis, and : even. The induction closes.
22. Reducing modulo kills the first term: . For : , and indeed ends in the digit .
23. For , and division of question 6’s recurrence by gives , with and rapidly tending to . Consistency: if , then — the factor cancels in the ratio, and the recurrence confirms it to accuracy .
24. (i) The product and sum rules underlie every count: questions 2 and 5 partition sets of permutations into independent stages. (ii) Double counting gave the mean (question 4) and the variance (question 16) of the number of fixed points with no formula for at all. (iii) The binomial theorem evaluated the alternating inner sum that makes binomial inversion work (question 8). (iv) The alternating-series bound converted the exact but opaque sum into the transparent statement “nearest integer to ” (questions 10–14).
25. Inclusion–exclusion (Example 2.26 and Exercise 2.11) is the conceptual proof: it explains the alternating sum as overcounting corrections, and it generalizes verbatim to counting elements avoiding any family of “bad” sets. The recurrence route (questions 5–7) computes fastest — linear time, exact integer arithmetic, no factorials — and is the source of the arithmetic facts of Part V. Binomial inversion (questions 8–9) places the formula inside a general transform that will reappear wherever two triangular systems of identities face each other. And the appearance of is best explained by the formula itself: the proportion of derangements is the partial sum of the series for , so Montmort’s envelopes were, three decades before Euler’s notation, already computing the number .