On this page
Picture a class election. Riya got 5 votes and Arjun got 3. The teacher reads the slips out one at a time, in a random order. What is the chance that Riya is ahead after every single slip? That is the ballot problem.
What is the ballot problem in probability?
Candidate A receives a votes and candidate B receives b votes, with a > b. The votes are counted in a random order, every order equally likely. What is the probability that A is strictly ahead of B throughout the count?
The answer is (a − b)/(a + b), as set out in the article on Bertrand's ballot theorem. The result was first published by W. A. Whitworth in 1878 and is named after Joseph Bertrand, who rediscovered it in 1887.
Check the smallest case. With a = 3 and b = 2 there are 10 possible orders, and A stays strictly ahead in only two, AAABB and AABAB, so the probability is 2/10 = 1/5 = (3 − 2)/(3 + 2). This is the example the same article works through.
How do you turn a vote count into a lattice path?
Write the count as a walk. Start at height 0. Each vote for A is a step up (+1) and each vote for B is a step down (−1). After k votes, the height is A's lead. The walk has a + b steps and ends at height a − b.
"A is always strictly ahead" now means the walk never touches height 0 after it starts. Choosing an order is the same as choosing which b of the a + b steps go down, so there are C(a + b, b) walks, all equally likely.
What is the reflection trick, and why does it work?
Split the walks by their first vote.
A walk that starts with B drops to −1 at once, so it is bad. There are C(a + b − 1, b − 1) of these.
A walk that starts with A begins at +1. Some stay above 0 (good); others come back to 0 later (bad).
Take a bad walk that starts with A. Flip every step before its first touch of 0, ups to downs and downs to ups. The flipped walk starts with B and touches 0 at the same moment. Every B-first walk must cross 0 to end at a − b, so flipping again undoes it. Each bad A-first walk pairs with exactly one B-first walk, so there are C(a + b − 1, b − 1) of each.
Good = C(a + b − 1, b) − C(a + b − 1, b − 1).
Divide by all C(a + b, b) walks: a/(a + b) − b/(a + b) = (a − b)/(a + b).
The trick is often credited to Désiré André, who gave a direct proof in 1887, but the ballot theorem article says his proof used a permutation, not a reflection; see Marc Renault's paper on André's actual method.
How does the formula work for 5 votes to 3?
Total orders: C(8, 3) = 56.
Orders that start with Arjun, all bad: C(7, 2) = 21.
Orders that start with Riya: C(7, 3) = 35. Reflection pairs 21 of them with the Arjun-first orders, so 35 − 21 = 14 are good.
Probability: 14/56 = 1/4, and (5 − 3)/(5 + 3) = 2/8 = 1/4.
If ties are allowed (Arjun is never ahead, but level is fine), the same article gives (a + 1 − b)/(a + 1) instead, here 3/6 = 1/2.
How do you use the reflection trick on other problems?
The same move solves JEE-style path questions: grid paths that must not cross a diagonal, bracket sequences that never close more than they open. Ask three questions:
What is one step? (Here: ±1 per vote.)
Which line must the path not touch? (Here: height 0.)
Where does the start point land when reflected across that line? (Here, after the first vote, +1 lands at −1.) Paths from there to the end match the bad paths one for one.
Then good = all − bad. Step 3 is a bijection, the idea in our post on counting with a bijection. For the binomial-coefficient basics, revise permutations and combinations key terms and Class 12 probability key terms.
If a new path problem stalls at step 3, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer, and the Fermi Concept Library gives each mathematics concept its own lesson.
Next time you see "never ahead" or "never crosses", draw the walk first. The answer is usually one subtraction away.



