Discrete Mathematics: Counting and the Pigeonhole Principle

Foundations of Combinatorics and Basic Counting Principles

  • Combinatorics Overview:
    • Combinatorics is the branch of discrete mathematics dedicated to the study of arrangements, configurations, patterns, and selections of objects within finite or discrete systems.
    • Enumeration constitutes the fundamental core of combinatorics, focusing specifically on counting the total number of objects that satisfy defined collections of properties and constraints.
    • Practical problem models addressed by enumeration include password complexity analysis (such as determining the total number of valid passwords composed of six, seven, or eight alphanumeric characters containing at least one digit), determining sample space and event cardinalities within discrete probability theory, and evaluating the exact time complexity and computational operation counts executed by algorithms.

The Product Rule and Extended Product Rule

  • The Fundamental Product Rule:

    • If a procedure can be broken down into a sequence of two consecutive tasks, such that there are n1n_1 distinct ways to perform the first task, and for each of these choices there are n2n_2 distinct ways to perform the second task, then the total number of ways to perform the complete procedure is given by the product:     Number of ways to perform the procedure=n1n2\text{Number of ways to perform the procedure} = n_1 n_2
  • Elementary Two-Choice Examples:

    • Office Allocation: Two individuals, Sanchez and Patel, must each be assigned a distinct office out of a total of 1212 available physical offices. Assigning an office to Sanchez yields 1212 independent possibilities. Following this choice, Patel must receive a different office, leaving exactly 1111 available choices. The total number of unique office assignments is:     12⋅11=13212 \cdot 11 = 132
    • Chair Inventory Labeling: Each chair in an auditorium is assigned an identifier consisting of a single uppercase English letter followed immediately by a positive integer not exceeding 100100. There are 2626 possible uppercase English letters and 100100 allowable integers (from 11 to 100100). By the product rule, the maximum number of unique chair labels that can be generated is:     26⋅100=260026 \cdot 100 = 2600
    • Network Port Access: A computing facility houses 3232 microcomputers, and each individual microcomputer is equipped with 2424 communication ports. The task of specifying a port consists of first choosing one of the microcomputers (3232 options) and subsequently selecting one port on that chosen device (2424 options). The total number of distinct computer ports available across the center is:     32⋅24=76832 \cdot 24 = 768
  • The Extended Product Rule:

    • Suppose a composite procedure consists of performing an ordered sequence of mm distinct tasks T1,T2,…,TmT_1, T_2, \dots, T_m.
    • If each task TiT_i can be executed in nin_i ways, regardless of the individual choices made for all preceding tasks T1,T2,…,Ti−1T_1, T_2, \dots, T_{i-1}, then the total number of distinct ways to complete the entire sequence of procedures is given by the product of the individual counts:     Number of procedures=n1n2⋯nm=∏i=1mni\text{Number of procedures} = n_1 n_2 \cdots n_m = \prod_{i=1}^{m} n_i

Applications of the Product Rule

  • Bit String and Plate Encodings:

    • Length-7 Bit Strings: A bit string of length 77 consists of seven ordered positions, where each position can independently hold either a 00 or a 11 (22 choices per position). The total count of unique length-7 bit strings is:     27=1282^7 = 128
    • Standard Vehicle License Plates: A state license plate consists of three uppercase English letters followed by three numeric decimal digits (00 through 99), where repetitions of characters are permitted and no letter sequences are banned. The first three character tasks each have 2626 possibilities, and the subsequent three digit tasks each have 1010 possibilities. The total number of possible license plates is:     263⋅103=17,576⋅1,000=17,576,00026^3 \cdot 10^3 = 17{,}576 \cdot 1{,}000 = 17{,}576{,}000
  • Enumeration of Functions Between Finite Sets:

    • Total Number of Functions: Let AA be a domain set containing mm elements, and let BB be a codomain set containing nn elements. A function f:A→Bf: A \to B must assign exactly one image element in BB to each of the mm elements in AA. Since each input element can be independently mapped to any of the nn available elements in BB, the total number of distinct functions is:     nmn^m
    • Example: For a domain with m=3m = 3 elements and a codomain with n=5n = 5 elements, the total number of functions is:       53=1255^3 = 125
    • Total Number of One-to-One (Injective) Functions: A function f:A→Bf: A \to B is one-to-one if distinct elements in the domain map to distinct elements in the codomain (f(x1)=f(x2)  ⟹  x1=x2f(x_1) = f(x_2) \implies x_1 = x_2).
    • If the domain cardinality exceeds the codomain cardinality (m>nm > n), no injective functions can exist; the count is identically 00.
    • If m≤nm \le n, distinct codomain images are selected successively: the first element has nn image options, the second has n−1n - 1, the third has n−2n - 2, and in general, the kk-th input element has n−k+1n - k + 1 unused image choices. The total number of one-to-one functions is:       n(n−1)(n−2)⋯(n−m+1)n(n - 1)(n - 2) \cdots (n - m + 1)
    • Example: For m=3m = 3 domain elements and n=5n = 5 codomain elements, the number of injective functions is:       5⋅4⋅3=605 \cdot 4 \cdot 3 = 60
    • Note on Onto (Surjective) Functions: Determining the number of onto functions requires advanced combinatorial principles, such as the generalized principle of inclusion–exclusion or Stirling numbers of the second kind.
  • Telephone Numbering Systems Comparison:

    • Historical North American telephone numbering plans structure each 10-digit telephone number into a three-digit area code, a three-digit office code, and a four-digit station code.
    • Defined digit sets: X∈{0,1,2,3,4,5,6,7,8,9}X \in \{0, 1, 2, 3, 4, 5, 6, 7, 8, 9\} (1010 choices), N∈{2,3,4,5,6,7,8,9}N \in \{2, 3, 4, 5, 6, 7, 8, 9\} (88 choices), and Y∈{0,1}Y \in \{0, 1\} (22 choices).
    • Old Plan (1960s Format: NYX-NNX-XXXX):
    • Area code format NYX: 8⋅2⋅10=1608 \cdot 2 \cdot 10 = 160
    • Central office code format NNX: 8⋅8⋅10=6408 \cdot 8 \cdot 10 = 640
    • Station code format XXXX: 104=10,00010^4 = 10{,}000
    • Total unique telephone numbers:       160⋅640⋅10,000=1,024,000,000160 \cdot 640 \cdot 10{,}000 = 1{,}024{,}000{,}000
    • Later Plan (Expanded Format: NXX-NXX-XXXX):
    • Area code format NXX: 8⋅10⋅10=8008 \cdot 10 \cdot 10 = 800
    • Central office code format NXX: 8⋅10⋅10=8008 \cdot 10 \cdot 10 = 800
    • Station code format XXXX: 104=10,00010^4 = 10{,}000
    • Total unique telephone numbers:       800⋅800⋅10,000=6,400,000,000800 \cdot 800 \cdot 10{,}000 = 6{,}400{,}000{,}000
    • Model Notes: These figures represent the historical counting baseline; secondary administrative constraints (such as reserved N11 service codes like 411 or 911) are excluded from the counting model.
  • Nested Loop Complexity Analysis:

    • Consider an algorithm featuring mm deeply nested loops, where index variables i1,i2,…,imi_1, i_2, \dots, i_m step sequentially through positive integer upper bounds n1,n2,…,nmn_1, n_2, \dots, n_m:
    • Initial assignment: k := 0
    • Loop structure: for i1 := 1 to n1 do for i2 := 1 to n2 ... for im := 1 to nm do k := k + 1
    • The increment instruction executes precisely once for every unique integer mm-tuple (i1,i2,…,im)(i_1, i_2, \dots, i_m) in the Cartesian space.
    • By the extended product rule, the total number of iterations and the resulting final value of the accumulator is:     k=n1n2⋯nmk = n_1 n_2 \cdots n_m
  • Power Set Cardinality and Cartesian Products:

    • Counting Subsets of a Finite Set: Let SS be a finite set with cardinality ∣S∣|S|. Every subset T⊆ST \subseteq S corresponds uniquely to a characteristic bit string of length ∣S∣|S|, obtained by fixing an arbitrary sequence of elements in SS. The ii-th bit is defined as 11 if the ii-th element is present in TT, and 00 if it is absent. Because each of the ∣S∣|S| positions has 22 independent choices, the cardinality of the power set P(S)\mathcal{P}(S) is:     ∣P(S)∣=2∣S∣|\mathcal{P}(S)| = 2^{|S|}
    • Cartesian Product of Multiple Sets: Selecting an element from a Cartesian product A1×A2×⋯×AmA_1 \times A_2 \times \cdots \times A_m requires picking one element from each constituent finite set in order. Consequently:     ∣A1×A2×⋯×Am∣=∣A1∣⋅∣A2∣⋯∣Am∣|A_1 \times A_2 \times \cdots \times A_m| = |A_1| \cdot |A_2| \cdots |A_m|
  • Genetic and Biological Information Encoding:

    • Nucleotide Structure: DNA is composed of two anti-parallel nucleotide strands containing four nitrogenous bases: Adenine (AA), Cytosine (CC), Guanine (GG), and Thymine (TT). Canonical complementary base pairing enforces A−TA-T and C−GC-G. Single-stranded RNA replaces Thymine with Uracil (UU), producing complementary RNA pairs A−UA-U and C−GC-G.
    • Amino Acid Codon Requirements: Cellular proteins are formed from linear polypeptide chains of amino acids. Modeling the biological genetic code requires encoding 2222 distinct amino acid types using strings composed of the four-letter base alphabet:
    • A sequence of two bases generates only 42=16<224^2 = 16 < 22 unique permutations, which is insufficient to encode all amino acid types.
    • A sequence of three bases produces 43=64≥224^3 = 64 \ge 22 permutations, demonstrating that codons must consist of at least three consecutive nucleotides. Because 64>2264 > 22, the genetic code exhibits redundancy, where multiple distinct base triplets encode the same amino acid.
    • Genome Scales: A gene is a functional segment of DNA that encodes a protein; the sum total of an organism's genetic information packaged into chromosomes is its genome. The combinatorial space of potential nucleotide sequences of length LL over the four bases is 4L4^L:
    • Algae and bacteria: Genome lengths span 10510^5 to 10710^7 base positions, corresponding to at least 41054^{10^5} distinct theoretical base sequences.
    • Insects, birds, and mammals: Genome lengths span 10810^8 to 101010^{10} base positions, yielding at least 41084^{10^8} distinct sequences.
    • The human genome comprises approximately 23,00023{,}000 protein-coding genes, with each gene typically spanning 10001000 or more nucleotide base positions. The assembly, mapping, and analysis of these vast sequences rely heavily on combinatorial algorithms in bioinformatics and computational biology.

The Sum Rule and Disjoint Alternatives

  • The Fundamental Sum Rule:

    • If a task can be accomplished either by choosing one of n1n_1 ways or by choosing one of n2n_2 ways, and the set of the first n1n_1 options shares no common elements with the set of the second n2n_2 options (the options are mutually exclusive), then the total number of ways to perform the task is:     Number of ways to do the task=n1+n2\text{Number of ways to do the task} = n_1 + n_2
    • Disjointness is a strict requirement; the alternatives must have zero overlap.
  • Disjoint Selection Examples:

    • Committee Representative: A representative must be selected for a university committee who is either a member of the mathematics faculty or a declared undergraduate mathematics major. The faculty pool comprises 3737 members, while the student pool contains 8383 majors. Assuming no faculty member is simultaneously an undergraduate major, the two candidate pools are completely disjoint. The sum rule yields:     37+83=120 possible representatives37 + 83 = 120 \text{ possible representatives}
    • Project Selection: A student chooses exactly one computer science project from one of three non-overlapping project lists containing 2323, 1515, and 1919 projects, respectively. Because no project appears on more than one list, the total number of selectable projects is:     23+15+19=5723 + 15 + 19 = 57
  • The Extended Sum Rule:

    • If a task can be performed by selecting from any of mm mutually exclusive alternatives, where the ii-th alternative can be carried out in nin_i ways, and no two alternatives share a common method, the total number of possibilities is:     Number of ways to do the task=n1+n2+⋯+nm=∑i=1mni\text{Number of ways to do the task} = n_1 + n_2 + \dots + n_m = \sum_{i=1}^{m} n_i
  • Sequential Loop Complexity:

    • Consider an algorithm where mm separate, non-nested for loops execute consecutively, each updating a single shared counter variable k:
    • Initial setting: k := 0
    • Sequence: for i1 := 1 to n1 do k := k + 1; for i2 := 1 to n2 do k := k + 1; ... for im := 1 to nm do k := k + 1
    • Because each loop executes independently after the previous one finishes, each loop jj contributes exactly njn_j increments to the counter. By the sum rule, the final value of the variable is:     k=n1+n2+⋯+nmk = n_1 + n_2 + \dots + n_m
  • Set-Theoretic Formulation of the Sum Rule:

    • Let A1,A2,…,AmA_1, A_2, \dots, A_m be a collection of pairwise disjoint finite sets such that Ai∩Aj=∅A_i \cap A_j = \emptyset for all i≠ji \ne j. The cardinality of their union equals the sum of their individual cardinalities:     ∣A1∪A2∪⋯∪Am∣=∣A1∣+∣A2∣+⋯+∣Am∣|A_1 \cup A_2 \cup \cdots \cup A_m| = |A_1| + |A_2| + \cdots + |A_m|
  • If the sets are not pairwise disjoint, this equality fails, necessitating inclusion–exclusion corrections to prevent double-counting overlapping elements.

Applications of the Sum Rule and Complex System Models

  • Variable Names in BASIC:

    • In a historical implementation model of the BASIC programming language, a valid variable identifier consists of either one or two alphanumeric characters, case-insensitive (letters AA through ZZ and digits 00 through 99, giving 26+10=3626 + 10 = 36 alphanumeric characters).
    • Syntax Constraints:
    • The initial character must always be an alphabetic letter (2626 choices).
    • If a second character is present, it can be any alphanumeric character (3636 choices).
    • Exactly five specific two-character identifiers are reserved by the system language and cannot be used.
    • Calculation by Disjoint Length Classes:
    • Identifiers of length 1 (V1V_1): Must be a single letter, so V1=26V_1 = 26.
    • Identifiers of length 2 (V2V_2): Formed by one letter followed by one alphanumeric character, excluding the 5 reserved names:       V2=26⋅36−5=936−5=931V_2 = 26 \cdot 36 - 5 = 936 - 5 = 931
    • Since a variable name cannot simultaneously have length 1 and length 2, the alternatives are disjoint. The total number of valid identifiers is:       V=V1+V2=26+931=957V = V_1 + V_2 = 26 + 931 = 957
  • Password Design with Minimum Digit Constraints:

    • Determine the total number of passwords that have a length of 6, 7, or 8 characters, where each character must be an uppercase English letter (2626) or a decimal digit (1010), for a total of 3636 possible symbols, subject to the condition that every password must contain at least one digit.
    • Complementary Counting Strategy for Length kk:
    • Total unrestricted strings of length kk: 36k36^k
    • Total invalid strings containing exclusively uppercase letters: 26k26^k
    • Total valid passwords of fixed length kk:       Pk=36k−26kP_k = 36^k - 26^k
    • Evaluation per Length:
    • For k=6k = 6:       366=2,176,782,33636^6 = 2{,}176{,}782{,}336266=308,915,77626^6 = 308{,}915{,}776P6=2,176,782,336−308,915,776=1,867,866,560P_6 = 2{,}176{,}782{,}336 - 308{,}915{,}776 = 1{,}867{,}866{,}560
    • For k=7k = 7:       367=78,364,164,09636^7 = 78{,}364{,}164{,}096267=8,031,810,17626^7 = 8{,}031{,}810{,}176P7=78,364,164,096−8,031,810,176=70,332,353,920P_7 = 78{,}364{,}164{,}096 - 8{,}031{,}810{,}176 = 70{,}332{,}353{,}920
    • For k=8k = 8:       368=2,821,109,907,45636^8 = 2{,}821{,}109{,}907{,}456268=208,827,064,57626^8 = 208{,}827{,}064{,}576P8=2,821,109,907,456−208,827,064,576=2,612,282,842,880P_8 = 2{,}821{,}109{,}907{,}456 - 208{,}827{,}064{,}576 = 2{,}612{,}282{,}842{,}880
    • Total Valid Passwords (Sum Rule across disjoint lengths):P=P6+P7+P8=1,867,866,560+70,332,353,920+2,612,282,842,880=2,684,483,063,360P = P_6 + P_7 + P_8 = 1{,}867{,}866{,}560 + 70{,}332{,}353{,}920 + 2{,}612{,}282{,}842{,}880 = 2{,}684{,}483{,}063{,}360
  • Class-Based IPv4 Network Address Space:

    • An Internet Protocol version 4 (IPv4) address consists of a 32-bit binary sequence partitioned logically into a network identifier (netid) and a host identifier (hostid).
    • Modern internet routing historically evolved from class-based network architectures:
    • Class A: Assigned prefix 0, uses 7 netid bits and 24 hostid bits.
    • Class B: Assigned prefix 10, uses 14 netid bits and 16 hostid bits.
    • Class C: Assigned prefix 110, uses 21 netid bits and 8 hostid bits.
    • Class D (Multicast): Assigned prefix 1110, uses 28 multicast group bits (excluded from host enumeration).
    • Class E (Reserved): Assigned prefix 11110, uses 27 reserved experimental bits (excluded from host enumeration).
    • Contrast with IPv6, which deploys 128-bit addresses to eliminate address exhaustion.

IPv4 Address Formats in the Counting Model

  • Enumeration Model Restrictions:
    • The Class A netid consisting of all 1s (network 127, reserved for loopback) is excluded from allocation.
    • Within every class, hostid bit strings containing exclusively 0s (referencing the network itself) and exclusively 1s (reserved for local broadcast) are excluded.
  • Address Computations per Class:
    • Class A Host Addresses (xAx_A):     Available Netids=27−1=128−1=127\text{Available Netids} = 2^7 - 1 = 128 - 1 = 127Hostids per Netid=224−2=16,777,216−2=16,777,214\text{Hostids per Netid} = 2^{24} - 2 = 16{,}777{,}216 - 2 = 16{,}777{,}214xA=127⋅16,777,214=2,130,706,178x_A = 127 \cdot 16{,}777{,}214 = 2{,}130{,}706{,}178
    • Class B Host Addresses (xBx_B):     Available Netids=214=16,384\text{Available Netids} = 2^{14} = 16{,}384Hostids per Netid=216−2=65,536−2=65,534\text{Hostids per Netid} = 2^{16} - 2 = 65{,}536 - 2 = 65{,}534xB=16,384⋅65,534=1,073,709,056x_B = 16{,}384 \cdot 65{,}534 = 1{,}073{,}709{,}056
    • Class C Host Addresses (xCx_C):     Available Netids=221=2,097,152\text{Available Netids} = 2^{21} = 2{,}097{,}152Hostids per Netid=28−2=256−2=254\text{Hostids per Netid} = 2^8 - 2 = 256 - 2 = 254xC=2,097,152⋅254=532,676,608x_C = 2{,}097{,}152 \cdot 254 = 532{,}676{,}608
  • Aggregate Usable Host Addresses:x=xA+xB+xC=2,130,706,178+1,073,709,056+532,676,608=3,737,091,842x = x_A + x_B + x_C = 2{,}130{,}706{,}178 + 1{,}073{,}709{,}056 + 532{,}676{,}608 = 3{,}737{,}091{,}842

The Subtraction Rule and Principle of Inclusion–Exclusion

  • The Subtraction Rule:

    • When a counting task can be satisfied by actions from either of two sets that are not mutually exclusive, simply summing their sizes counts elements in their intersection twice.
    • The subtraction rule corrects for this double-counting by subtracting the size of the shared intersection. For finite sets A1A_1 and A2A_2:     ∣A1∪A2∣=∣A1∣+∣A2∣−∣A1∩A2∣|A_1 \cup A_2| = |A_1| + |A_2| - |A_1 \cap A_2|
    • This relation represents the principle of inclusion–exclusion applied to two sets, which generalizes to larger collections of sets.
  • Applications of the Subtraction Rule:

    • Bit Strings with Affix Constraints: Count the number of 8-bit strings that either begin with the digit 11 or end with the two digits 0000.
    • Let AA be the set of 8-bit strings beginning with 11. Fixing the first bit leaves 77 free bits: ∣A∣=27=128|A| = 2^7 = 128.
    • Let BB be the set of 8-bit strings ending in 0000. Fixing the final two bits leaves 66 free bits: ∣B∣=26=64|B| = 2^6 = 64.
    • The intersection A∩BA \cap B contains strings that both begin with 11 and end with 0000. This fixes three bits (1xxxx001xxxx00), leaving 8−3=58 - 3 = 5 free bits: ∣A∩B∣=25=32|A \cap B| = 2^5 = 32.
    • Applying the subtraction rule:       ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣=128+64−32=160|A \cup B| = |A| + |B| - |A \cap B| = 128 + 64 - 32 = 160
    • Applicant Major Exclusions: A corporate hiring pool contains 350350 applicants. Among them, 220220 majored in computer science, 147147 majored in business, and 5151 held joint majors in both fields. To find the number of applicants who majored in neither discipline:
    • First compute the total number of applicants majoring in at least one of these areas:       ∣A∪B∣=220+147−51=316|A \cup B| = 220 + 147 - 51 = 316
    • Subtract this union from the total applicant pool:       Neither Major=350−316=34\text{Neither Major} = 350 - 316 = 34

The Division Rule and Equivalence Classes

  • The Division Rule:

    • If a finite task or set has nn operational descriptions or representations, and exactly dd (d>0d > 0) of these descriptions correspond to each distinct outcome, then the total number of uniquely distinct outcomes is:     Number of distinct outcomes=nd\text{Number of distinct outcomes} = \frac{n}{d}
    • Set Form: If a finite set AA is partitioned into disjoint equivalence classes or subsets, where every subset contains exactly dd elements, then the number of subsets nn is given by:     n=∣A∣dn = \frac{|A|}{d}
    • Function Form: Let f:A→Bf: A \to B be a function mapping between finite sets. If every element y∈By \in B has exactly dd distinct preimages in AA (that is, ff is a dd-to-one mapping), then the cardinality of the codomain is:     ∣B∣=∣A∣d|B| = \frac{|A|}{d}
  • Circular Seating Permutations:

    • Determine how many distinct circular seating arrangements exist for four individuals seated around a round table, where two arrangements are declared identical if and only if each person has the exact same left neighbor and right neighbor.
    • First consider the four seats as distinct, labeled locations arranged clockwise. The number of linear permutations for four people in these labeled chairs is:     4!=4⋅3⋅2⋅1=244! = 4 \cdot 3 \cdot 2 \cdot 1 = 24
    • Because the table is circular, shifting every person simultaneously by one, two, or three seats clockwise does not alter anyone's relative neighbors. Each distinct circular arrangement is counted exactly 44 times among the labeled assignments (corresponding to the 44 choices of who sits in the first labeled chair).
    • By the division rule, the number of distinct circular seating arrangements is:     244=6\frac{24}{4} = 6
    • Reflectional symmetries are not considered identical here, because flipping the table reverses each person's left and right neighbors, meaning mirrored configurations remain distinct.

Tree Diagrams in Sequential Decision Processes

  • Structure of Tree Diagrams:

    • A tree diagram provides a visual representation of multi-step decision processes.
    • The tree begins at an initial root node, and directed branches extend outward to represent available choices at each stage.
    • Terminal nodes with no outgoing branches are called leaves, and each leaf represents a unique, fully realized final outcome.
    • Tree diagrams are particularly useful when the number of choices available in subsequent stages depends on the specific decisions made in earlier stages.
  • Four-Bit Strings with No Consecutive Ones:

    • Construct all 4-bit strings that contain no adjacent 11s (the sequence 1111 is prohibited).
    • Branching Rules: From the root, the initial bit may be either 00 or 11. Following a 00, branching allows either 00 or 11. Following a 11, the next bit must be 00.
    • Following all valid branches down to depth four produces exactly 8 leaves:     0000,0001,0010,0100,0101,1000,1001,10100000, 0001, 0010, 0100, 0101, 1000, 1001, 1010

Tree Diagram for Bit Strings Without Consecutive Ones

  • Tournament Series (Best-of-Five Playoff):
    • Two athletic teams compete in a playoff series that terminates as soon as one team wins three games.
    • Every branch in the decision tree represents a game outcome (a win for Team 1 or Team 2). Any path stops as soon as either team accumulates three total victories.
    • The series can terminate in 3, 4, or 5 games. Summing all valid terminal leaves on the tree yields exactly 20 distinct possible playoff sequences.

Tree Diagram for Best-of-Five Playoff

  • Apparel Inventory Configuration:
    • A souvenir retailer stocks "I Love New Jersey" T-shirts in five standard sizes: Small (S), Medium (M), Large (L), Extra Large (XL), and Double Extra Large (XXL).
    • The available colors depend on the size:
    • Sizes S, M, and L each come in four colors: White (W), Red (R), Green (G), and Black (B).
    • Size XL comes in three colors: Red (R), Green (G), and Black (B).
    • Size XXL comes in two colors: Green (G) and Black (B).
    • Counting the leaves of the corresponding decision tree, or summing the colors across sizes, gives the total number of distinct shirts needed to stock every variety:     4+4+4+3+2=174 + 4 + 4 + 3 + 2 = 17

Tree Diagram for T-Shirt Sizes and Colors

The Pigeonhole Principle (Dirichlet Drawer Principle)

  • Basic Formulation:
    • If 2020 pigeons fly into 1919 pigeonholes, at least one pigeonhole must contain two or more pigeons. If every pigeonhole contained at most one pigeon, the maximum number of pigeons that could be accommodated would be 1919, contradicting the fact that 20>1920 > 19.

Pigeonhole Principle Demonstration

  • Theorem 1 (The Pigeonhole Principle):

    • Let kk be a positive integer. If k+1k + 1 or more objects are placed into kk boxes, then at least one box must contain two or more objects.
    • Proof by Contradiction: Suppose every one of the kk boxes contains at most one object. Summing across all boxes, the total number of objects cannot exceed k⋅1=kk \cdot 1 = k. This directly contradicts the hypothesis that there are at least k+1k + 1 objects present.
    • Historical Nomenclature: This principle is also known as the Dirichlet drawer principle (Schubfachprinzip), named after the mathematician Peter Gustav Lejeune Dirichlet, who used it extensively. Earlier formulations include a 17th-century argument regarding residents of Paris sharing identical hair counts.
  • Biographical Profile: G. Lejeune Dirichlet (1805–1859):

    • Dirichlet was born into a family of Belgian descent near Cologne, where his father served as a local postmaster.
    • He showed early mathematical ability, using his allowance to purchase mathematics books. He entered secondary school in Bonn at age 12, attended the Jesuit College in Cologne at 14, and began advanced studies in Paris at 16.
    • Dirichlet held academic appointments in Breslau (from 1825) and Berlin (from 1828), before succeeding Carl Friedrich Gauss at the University of Göttingen in 1855.
    • He was known for carrying and studying Gauss's Disquisitiones Arithmeticae throughout his travels. His major mathematical contributions include the theorem proving the existence of infinitely many primes in arithmetic progressions a+nda + nd where gcd⁡(a,d)=1\gcd(a, d) = 1, resolving the n=5n = 5 case of Fermat's Last Theorem, and laying foundations in mathematical analysis. He was praised for the clarity of his teaching and was married to Rebecca Mendelssohn.

Portrait of G. Lejeune Dirichlet

  • Corollary 1 (Mapping Cardinalities):

    • A function ff mapping from a domain set containing k+1k + 1 or more elements into a codomain set containing kk elements cannot be one-to-one.
    • Proof: Let f:A→Bf: A \to B such that ∣A∣≥k+1|A| \ge k + 1 and ∣B∣=k|B| = k. For each element y∈By \in B, define a box By={x∈A∣f(x)=y}B_y = \{x \in A \mid f(x) = y\}. The collection of these kk boxes forms a partition of AA. Since ∣A∣≥k+1|A| \ge k + 1, the pigeonhole principle guarantees that at least one box contains at least two distinct domain elements x1,x2∈Ax_1, x_2 \in A with x1≠x2x_1 \ne x_2. Because f(x1)=f(x2)=yf(x_1) = f(x_2) = y, the function ff is not injective.
  • Elementary Examples:

    • Shared Birthdays: A group of 367367 people must contain at least two individuals who share a birthday. There are at most 366366 possible birthdays in a leap year (including February 29), so treating the dates as boxes and the people as objects forces at least one duplicate.
    • Initial Letters: Among any selection of 2727 English words, at least two must begin with the same letter, since the English alphabet contains only 2626 initial letters.
    • Exam Scores: If an examination is scored using integer grades ranging from 00 through 100100, there are 100−0+1=101100 - 0 + 1 = 101 possible distinct scores. Therefore, a class must contain at least 101+1=102101 + 1 = 102 students to guarantee that at least two students achieve identical scores.
  • Decimal Multiples Composed Exclusively of Digits 0 and 1:

    • Claim: Every positive integer nn possesses a non-zero multiple whose decimal expansion contains only the digits 00 and 11.
    • Proof for n>0n > 0:
    • Construct a list of n+1n + 1 integers composed solely of the digit 1:       1,11,111,…,11…1⏟n+1 digits1, 11, 111, \dots, \underbrace{11\dots1}_{n+1 \text{ digits}}
    • Under modular division by nn, there are only nn possible remainder values: {0, 1, 2, \dots, n - 1}.
    • Since there are n+1n + 1 numbers and only nn possible remainders, the pigeonhole principle guarantees that at least two of these numbers must share the exact same remainder modulo nn:       a≡b(modn)with a>ba \equiv b \pmod{n} \quad \text{with } a > b
    • Subtracting the smaller number from the larger number leaves an integer that is an exact positive multiple of nn. Its decimal form consists of one or more 1s followed by one or more 0s:       a−b=11…1⏟≥100…0⏟≥1a - b = \underbrace{11\dots1}_{\ge 1} \underbrace{00\dots0}_{\ge 1}
    • For negative integers (n<0n < 0), the multiple obtained for ∣n∣|n| satisfies the condition. For n=0n = 0, the multiple 00 satisfies the condition.

The Generalized Pigeonhole Principle

  • Theorem 2 (The Generalized Pigeonhole Principle):

    • If NN objects are placed into kk boxes, where NN and kk are positive integers, then at least one box must contain at least:     ⌈Nk⌉ objects\left\lceil \frac{N}{k} \right\rceil \text{ objects}
    • Proof by Contradiction: Suppose every box contains at most ⌈N/k⌉−1\lceil N/k \rceil - 1 objects. The total number of objects in all kk boxes combined would then satisfy:     Total objects≤k(⌈Nk⌉−1)<k((Nk+1)−1)=k(Nk)=N\text{Total objects} \le k \left( \left\lceil \frac{N}{k} \right\rceil - 1 \right) < k \left( \left( \frac{N}{k} + 1 \right) - 1 \right) = k \left( \frac{N}{k} \right) = N
    • (This uses the standard ceiling property ⌈x⌉<x+1\lceil x \rceil < x + 1\,).
    • The total number of objects would be strictly less than NN, contradicting the fact that there are NN objects in total.
  • Minimum Elements Required to Guarantee a Target Box Size:

    • To guarantee that at least one box contains at least rr objects when distributed among kk available boxes, the total number of objects NN must satisfy:     ⌈Nk⌉≥r\left\lceil \frac{N}{k} \right\rceil \ge r
    • The minimum integer NN that guarantees this threshold is:     N=k(r−1)+1N = k(r - 1) + 1
    • Proof of Minimality: If only k(r−1)k(r - 1) objects are distributed, exactly r−1r - 1 objects can be placed into each of the kk boxes, leaving every box with fewer than rr objects. Adding one more object (k(r−1)+1k(r - 1) + 1) must place an object into a box that already holds r−1r - 1, bringing its total to rr.
  • Standard Examples of the Generalized Principle:

    • Birth Months: Among any group of 100100 individuals, the number who share a birth month is at least:     ⌈10012⌉=9\left\lceil \frac{100}{12} \right\rceil = 9
    • Grade Distribution Guarantees: Given the set of five standard letter grades {A, B, C, D, F} (k=5k = 5), find the minimum class size needed to guarantee that at least six students receive the same letter grade (r=6r = 6):     N=5(6−1)+1=5(5)+1=26N = 5(6 - 1) + 1 = 5(5) + 1 = 26
    • A class of 2525 students could have exactly five students for each of the five grades, failing the requirement.
    • Card Drawing from a Standard Deck: A standard deck contains 5252 cards divided equally into four suits (hearts, diamonds, clubs, spades) of 1313 cards each.
    • To guarantee drawing at least three cards of the same suit (any suit), treat the four suits as boxes (k=4,r=3k = 4, r = 3):       N=4(3−1)+1=4(2)+1=9 cardsN = 4(3 - 1) + 1 = 4(2) + 1 = 9 \text{ cards}
      • A hand of 88 cards could consist of exactly two cards of each suit.
    • To guarantee drawing at least three cards of a specified suit (such as hearts), the pigeonhole principle does not apply directly. An adversary could select all 3939 non-heart cards first. The next 33 cards drawn must then be hearts:       39+3=42 cards39 + 3 = 42 \text{ cards}
    • Area Code Capacity for Telephony: A growing region needs to allocate distinct phone numbers for 2525 million subscribers using the NXX-NXX-XXXX plan, where a single area code provides capacity for 8⋅106=8,000,0008 \cdot 10^6 = 8{,}000{,}000 local numbers. The number of area codes needed is:     ⌈25,000,0008,000,000⌉=⌈3.125⌉=4 area codes\left\lceil \frac{25{,}000{,}000}{8{,}000{,}000} \right\rceil = \lceil 3.125 \rceil = 4 \text{ area codes}
    • Four area codes provide total capacity for 32,000,00032{,}000{,}000 numbers, which is sufficient.

Advanced Applications of the Pigeonhole Principle

  • Workstation-to-Server Bipartite Interconnections:

    • A computing laboratory contains 1515 workstations (W1,…,W15W_1, \dots, W_{15}) and 1010 centralized servers (S1,…,S10S_1, \dots, S_{10}). Each server can support only one active direct link at a time. The goal is to install direct cables between workstations and servers such that any arbitrary subset of at most 1010 workstations can simultaneously connect to distinct servers.
    • A Working Configuration of 60 Cables:
    • Connect workstation WjW_j directly to server SjS_j for 1≤j≤101 \le j \le 10 (1010 cables).
    • Connect each of the remaining five workstations (W11,W12,W13,W14,W15W_{11}, W_{12}, W_{13}, W_{14}, W_{15}) to all 1010 servers (5⋅10=505 \cdot 10 = 50 cables).
    • Total cables installed: 10+50=6010 + 50 = 60.
    • Verification: Suppose a set of k≤10k \le 10 workstations is active. Let k1k_1 of them be from {W_1, \dots, W_{10}} and k2k_2 from {W_{11}, \dots, W_{15}}, with k1+k2≤10k_1 + k_2 \le 10. Each of the k1k_1 workstations uses its dedicated server. This leaves 10−k110 - k_1 servers completely free. Since k1+k2≤10k_1 + k_2 \le 10, we have 10−k1≥k210 - k_1 \ge k_2. The k2k_2 remaining workstations are connected to all servers, so they can freely take any k2k_2 of the available free servers.
    • Proof that 59 Cables are Insufficient:
    • Suppose fewer than 6060 cables are used (at most 5959 cables).
    • The average number of cables connected to a server is at most 5910=5.9\frac{59}{10} = 5.9.
    • By the generalized pigeonhole principle, at least one server must be connected to at most ⌊59/10⌋=5\lfloor 59/10 \rfloor = 5 workstations.
    • This means there are at least 15−5=1015 - 5 = 10 workstations that have no direct cable connection to this particular server.
    • If these specific 1010 workstations are active simultaneously, none of them can use that server. They must therefore share the remaining 99 servers. By the pigeonhole principle, 1010 workstations cannot simultaneously connect to 99 servers.
    • Therefore, 6060 is the absolute minimum number of cables required.
  • Consecutive Game Sequences in Athletics:

    • A baseball team plays at least one game every day over a 3030-day month, playing at most 4545 total games. Prove that there must exist a sequence of consecutive days during which the team plays exactly 1414 games.
    • Proof:
    • Let aja_j denote the cumulative number of games played from the start of the month through day jj, where 1≤j≤301 \le j \le 30.
    • Since the team plays at least one game each day, the sequence of cumulative totals is strictly increasing:       1≤a1<a2<a3<⋯<a30≤451 \le a_1 < a_2 < a_3 < \dots < a_{30} \le 45
    • Add 1414 to each term to generate a second strictly increasing sequence:       15≤a1+14<a2+14<⋯<a30+14≤45+14=5915 \le a_1 + 14 < a_2 + 14 < \dots < a_{30} + 14 \le 45 + 14 = 59
    • Now combine both sequences into a single collection of 30+30=6030 + 30 = 60 positive integers:       a1,a2,…,a30,a1+14,a2+14,…,a30+14a_1, a_2, \dots, a_{30}, a_1 + 14, a_2 + 14, \dots, a_{30} + 14
    • Every one of these 6060 integers lies within the range between 11 and 5959 inclusive.
    • By the pigeonhole principle, placing 6060 integers into 5959 possible values means at least two integers in the list must be equal.
    • Because the terms within the first list are strictly increasing, no two elements of the first list can be equal. For the same reason, no two elements of the second list can be equal.
    • Therefore, an element from the first list must equal an element from the second list:       ai=aj+14for some i>ja_i = a_j + 14 \quad \text{for some } i > j
    • Rewriting gives:       ai−aj=14a_i - a_j = 14
    • This means that exactly 1414 games were played during the consecutive period from day j+1j + 1 through day ii.
  • Divisibility Within Constrained Integer Sets:

    • Let nn be a positive integer. Prove that among any collection of n+1n + 1 positive integers none of which exceed 2n2n, there must exist at least one pair where one integer divides the other.
    • Proof:
    • By the fundamental theorem of arithmetic, any positive integer aja_j can be factored uniquely into a non-negative power of two multiplied by an odd integer:       aj=2kjqjwhere kj≥0 and qj is odda_j = 2^{k_j} q_j \quad \text{where } k_j \ge 0 \text{ and } q_j \text{ is odd}
    • Since each integer satisfies 1≤aj≤2n1 \le a_j \le 2n, each odd part qjq_j must be an odd positive integer strictly less than 2n2n.
    • The set of odd positive integers less than 2n2n is:       {1,3,5,…,2n−1}\{1, 3, 5, \dots, 2n - 1\}       This set contains exactly nn elements.
    • We have n+1n + 1 integers a1,a2,…,an+1a_1, a_2, \dots, a_{n+1}, but only nn possible odd parts.
    • By the pigeonhole principle, at least two of the chosen integers, say aia_i and aja_j (i≠ji \ne j), must have the exact same odd part qq:       ai=2kiqandaj=2kjqa_i = 2^{k_i} q \quad \text{and} \quad a_j = 2^{k_j} q
  • If ki≤kjk_i \le k_j, then aj=2kj−kiaia_j = 2^{k_j - k_i} a_i, which means ai∣aja_i \mid a_j.

  • If ki>kjk_i > k_j, then ai=2ki−kjaja_i = 2^{k_i - k_j} a_j, which means aj∣aia_j \mid a_i.

  • In either case, one integer divides the other.

Monotonic Subsequences and the Erdős–Szekeres Result

  • Definitions of Subsequences and Monotonicity:

    • Subsequence: For a given sequence of real numbers a1,a2,…,aNa_1, a_2, \dots, a_N, a subsequence is an ordered selection of terms:     ai1,ai2,…,aimwith 1≤i1<i2<⋯<im≤Na_{i_1}, a_{i_2}, \dots, a_{i_m} \quad \text{with } 1 \le i_1 < i_2 < \dots < i_m \le N     The selected terms maintain their original relative order from the parent sequence.
    • Strictly Increasing: A sequence is strictly increasing if each term is strictly greater than the one before it (aik<aik+1a_{i_k} < a_{i_{k+1}}).
    • Strictly Decreasing: A sequence is strictly decreasing if each term is strictly smaller than the one before it (aik>aik+1a_{i_k} > a_{i_{k+1}}).
  • Theorem 3 (Erdős–Szekeres Monotonic Subsequence Theorem):

    • Let nn be a positive integer. Every sequence of n2+1n^2 + 1 distinct real numbers must contain a subsequence of length n+1n + 1 that is either strictly increasing or strictly decreasing.
  • Worked Example (n=3n = 3):

    • Consider the sequence of 1010 terms (10=32+110 = 3^2 + 1, so n=3n = 3 and n+1=4n + 1 = 4):     8,11,9,1,4,6,12,10,5,78, 11, 9, 1, 4, 6, 12, 10, 5, 7
    • Theorem 3 guarantees the existence of a monotonic subsequence of length at least 44.
    • The strictly increasing subsequences of length 4 are:
    • 1,4,6,121, 4, 6, 12
    • 1,4,6,71, 4, 6, 7
    • 1,4,6,101, 4, 6, 10
    • 1,4,5,71, 4, 5, 7
    • A strictly decreasing subsequence of length 4 is:
    • 11,9,6,511, 9, 6, 5
  • Proof of the Monotonic Subsequence Theorem:

    • Let the sequence of n2+1n^2 + 1 distinct real numbers be denoted by a1,a2,…,an2+1a_1, a_2, \dots, a_{n^2+1}.
    • For each term aka_k, define an ordered pair of positive integers (ik,dk)(i_k, d_k), where:
    • iki_k is the length of the longest strictly increasing subsequence starting at aka_k.
    • dkd_k is the length of the longest strictly decreasing subsequence starting at aka_k.
    • Contradiction Assumption: Assume that the sequence contains no strictly increasing or strictly decreasing subsequence of length n+1n + 1.
    • Under this assumption, for every index kk, both iki_k and dkd_k must be integers between 11 and nn:     ik∈{1,2,…,n}anddk∈{1,2,…,n}i_k \in \{1, 2, \dots, n\} \quad \text{and} \quad d_k \in \{1, 2, \dots, n\}
    • The set of all possible ordered pairs (ik,dk)(i_k, d_k) has size n⋅n=n2n \cdot n = n^2.
    • There are n2+1n^2 + 1 terms in the sequence, so there are n2+1n^2 + 1 ordered pairs.
    • By the pigeonhole principle, at least two terms in the sequence must be assigned the exact same ordered pair. That is, there must exist indices s<ts < t such that:     is=itandds=dti_s = i_t \quad \text{and} \quad d_s = d_t
    • Because all terms in the sequence are distinct, we must have either as<ata_s < a_t or as>ata_s > a_t:
    • Case 1 (as<ata_s < a_t): Take the longest strictly increasing subsequence starting at ata_t (which has length iti_t). Prepending asa_s to the front of this subsequence produces a valid strictly increasing subsequence starting at asa_s of length it+1i_t + 1. Therefore, is≥it+1i_s \ge i_t + 1, which contradicts is=iti_s = i_t.
    • Case 2 (as>ata_s > a_t): Take the longest strictly decreasing subsequence starting at ata_t (which has length dtd_t). Prepending asa_s to the front of this subsequence produces a valid strictly decreasing subsequence starting at asa_s of length dt+1d_t + 1. Therefore, ds≥dt+1d_s \ge d_t + 1, which contradicts ds=dtd_s = d_t.
    • Both cases lead to a contradiction. Thus, the assumption is false, and there must exist at least one strictly increasing or strictly decreasing subsequence of length n+1n + 1.

Ramsey Theory and Ramsey Numbers

  • Foundational Problem (Party of Six):

    • Ramsey theory studies the emergence of regular patterns within sufficiently large mathematical systems. A classic problem examines a party of six people, where every pair consists of either mutual friends or mutual enemies.
    • Claim: Any group of six people must contain either three mutual friends or three mutual enemies.
    • Proof:
    • Select an arbitrary person from the group, denoted AA.
    • The remaining five people are partitioned into two sets: friends of AA and enemies of AA.
    • By the generalized pigeonhole principle, dividing 55 people into 22 categories means at least one category must contain at least:       ⌈52⌉=3 people\left\lceil \frac{5}{2} \right\rceil = 3 \text{ people}
    • Thus, AA must have at least three friends, or at least three enemies.
    • Case 1 (At least three friends): Let three of AA's friends be denoted BB, CC, and DD.
      • If any pair among {B, C, D} are friends with each other (say, BB and CC), then {A, B, C} forms a set of three mutual friends.
      • If no two people among {B, C, D} are friends, then {B, C, D} must all be enemies with each other, forming a set of three mutual enemies.
    • Case 2 (At least three enemies): Let three of AA's enemies be denoted BB, CC, and DD.
      • If any pair among {B, C, D} are enemies with each other (say, BB and CC), then {A, B, C} forms a set of three mutual enemies.
      • If no two people among {B, C, D} are enemies, then {B, C, D} must all be friends with each other, forming a set of three mutual friends.
    • In all cases, the group must contain a triple of mutual friends or a triple of mutual enemies.
  • Ramsey Numbers Definition:

    • For integers m,n≥2m, n \ge 2, the Ramsey number R(m,n)R(m, n) is defined as the minimum number of people at a gathering required to guarantee that there are either mm mutual friends or nn mutual enemies, under the assumption that every pair of people consists of either friends or enemies.
    • In graph-theoretic terms, R(m,n)R(m, n) is the minimum number of vertices VV such that every edge 2-coloring (e.g., blue for friends, red for enemies) of the complete graph KVK_V must contain either a monochromatic blue clique KmK_m or a monochromatic red clique KnK_n.
  • Exact Value of R(3,3)R(3, 3):

    • The party problem above establishes the upper bound:     R(3,3)≤6R(3, 3) \le 6
    • A group of five people can avoid having three mutual friends or three mutual enemies. Arrange the five people in a circle where each person is friends only with their two immediate neighbors, and enemies with the two people not adjacent to them. In this arrangement, there are no three mutual friends (the friendship graph has no triangles) and no three mutual enemies (the enemy graph also has no triangles). This configuration shows:     R(3,3)>5R(3, 3) > 5
    • Combining these bounds gives the exact value:     R(3,3)=6R(3, 3) = 6
  • Biographical Profile: Frank Plumpton Ramsey (1903–1930):

    • Ramsey was the son of the president of Magdalene College, Cambridge.
    • He studied at Winchester College and Trinity College, Cambridge. After graduating in 1923, he was elected a fellow of King's College, Cambridge, where he spent his academic career.
    • His seminal 1930 paper, On a Problem of Formal Logic, introduced the combinatorial theorems that founded Ramsey theory.
    • Beyond combinatorics, Ramsey made significant contributions to mathematical logic, philosophical foundations of mathematics, and theoretical economics (including seminal models of taxation and capital accumulation). He was married, had two daughters, and was active in English literature and politics. He died at the age of 26 from chronic liver disease.

Portrait of Frank Plumpton Ramsey

  • General Properties of Ramsey Numbers:

    • Symmetry: For all integers m,n≥2m, n \ge 2, swapping the roles of friends and enemies shows that:     R(m,n)=R(n,m)R(m, n) = R(n, m)
    • Base Boundary Condition (m=2m = 2): For every integer n≥2n \ge 2, we have:     R(2,n)=nR(2, n) = n
    • Reasoning: In a group of nn people, either at least one pair is friendly (giving 22 mutual friends), or no pair is friendly, which means all nn people are mutual enemies.
  • Historical and Computational Values:

    • Computing exact Ramsey numbers is notoriously difficult due to the super-exponential growth of combinatorial configurations.
    • Only nine exact non-trivial Ramsey numbers R(m,n)R(m, n) with 3≤m≤n3 \le m \le n are known.
    • Known exact values include:     R(4,4)=18R(4, 4) = 18
    • For R(5,5)R(5, 5), the exact value remains unknown; the known theoretical bounds are:     43≤R(5,5)≤4943 \le R(5, 5) \le 49
    • Most other combinations of parameters are known only in terms of broad upper and lower bounds.