1. Home
  2. Explore
  3. Mathematics
  4. Introduction to Sets

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Introduction to Sets

Combinatorics: A Comprehensive Study Guide

Sets: The Foundation of Organization

In mathematics, a set is a collection of distinct objects, called elements, grouped together. Sets are fundamental to understanding how items are organized. A set is often compared to a bag: the bag is the set, and the items inside are the elements.

Key characteristics of sets:

  • Orderless – The order of elements does not matter. For example, {1, 2, 3} is the same as {3, 1, 2}.

  • Unbounded – A set can have any number of elements, even infinitely many.

  • Distinct – No duplicates are allowed. A set either contains an element or it does not; repetition is irrelevant.

  • Well-defined – It must be clear exactly which elements belong and which do not. A set of "tall people" is vague, but a set of "people over 6 ft" is well-defined.

Sets provide the building blocks for more advanced combinatorial ideas.

Basic Counting Principles: Sum and Product Rules

The product rule and sum rule are the simplest counting tools.

  • Product rule (AND): If a task consists of two independent sequential choices, and there are mmm ways for the first and nnn ways for the second, then there are m×nm \times nm×n ways overall. For example, choosing one toast (10 options) AND one drink (15 options) gives 10×15=15010 \times 15 = 15010×15=150 possible lunches.

  • Sum rule (OR): If a task can be done in either one of two mutually exclusive ways, with mmm ways for the first and nnn for the second, then there are m+nm + nm+n total ways. For example, choosing a toast OR a drink (but not both) gives 10+15=2510 + 15 = 2510+15=25 options.

These rules extend to multiple choices: use multiplication for sequential "and" choices, addition for alternative "or" options.


Permutations: Arranging All Items in Order

A permutation is an ordered arrangement of all elements in a set. For nnn distinct items, the number of permutations is:

P(n)=n!P(n) = n!P(n)=n!

where n!n!n! (read "n factorial") is the product of all integers from nnn down to 1: n!=n×(n−1)×⋯×1n! = n \times (n-1) \times \cdots \times 1n!=n×(n−1)×⋯×1. For example, arranging 10 distinct cards in a line yields 10!=3, ⁣628, ⁣80010! = 3,\!628,\!80010!=3,628,800 ways.

The factorial grows quickly: 0!=10! = 10!=1 by definition (there is exactly one way to arrange nothing).

Key idea: Permutations care about the order of every element.

Variations: Arranging Some Items in Order

A variation (or partial permutation) counts the number of ordered arrangements of ppp items chosen from nnn distinct items (p≤np \leq np≤n). The formula is:

V(n,p)=n×(n−1)×⋯×(n−p+1)=n!(n−p)!V(n, p) = n \times (n-1) \times \cdots \times (n-p+1) = \frac{n!}{(n-p)!}V(n,p)=n×(n−1)×⋯×(n−p+1)=(n−p)!n!​

For instance, drawing 4 cards in order from 10 gives 10×9×8×7=5, ⁣04010 \times 9 \times 8 \times 7 = 5,\!04010×9×8×7=5,040 ways, which equals 10!6!\frac{10!}{6!}6!10!​.

When p=np = np=n, variation becomes a full permutation: V(n,n)=n!0!=n!V(n, n) = \frac{n!}{0!} = n!V(n,n)=0!n!​=n!.

Combinations: Selecting Items Without Order

A combination counts the number of ways to choose ppp items from nnn distinct items without regard to order. The formula is:

C(n,p)=(np)=n!(n−p)! p!C(n, p) = \binom{n}{p} = \frac{n!}{(n-p)! \, p!}C(n,p)=(pn​)=(n−p)!p!n!​

Read as "nnn choose ppp". For example, choosing 3 pizza toppings from 10 (order does not matter) gives (103)=120\binom{10}{3} = 120(310​)=120 possibilities.

Why p!p!p! in the denominator? In a variation, the ppp chosen items can be rearranged in p!p!p! ways, but since order does not matter, we divide by p!p!p! to avoid overcounting.

Combinatorial identities:

  • Symmetry: (np)=(nn−p)\binom{n}{p} = \binom{n}{n-p}(pn​)=(n−pn​) — choosing ppp items is the same as not choosing n−pn-pn−p items.

  • Pascal's identity: (np)=(n−1p)+(n−1p−1)\binom{n}{p} = \binom{n-1}{p} + \binom{n-1}{p-1}(pn​)=(pn−1​)+(p−1n−1​). This is the foundation for Pascal's triangle.


Pascal's Triangle and the Binomial Theorem

Pascal's triangle is a triangular array of binomial coefficients where each entry (except the first row) is the sum of the two entries directly above it. The rows correspond to nnn and the columns to ppp (starting from 0).

Row sums: ∑p=0n(np)=2n\sum_{p=0}^{n} \binom{n}{p} = 2^n∑p=0n​(pn​)=2n. This is because the sum of all combinations of any size from nnn items equals the number of subsets, which is 2n2^n2n.

Binomial Theorem: For any real numbers aaa and bbb and non‑negative integer nnn:

(a+b)n=∑p=0n(np)apb n−p(a + b)^n = \sum_{p=0}^{n} \binom{n}{p} a^{p} b^{\,n-p}(a+b)n=∑p=0n​(pn​)apbn−p

The coefficients (np)\binom{n}{p}(pn​) are called binomial coefficients and match the entries of Pascal's triangle. For example, (a+b)2=a2+2ab+b2(a+b)^2 = a^2 + 2ab + b^2(a+b)2=a2+2ab+b2; the coefficients 1, 2, 1 are the third row of Pascal's triangle.

Generalized Permutations and Combinations

Generalized permutations handle identical items. If we have nnn objects with some identical (e.g., letters in "CONSENSUS": 3 S's, 2 N's, etc.), the number of distinct permutations is:

n!n1! n2! ⋯ nk!\frac{n!}{n_1! \, n_2! \, \cdots \, n_k!}n1​!n2​!⋯nk​!n!​

where n1,n2,…,nkn_1, n_2, \dots, n_kn1​,n2​,…,nk​ are the frequencies of each distinct type. For "CONSENSUS" (9 letters): 9!3! 2!=30, ⁣240\frac{9!}{3!\,2!} = 30,\!2403!2!9!​=30,240.

Generalized combinations (multinomial coefficients) count ways to partition nnn distinct items into kkk groups of fixed sizes c1,c2,…,ckc_1, c_2, \dots, c_kc1​,c2​,…,ck​ (sum = nnn). The formula is:

n!c1! c2! ⋯ ck!\frac{n!}{c_1! \, c_2! \, \cdots \, c_k!}c1​!c2​!⋯ck​!n!​

For example, splitting 10 candies among 3 friends (3, 3, 4) gives 10!3! 3! 4!=16, ⁣800\frac{10!}{3!\,3!\,4!} = 16,\!8003!3!4!10!​=16,800 ways. This is equivalent to the generalized permutation formula because assigning items to groups is equivalent to arranging them with group labels.

Multinomial Theorem: The expansion of (x1+x2+⋯+xk)n(x_1 + x_2 + \dots + x_k)^n(x1​+x2​+⋯+xk​)n is:

∑c1+⋯+ck=nn!c1!⋯ck! x1c1⋯xkck\sum_{c_1 + \dots + c_k = n} \frac{n!}{c_1! \cdots c_k!} \, x_1^{c_1} \cdots x_k^{c_k}∑c1​+⋯+ck​=n​c1​!⋯ck​!n!​x1c1​​⋯xkck​​

The coefficient n!c1!⋯ck!\frac{n!}{c_1! \cdots c_k!}c1​!⋯ck​!n!​ is the multinomial coefficient. For instance, the coefficient of a3b2c6d4a^3 b^2 c^6 d^4a3b2c6d4 in (a+b+c+d)15(a+b+c+d)^{15}(a+b+c+d)15 is 15!3! 2! 6! 4!=6, ⁣306, ⁣300\frac{15!}{3!\,2!\,6!\,4!} = 6,\!306,\!3003!2!6!4!15!​=6,306,300.

Repeatable (With Repetition) Counting

When items are allowed to be repeated (infinite supply), formulas change:

  • Repeatable permutations (order matters, all items used): nnn^nnn (choose any of nnn items for each of nnn positions).

  • Repeatable variations (order matters, ppp picks): npn^pnp (each pick independent).

  • Repeatable combinations (order does not matter, ppp picks from nnn types): Also called combinations with repetition. The number of ways to choose ppp items (allow repeats) from nnn types is:

(p+n−1n−1)\binom{p + n - 1}{n - 1}(n−1p+n−1​)

This can be visualized using the stars and bars method: place ppp indistinguishable stars (items) and n−1n-1n−1 bars (dividers between types). The number of arrangements of stars and bars is (p+n−1n−1)\binom{p + n - 1}{n-1}(n−1p+n−1​). For example, ordering 12 ice creams from 5 flavors: (12+5−15−1)=(164)=1820\binom{12+5-1}{5-1} = \binom{16}{4} = 1820(5−112+5−1​)=(416​)=1820 ways.


The Pigeonhole Principle

If kn+1k n + 1kn+1 pigeons are placed into nnn holes, then at least one hole contains at least k+1k+1k+1 pigeons.

This simple principle is powerful for existence proofs.

  • Example: In New York City (~8.5 million people), each person has between 0 and 150,000 hairs. Since 150, ⁣000×56+1=8, ⁣400, ⁣001150,\!000 \times 56 + 1 = 8,\!400,\!001150,000×56+1=8,400,001 < 8.5 million, by the principle at least 57 people share the same number of hairs.

  • Example (friendship): In any group of 6 people, there must be either 3 mutual acquaintances or 3 mutual strangers. This can be proven using the pigeonhole principle on one person’s relationships (5 others → at least 3 same category) and analyzing the subgraph.


Principle of Inclusion-Exclusion (PIE)

PIE corrects for overcounting when counting elements in the union of multiple sets.

For two sets AAA and BBB:

∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A \cap B|∣A∪B∣=∣A∣+∣B∣−∣A∩B∣

For three sets A,B,CA, B, CA,B,C:

∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣A∩C∣−∣B∩C∣+∣A∩B∩C∣|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C|∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣A∩C∣−∣B∩C∣+∣A∩B∩C∣

Pattern: add sizes of single sets, subtract pairwise intersections, add triple intersections, subtract quadruple, etc., alternating signs.

Example: At a summer camp with Photography (30), Robotics (25), Drama (20), with overlaps: Photo&Robo 12, Photo&Drama 8, Robo&Drama 6, all three 4. Total students = 30+25+20−12−8−6+4=5330+25+20 -12-8-6 +4 = 5330+25+20−12−8−6+4=53.


Derangements

A derangement is a permutation where no element appears in its original position. For nnn items, the number of derangements, denoted !n!n!n (subfactorial), is:

!n=n!(1−11!+12!−13!+⋯+(−1)nn!)!n = n! \left(1 - \frac{1}{1!} + \frac{1}{2!} - \frac{1}{3!} + \dots + \frac{(-1)^n}{n!}\right)!n=n!(1−1!1​+2!1​−3!1​+⋯+n!(−1)n​)

This is derived using PIE: count all permutations, subtract those with at least one fixed element, add back those with at least two fixed, etc.

The infinite series 1−1/1!+1/2!−1/3!+…1 - 1/1! + 1/2! - 1/3! + \dots1−1/1!+1/2!−1/3!+… converges to e−1≈0.3679e^{-1} \approx 0.3679e−1≈0.3679. For n>5n > 5n>5, the approximation !n≈n!/e!n \approx n! / e!n≈n!/e is over 99% accurate.

Thus, the probability that a random permutation is a derangement is about 1/e≈36.8%1/e \approx 36.8\%1/e≈36.8%, essentially independent of nnn for large nnn. This means if you randomly match questions to answers, there is about a 36.8% chance that none are correct.


These core concepts — sets, counting rules, permutations, combinations, binomial theorem, pigeonhole principle, inclusion-exclusion, and derangements — form the backbone of combinatorics. Each connects to the next, building from simple counting to powerful problem-solving tools.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent