Skip to content
  • Overview
  • Curriculum
    • FLUMental maths and numerical fluency
    • COMBCounting and combinatorics
      • 1Basic counting

        • Counting: the four cases, and how to tell them apart
      • 2Binomial coefficients

        • Binomial identities, and proving them by counting twice
      • 3Inclusion–exclusion and invariants

        • Inclusion–exclusion, derangements and the pigeonhole
      • 4Advanced structures

        • Lattice paths, the reflection principle and Catalan numbers
    • 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. Curriculum
  2. /Trading and market making
  3. /Counting and combinatorics
  4. /Advanced structures

Lattice paths, the reflection principle and Catalan numbers

COMB · Chapter 4·13 min read·Asked at Jane Street, Optiver, SIG, Citadel

Assumes Binomial identities, and proving them by counting twice.

After this lesson you should be able to

  • Count monotone lattice paths, with and without a barrier.
  • Use the reflection principle to count paths that touch a level.
  • Recognise the Catalan family and the ballot problem behind it.

A surprising number of interview problems are the same object in different clothing: a sequence of up and down steps, counted subject to a constraint. Once you see a question as a lattice path, the reflection principle counts the constrained cases in one line — and the same argument reappears in random walks and in barrier option pricing.

Definition 4.1

Monotone lattice paths

Lattice path, paths from (0,0) to (m,n)=(m+nn)\text{paths from } (0,0) \text{ to } (m,n) = \binom{m+n}{n}paths from (0,0) to (m,n)=(nm+n​) — A path taking only right and up steps is determined entirely by which of its m+nm+nm+n steps go up, so counting paths is choosing a subset. Every grid-walking question reduces to this, and constraints like "avoid this square" are handled by subtracting the paths that pass through it.

Derivation 4.2

The reflection principle

To count paths from AAA to BBB that touch a forbidden line, reflect the start across the line.

  1. Any path from A that touches the line\text{Any path from } A \text{ that touches the line}Any path from A that touches the line

    Take the first touch, and reflect everything before it.

  2. ⟷a path from A′ to B\longleftrightarrow \text{a path from } A' \text{ to } B⟷a path from A′ to B

    This is a bijection: reflecting twice returns the original path, and every path from A′A'A′ must cross the line.

  3. #{touching}=#{all paths from A′ to B}\#\{\text{touching}\} = \#\{\text{all paths from } A' \text{ to } B\}#{touching}=#{all paths from A′ to B}
#{never touching}=(m+nn)−#{paths from A′}\#\{\text{never touching}\} = \binom{m+n}{n} - \#\{\text{paths from } A'\}#{never touching}=(nm+n​)−#{paths from A′}

Equation 4.3

The ballot problem

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.

P(A always ahead)=a−ba+bP(\text{A always ahead}) = \frac{a - b}{a + b}P(A always ahead)=a+ba−b​
a−ba - ba−b
The final margin.
a+ba + ba+b
The total number of votes.

Why the answer is so simple. A formula this clean is usually a bijection in disguise, and it is: the reflection argument pairs every path that ties at some point with a path that starts the other way, so the surviving paths are exactly the ones whose first step is A and which never return to zero. The margin over the total is the residue left when those pairs cancel. It is worth recognising the shape — an answer that depends only on the endpoints, not on the route — because the same phenomenon makes gambler’s ruin and hitting probabilities so tractable.

Equation 4.4

Catalan numbers

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

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​)
C0..C6C_0..C_6C0​..C6​
1, 1, 2, 5, 14, 42, 132 — worth recognising on sight.
(2nn+1)\binom{2n}{n+1}(n+12n​)
The paths that do dip below, counted by reflection.
ObjectThe bijection
Balanced bracket sequences of length 2n2n2nOpen is up, close is down; never going negative is never closing too early
Binary trees with nnn internal nodesRead a traversal as the path
Triangulations of a convex (n+2)(n{+}2)(n+2)-gonRecursive split on one edge
Ways to parenthesise n+1n{+}1n+1 factorsSame recursion
Monotone paths below the diagonal of an n×nn \times nn×n gridThe definition itself
Stack-sortable permutations of nnn itemsPush is up, pop is down
Table 4.5 · Things counted by CnC_nCn​. If a count comes out 1, 2, 5, 14, 42 you are almost certainly looking at a Catalan problem, and the right move is to find the up-down path hiding inside it.

The rest of this lesson is in Premium

You have read the opening. 12 more sections follow, including 6 worked examples and 3 quick checks.

Start the free 7-day trialSign in

Nothing is charged for 7 days, and you can cancel before then. Or read Arithmetic that survives a clock in full, free.

← Inclusion–exclusion, derangements and the pigeonholeBack to Counting and combinatorics →
On this page
  • Monotone lattice paths
  • The reflection principle
  • The ballot problem
  • Catalan numbers
  • Things counted by CnC_nCn​

QuantMax · 141 lessons · 1342 questions · c5c0caa

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

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.