Counting principles, permutations, combinations, and the foundations of discrete probability.
No prerequisites
Combinatorics is the art of counting. In quant interviews, computing a classical probability always reduces to counting — favorable outcomes over total outcomes. This topic covers the four fundamental counting structures, the binomial theorem, and the key problem-solving tools (inclusion-exclusion, pigeonhole, complement) that appear repeatedly in interview problems.
Let be finite sets. The number of ways to perform successive independent choices, where choice has options, is:
A PIN code has 4 digits, each chosen from . Total number of codes: .
Let be pairwise disjoint finite sets ( for ). Then:
The disjointness condition is essential. If the sets overlap, you must use the Inclusion-Exclusion principle (see section 5.1). The addition principle is the special case of inclusion-exclusion where all intersections are empty.
A password must start with either a letter (26 choices) or a digit (10 choices), but not both. Number of valid first characters: .
A permutation of a set of distinct elements is a bijection from to itself, i.e. an ordered arrangement of all elements. The number of permutations of elements is:
Number of ways to arrange 5 books on a shelf: .
An arrangement of elements chosen from distinct elements, where order matters and each element is used at most once, is called a -arrangement of . The number of such arrangements is:
Number of ways to assign gold, silver, and bronze medals among 10 athletes: .
Use whenever the problem involves ranking or ordered selection without replacement — podium positions, scheduling, assigning distinct roles to people.
A sequence of length over an alphabet of distinct elements, where each element may be used multiple times, is a function from to the alphabet. The number of such sequences is:
Use for passwords, binary strings, dice roll sequences, or any problem where each step has the same independent options. Key special cases: for binary strings, for sequences of dice rolls.
Given elements where element appears times with , the number of distinct ordered arrangements is:
Number of distinct arrangements of the letters in MISSISSIPPI — M×1, I×4, S×4, P×2, total :
A combination of elements from a set of distinct elements is a subset of size , where order does not matter and each element appears at most once. The number of such subsets is:
Number of 5-card hands from a standard 52-card deck: .
The number of ways to choose elements from distinct types where order does not matter and repetition is allowed equals the number of non-negative integer solutions to , and is given by:
For strictly positive solutions (), substitute to reduce to the non-negative case, giving .
How many ways to choose 3 scoops from 5 flavors, repetition allowed? .
How many ways to distribute 10 identical balls into 4 distinct boxes?
Use stars and bars whenever you distribute identical objects into distinct containers, or count integer solutions to a sum constraint. If objects are distinct, use the multiplication principle instead.
For any and :
.
counts all subsets of an -element set — the most tested identity. The alternating sum is useful to verify that a combinatorial expression sums to zero or to evaluate telescoping sums.
For any finite sets :
How many integers from 1 to 100 are divisible by 2 or 3? We have , , , so .
Use inclusion-exclusion when counting elements satisfying at least one of several conditions. For divisibility problems: and .
If objects are distributed into containers with , then at least one container contains at least:
This is a pure existence theorem — it guarantees that a configuration must exist without constructing it. In interviews it appears as "prove there must exist two objects sharing property P" or "show that some value must repeat."
In any group of 13 people, at least 2 share the same birth month (13 people, 12 months ).
Given a sample space and a desired event , complement counting computes indirectly via its complement :
Use complement counting whenever the condition is "at least one" or "not all" — their complements ("none" or "all") are usually straightforward. The Birthday Problem is the canonical example: .
| Order matters? | Repetition allowed? | Formula | Name |
|---|---|---|---|
| ✅ Yes | ✅ Yes | Sequence with repetition | |
| ✅ Yes | ❌ No | Arrangement |
This is called a multinomial coefficient.
with the convention for or .
Special cases:
| ❌ No | ❌ No | Combination |
| ❌ No | ✅ Yes | Combination with repetition |
| — | Multiset | Multiset permutation |