Skip to content
QuantMax
QuantMax
  • Overview
  • Curriculum
    • FLUMental maths and numerical fluency
    • COMBCounting and combinatorics
    • PROBProbability
    • GAMEGames, decision theory and puzzles
    • MMMarket making
    • MKTMarkets and products

Practise

  • Question bank
  • Mental arithmetic
  • Market simulator
  • Arbitrage trees
  • Horse racing
  • Bid book
  • Screening tests
  • Mock papers

Reference

  • Formula reference
  • Search

Your record

  • Review queue
  • Progress
  • Leaderboard
  • Profile
  • Invite friends
AccountSend feedback
  1. Formula reference

Counting and combinatorics

4 lessons · 15 equations. Each lesson below gives its formulas and key rules; open the lesson for the full explanation.

Counting: the four cases, and how to tell them apart

The binomial coefficient

(nk)=n!k! (n−k)!\binom{n}{k} = \frac{n!}{k!\,(n-k)!}(kn​)=k!(n−k)!n!​

The number of ways to choose kkk items from nnn when order does not matter.

The multinomial coefficient

(nn1,n2,…,nr)=n!n1! n2!⋯nr!\binom{n}{n_1, n_2, \ldots, n_r} = \frac{n!}{n_1!\,n_2!\cdots n_r!}(n1​,n2​,…,nr​n​)=n1​!n2​!⋯nr​!n!​

The number of ways to split nnn distinct items into labelled groups of sizes n1,…,nrn_1, \ldots, n_rn1​,…,nr​ — equivalently, the number of distinct arrangements of a word with repeated letters. The binomial coefficient is the case r=2r = 2r=2.

Onto assignments

S(k,n)=∑j=0n(−1)j(nj)(n−j)kS(k, n) = \sum_{j=0}^{n} (-1)^j \binom{n}{j} (n - j)^kS(k,n)=j=0∑n​(−1)j(jn​)(n−j)k

The number of ways to assign kkk distinct items to nnn distinct boxes so that no box is empty. It is inclusion–exclusion over the set of boxes left empty, and it is the count behind "every desk gets at least one order" questions.

Remember

  • Decide order and repetition first; the formula follows from the four-case table.

Binomial identities, and proving them by counting twice

The central coefficient

(2nn)≈4nπn\binom{2n}{n} \approx \frac{4^n}{\sqrt{\pi n}}(n2n​)≈πn​4n​

The largest entry of row 2n2n2n, and the one that turns up in random-walk and coin-flip questions.

The binomial theorem, and the sums it gives for free

(1+x)n=∑k=0n(nk)xk(1 + x)^n = \sum_{k=0}^{n}\binom{n}{k}x^k(1+x)n=k=0∑n​(kn​)xk

Substituting values of xxx produces the row identities at once: x=1x = 1x=1 gives ∑k(nk)=2n\sum_k \binom{n}{k} = 2^n∑k​(kn​)=2n; x=−1x = -1x=−1 gives ∑k(−1)k(nk)=0\sum_k (-1)^k\binom{n}{k} = 0∑k​(−1)k(kn​)=0, so even- and odd-sized subsets are equally numerous; differentiating and setting x=1x = 1x=1 gives ∑kk(nk)=n2n−1\sum_k k\binom{n}{k} = n2^{n-1}∑k​k(kn​)=n2n−1.

The multinomial theorem

(x1+⋯+xr)n=∑n1+⋯+nr=nn!n1!⋯nr! x1n1⋯xrnr(x_1 + \cdots + x_r)^n = \sum_{n_1 + \cdots + n_r = n}\frac{n!}{n_1!\cdots n_r!}\,x_1^{n_1}\cdots x_r^{n_r}(x1​+⋯+xr​)n=n1​+⋯+nr​=n∑​n1​!⋯nr​!n!​x1n1​​⋯xrnr​​

Each term picks, from each of the nnn factors, one of the rrr variables; the coefficient counts the ways to make a given choice of exponents.

Estimating the central coefficient

(2nn)≈4nπn\binom{2n}{n} \approx \frac{4^n}{\sqrt{\pi n}}(n2n​)≈πn​4n​

From Stirling’s formula. It is within about 1%1\%1% by n=10n = 10n=10 and improves from there, and it is the reason the chance of an exact tie in 2n2n2n fair flips falls like 1/πn1/\sqrt{\pi n}1/πn​.

Remember

  • Prove an identity by describing one set that both sides count.

Inclusion–exclusion, derangements and the pigeonhole

Inclusion–exclusion

∣⋃i=1nAi∣=∑∣Ai∣−∑i<j∣Ai∩Aj∣+∑i<j<k∣Ai∩Aj∩Ak∣−⋯\left|\bigcup_{i=1}^{n} A_i\right| = \sum |A_i| - \sum_{i<j} |A_i \cap A_j| + \sum_{i<j<k} |A_i \cap A_j \cap A_k| - \cdots​i=1⋃n​Ai​​=∑∣Ai​∣−i<j∑​∣Ai​∩Aj​∣+i<j<k∑​∣Ai​∩Aj​∩Ak​∣−⋯

Add the singles, subtract the pairs, add the triples, alternating. Each element ends up counted exactly once.

Derangements without the alternating sum

Dn=(n−1) (Dn−1+Dn−2),Dn=round⁡ ⁣(n!e)D_n = (n - 1)\,(D_{n-1} + D_{n-2}), \quad D_n = \operatorname{round}\!\left(\frac{n!}{e}\right)Dn​=(n−1)(Dn−1​+Dn−2​),Dn​=round(en!​)

Condition on where item one goes, say to position jjj (n−1n - 1n−1 choices). Either item jjj goes back to position one, leaving a derangement of n−2n - 2n−2, or it does not, which behaves like a derangement of n−1n - 1n−1. The rounding formula is exact for n≥1n \ge 1n≥1.

Euler’s totient as inclusion–exclusion

φ(n)=n∏p∣n(1−1p)\varphi(n) = n\prod_{p \mid n}\left(1 - \frac1p\right)φ(n)=np∣n∏​(1−p1​)

The number of integers up to nnn sharing no factor with nnn — inclusion–exclusion over its prime divisors, collapsed into a product. φ(60)=60×12×23×45=16\varphi(60) = 60 \times \tfrac{1}{2} \times \tfrac{2}{3} \times \tfrac{4}{5} = 16φ(60)=60×21​×32​×54​=16.

The generalised pigeonhole principle

some box holds at least ⌈nk⌉\text{some box holds at least } \left\lceil \frac{n}{k} \right\rceilsome box holds at least ⌈kn​⌉

Put nnn items in kkk boxes and at least one box holds ⌈n/k⌉\lceil n/k \rceil⌈n/k⌉. To guarantee rrr items in some box you need k(r−1)+1k(r - 1) + 1k(r−1)+1 items.

Remember

  • Inclusion–exclusion alternates: singles minus pairs plus triples.

Lattice paths, the reflection principle and Catalan numbers

The ballot problem

P(A always ahead)=a−ba+bP(\text{A always ahead}) = \frac{a - b}{a + b}P(A always ahead)=a+ba−b​

Candidate A finishes with aaa votes and B with b<ab < ab<a. Counting the votes in random order, this is the chance A leads throughout.

Catalan numbers

Cn=1n+1(2nn)=(2nn)−(2nn+1)C_n = \frac{1}{n+1}\binom{2n}{n} = \binom{2n}{n} - \binom{2n}{n+1}Cn​=n+11​(n2n​)=(n2n​)−(n+12n​)

Paths of nnn ups and nnn downs that never go below zero — and, by bijection, a great many other things.

The Catalan recurrence

Cn+1=∑i=0nCi Cn−i,C0=1C_{n+1} = \sum_{i=0}^{n} C_i\,C_{n-i}, \qquad C_0 = 1Cn+1​=i=0∑n​Ci​Cn−i​,C0​=1

Split a good path at its first return to zero: the part before is an elevated good path of some length, the part after is any good path. Every Catalan family has a first-return decomposition like this, and recognising the recurrence is often faster than finding the bijection.

Returning to the start

Pr⁡(S2n=0)=(2nn)4n≈1πn\Pr(S_{2n} = 0) = \frac{\binom{2n}{n}}{4^n} \approx \frac{1}{\sqrt{\pi n}}Pr(S2n​=0)=4n(n2n​)​≈πn​1​

For a symmetric ±1\pm 1±1 walk, the chance of being back at zero after 2n2n2n steps. It decays slowly, so returns keep happening — the one-dimensional walk is recurrent — even though each is individually less likely.

Remember

  • Monotone paths to (m,n)(m,n)(m,n) number (m+nn)\binom{m+n}{n}(nm+n​) — choosing steps is choosing a subset.

Detailed formula cards

  • The four counting cases
  • Derangements

QuantMax · 141 lessons · 1342 questions · c5c0caa

  • Premium
  • Arbitrage trees
  • Horse racing
  • Invite friends
  • Account
  • About QuantMax

Firm names identify publicly reported question patterns and nothing more. QuantMax is not affiliated with, endorsed by, or recruiting for any firm named in the curriculum. Everything you do in lessons and the question bank is kept to your account.