Skip to main content

The Problem Pit: The Pit of Lattice Paths

The Pit of Lattice Paths: Counting Without Crossing

Some math problems are honest about their difficulty. You look at the Riemann Hypothesis, and it immediately feels intimidating. But lattice paths? Counting walks on a grid? That sounds like something for children.

That’s what I thought, at least. Then I stepped in.


Step 1: The Innocent Beginning

The basic question:

How many shortest paths are there from (0,0)(0,0) to (n,n)(n,n) if you can only move right (RR) or up (UU)?

At first this feels like shuffling cards. You need nn rights and nn ups. That’s 2n2n moves in total, arranged in some order.

So the answer is just

(2nn).\binom{2n}{n}.

For n=3n=3: (63)=20\binom{6}{3} = 20.

Easy! Problem solved.

…Or so I thought.


Step 2: Adding a Wall

What if I require the path to never go above the diagonal? That is, at every point, the path must satisfy yxy \leq x.

This tiny change sends the problem spiraling.

Take n=3n=3: there are 20 total paths. How many stay below the diagonal? Draw them, count carefully… and the answer is 5.

That number felt too neat. For n=4n=4, it’s 14. For n=5n=5, it’s 42.

Then the pattern hits:

1,  2,  5,  14,  42,  132,1, \; 2, \; 5, \; 14, \; 42, \; 132, \dots

I recognized it. The infamous Catalan numbers.


Step 3: The Catalan Trap

Catalan numbers are defined by

Cn=1n+1(2nn).C_n = \frac{1}{n+1} \binom{2n}{n}.

So the number of lattice paths from (0,0)(0,0) to (n,n)(n,n) that never cross the diagonal is CnC_n.

Neat. I should’ve been happy.

Instead, I got stuck.

Because Catalan numbers appear everywhere. Once you see them, you can’t unsee them:

  • Number of ways to correctly parenthesize n+1n+1 terms.

  • Number of binary trees with nn nodes.

  • Number of noncrossing matchings on 2n2n points.

  • Number of monotone lattice paths under a diagonal.

And each of these interpretations can be proved to be the same number.

I thought: surely there’s some “master proof” that explains them all. I tried to invent one. I failed. I drowned in bijections.


Step 4: Wrong Turns

I tried to solve the diagonal restriction problem directly with algebra.

The condition yxy \leq x suggests inequalities. Maybe I could sum binomial coefficients over constrained regions. I wrote:

#{valid paths}=k=0nf(k),\# \{ \text{valid paths} \} = \sum_{k=0}^n f(k),

where f(k)f(k) counts something. I never managed to close the formula.

Then I tried recursion: a valid path either starts with RR then a smaller valid path, or splits into two pieces at the diagonal. This gave the recurrence

Cn+1=i=0nCiCni.C_{n+1} = \sum_{i=0}^n C_i C_{n-i}.

That was progress. But the recurrence just felt like a trick, not an explanation. Why should lattice paths multiply like this?

Another dead end.


Step 5: Generating Function Madness

I decided to try generating functions:

C(x)=n=0Cnxn.C(x) = \sum_{n=0}^\infty C_n x^n.

The recurrence suggested

C(x)=1+xC(x)2.C(x) = 1 + x C(x)^2.

That’s a quadratic equation! Solve it:

C(x)=114x2x.C(x) = \frac{1 - \sqrt{1 - 4x}}{2x}.

And expanding the square root recovers

Cn=1n+1(2nn).C_n = \frac{1}{n+1}\binom{2n}{n}.

At first I was satisfied. But then I wondered: why does a lattice path problem lead to a generating function involving a square root? What’s hiding behind that radical?

I dug deeper.


Step 6: The Ballot Problem Detour

I realized the diagonal restriction is just the Ballot problem:

If candidate A gets pp votes and candidate B gets qq votes, how many ways can the votes be counted so that A is never behind?

The answer:

pq+1p+1(p+qq).\frac{p-q+1}{p+1} \binom{p+q}{q}.

For p=q=np=q=n, this reduces to the Catalan number CnC_n.

Suddenly, a lattice path became a political election. But this was no help — it just gave me another disguise of the same beast.


Step 7: Catalan Everywhere

The pit deepened. I kept stumbling on Catalan numbers in unexpected places:

  • Number of ways to triangulate a convex (n+2)(n+2)-gon.

  • Number of stack-sortable permutations of length nn.

  • Number of non-crossing partitions of a set.

  • Number of ways to dissect a staircase polyomino.

I realized: Catalan numbers are not just about paths. They are a universal combinatorial skeleton.

But why? I still didn’t have my master proof.


Step 8: Asymptotics and Analysis

Finally, I wondered: how fast do Catalan numbers grow?

Using Stirling’s approximation on

Cn=1n+1(2nn),C_n = \frac{1}{n+1}\binom{2n}{n},

I found

Cn4nn3/2π.C_n \sim \frac{4^n}{n^{3/2} \sqrt{\pi}}.

So they grow like 4n4^n, but with a polynomial suppression.

That made sense: the total number of paths is (2nn)4nπn\binom{2n}{n} \sim \frac{4^n}{\sqrt{\pi n}}. Requiring the path to stay under the diagonal is a “rare event” with probability about 1/(n+1)1/(n+1).

Probability snuck in. Now lattice paths had turned into random walks.


Step 9: The Random Walk Abyss

I thought: a path from (0,0)(0,0) to (n,n)(n,n) is just a sequence of coin flips. Heads = right, tails = up. The condition “stay below the diagonal” means the walk never falls behind.

That’s exactly the reflection principle in probability. And Catalan numbers are just counting paths that don’t violate it.

So this innocent problem wasn’t just combinatorics. It was also probability theory, random walks, and Brownian motion.


Step 10: Climbing Out (Almost)

In the end, I realized:

  • Lattice paths under a diagonal are Catalan numbers.

  • Catalan numbers connect trees, polygons, elections, stack sorting, and more.

  • Their generating function hides a square root, signaling deep structure.

  • Their asymptotics connect to probability and random walks.

I went in expecting to count paths on a grid. I came out knowing I had been staring at one of the most universal sequences in mathematics.

That’s what The Problem Pit does: it takes a child’s puzzle and reveals a monster that touches every corner of math.



Comments

Popular posts from this blog

Sharp Extremal Bounds for Angular Occupancy (Behind the Curtains)

you can find the full paper here First Attempts, and the Limits of Energy When I first began thinking about angular occupancy, I wasn’t looking for a brand-new problem. I was chasing a theme that has long fascinated me in discrete geometry: how do we measure the geometric richness of a finite set of points? This fascination is not unique to me. Erdős, way back in 1946, posed the distinct distances problem : given n points in the plane, how many distinct distances can they determine? That question alone gave birth to entire decades of work in combinatorial geometry. Later, Fishburn and Füredi asked about distinct angles , while Pach and Sharir studied repeated angles . Each time, the same underlying itch was being scratched: when you place points in the plane, what kinds of diversity can they generate? Why angles, why bins? It was natural to think of angles — after all, distances and directions had already been well studied. But if you go straight for “distinct angles,” you run in...

The Art of Goodbye

  The Art of Goodbye: How Relationships End and Why It Matters The friendship had been slowly dissolving for months. What used to be weekly coffee dates became monthly check-ins, then sporadic text messages, then silence. No fight precipitated the ending, no dramatic confrontation or betrayal. It simply... faded. One day you realized you hadn't spoken to someone who was once central to your life, and you weren't sure when the relationship had officially ended or even if it had. This ambiguous loss left you with a peculiar grief – mourning someone still alive, still accessible, but no longer present in your world. This experience is incredibly common yet rarely discussed. While we have cultural scripts for how relationships begin – meet-cutes, first dates, friendship origin stories – we have few models for how they end. We talk extensively about building connections but rarely about gracefully releasing them. This gap in our social understanding leaves many people unprepared ...

Getting Stuck: When Dijkstra Meets Negative Edges

  Getting Stuck: When Dijkstra Meets Negative Edges One of the joys (and pains) of computer science is when you take a tool you know, confidently apply it, and then watch everything break down in surprising ways. This happened to me recently when I decided to revisit shortest path algorithms — specifically, Dijkstra’s algorithm — only to get stuck in a swamp of negative edges. Setting the Scene The problem was classic: Given a directed, weighted graph and a source vertex, find the shortest path to all other vertices. This is the kind of problem that every CS student learns early, usually with Dijkstra’s algorithm. I already knew Dijkstra like an old friend: Keep a priority queue of distances. Always expand the node with the current smallest distance. Relax its edges. Simple, elegant, efficient ( O((V + E) log V) with a binary heap). So when I started coding a graph utility for my project — a tool to analyze transportation networks — I confidently plugged in D...