Chap 6: Counting
约 982 个字 1 张图片 预计阅读时间 5 分钟
1. Basic Counting Principles
Let \(m\) be the number of ways to do task 1 and \(n\) the number of ways to do task 2.
1.1 Sum Rule
The task “do either task 1 or task 2, but not both” can be done in \(m+n\) ways.
In set notation, if \(A\) and \(B\) are disjoint sets of outcomes, then
1.2 Product Rule
The task “do both task 1 and task 2” can be done in \(mn\) ways.
In set notation, if \(A\) and \(B\) are disjoint sets of outcomes, then
1.3 Subtraction Rule
If two cases overlap, simply adding their sizes counts the intersection twice. For finite sets \(A\) and \(B\),
This is the subtraction rule, or inclusion-exclusion.
Counting Bit Strings
How many bit strings of length \(8\) either begin with \(1\) or end with \(00\)?
Let \(A\) be the set of strings beginning with \(1\) and \(B\) the set of strings ending with \(00\). Then
Therefore,
1.4 Division Rule
If a counting procedure produces \(N\) representations, and every actual outcome is represented exactly \(d\) times. Then the number of distinct outcomes is
Circular Permutations
There are \(n!\) ways to place \(n\) distinct people in numbered seats around a table. If rotations are considered identical, each circular arrangement is counted \(n\) times, once for each choice of the person in the first seat. Hence, the number of circular arrangements is
2. Pigeonhole Principle
The pigeonhole principle, also called the Dirichlet drawer principle, states that if at least \(k+1\) objects are placed into \(k\) boxes, then at least one box contains at least two objects.
In terms of functions: if \(f:A\rightarrow B\) and \(|A|>|B|\), then \(f\) cannot be one-to-one. Some element of \(B\) must have at least two preimages.
Generalized: If \(N\) objects are placed into \(k\) boxes, then at least one box contains at least
objects.
A Remainder Application
Among any \(n+1\) integers, two have the same remainder modulo \(n\).
3. Permutations and Combinations
Selection problems: select \(r\) elements from \(n\) elements.
Most elementary selection problems can be classified by two questions:
- Does order matter?
- Yes: Permutation
- No: Combination
- Is repetition allowed?
3.1 Permutations without Repetition
A permutation of a set is an ordered arrangement of all its elements. An \(r\)-permutation of a set with \(n\) distinct elements is an ordered arrangement of \(r\) distinct elements.
The first position has \(n\) choices, the second has \(n-1\) choices, and so on. Therefore,
In particular,
3.2 Combinations without Repetition
An \(r\)-combination of a set \(S\) is an \(r\)-element subset of \(S\). Because order does not matter, every selected group of \(r\) elements corresponds to \(r!\) different \(r\)-permutations. By the division rule,
!!! info+ "Useful Identities"
Choosing the \(r\) selected elements is equivalent to choosing the \(n-r\) unselected elements, so
Pascal's identity: fix a particular element \(x\). An \(r\)-element subset either
- excludes \(x\), giving \(\displaystyle\binom{n-1}{r}\) choices
- includes \(x\), leaving \(\displaystyle\binom{n-1}{r-1}\) choices
so
3.3 Permutations with Repetition
If each of \(r\) ordered positions can be filled independently with any of \(n\) elements, then repetition is allowed and the product rule gives
3.4 Combinations with Repetition
An \(r\)-combination with repetition selects \(r\) objects from \(n\) types when order does not matter and each type may be selected more than once. The number of such selections is
This formula follows from the stars and bars representation. Use \(r\) stars for the selected objects and \(n-1\) bars to divide them into \(n\) types. Every selection corresponds to one arrangement of the \(r\) stars and \(n-1\) bars.
Nonnegative Integer Solutions
The number of nonnegative integer solutions of
is the number of ways to distribute \(11\) identical objects among three labeled boxes. There are \(11\) stars and \(2\) bars, so the answer is
To count solutions subject to lower bounds, remove the required minimum first. If
let
Then \(y_1,y_2,y_3\geq0\) and
Therefore, the number of solutions is
4. Generalized Counting Patterns
4.1 Permutations of Indistinguishable Objects
Suppose \(n\) objects consist of \(n_1\) identical objects of type \(1\), \(n_2\) identical objects of type \(2\), and so on, where
The number of distinct permutations is the multinomial coefficient
Rearranging SUCCESS
SUCCESS has seven letters: three S characters, two C characters, one U, and one E. Hence, the number of distinct strings is
4.2 Distributing Objects into Boxes
Many counting problems can be interpreted as distributing objects into boxes. Always determine whether the objects and boxes are distinguishable.
Common Distribution Models
Distinct objects into distinct boxes, unrestricted: each of \(r\) objects independently chooses one of \(n\) boxes, giving \(n^r\) distributions.
Distinct objects into distinct boxes with fixed occupancies: if box \(i\) must contain \(r_i\) objects and \(r_1+\cdots+r_n=r\), the number of distributions is
Identical objects into distinct boxes, unrestricted: distributing \(r\) identical objects among \(n\) labeled boxes is equivalent to an \(r\)-combination with repetition, giving
Problems with unlabeled boxes require different tools and are not covered by these formulas directly.
