# Bertrand's ballot theorem Equivalent problems Rather than computing the probability that a random vote counting order has the desired property, one can instead compute the number of favourable counting orders, then divide by the total number of ways in which the votes could have been counted. (This is the method used by Bertrand.) The total number of ways is the binomial coefficient {displaystyle {tbinom {p+q}{p}}} ; Bertrand's proof shows that the number of favourable orders in which to count the votes is {displaystyle {tbinom {p+q-1}{p-1}}-{tbinom {p+q-1}{p}}} (though he does not give this number explicitly). And indeed after division this gives {displaystyle {tfrac {p}{p+q}}-{tfrac {q}{p+q}}={tfrac {p-q}{p+q}}} .

Another equivalent problem is to calculate the number of random walks on the integers that consist of n steps of unit length, beginning at the origin and ending at the point m, that never become negative. Assuming n and m have the same parity and {displaystyle ngeq mgeq 0} , this number is {displaystyle {binom {n}{tfrac {n+m}{2}}}-{binom {n}{{tfrac {n+m}{2}}+1}}={frac {m+1}{{tfrac {n+m}{2}}+1}}{binom {n}{tfrac {n+m}{2}}}.} When {displaystyle m=0} and {displaystyle n} is even, this gives the Catalan number {displaystyle {frac {1}{{tfrac {n}{2}}+1}}{binom {n}{tfrac {n}{2}}}} .

Bertrand's and André's proofs Bertrand expressed the solution as {displaystyle {frac {2m-mu }{mu }}} where {displaystyle mu =p+q} is the total number of voters and {displaystyle m=p} is the number of voters for the first candidate. He states that the result follows from the formula {displaystyle P_{m+1,mu +1}=P_{m,mu }+P_{m+1,mu },} where {displaystyle P_{m,mu }} is the number of favourable sequences, but "it seems probable that such a simple result could be shown in a more direct way". Indeed, a more direct proof was soon produced by Désiré André. His approach is often mistakenly labelled "the reflection principle" by modern authors but in fact uses a permutation. He shows that the "unfavourable" sequences (those that reach an intermediate tie) consist of an equal number of sequences that begin with A as those that begin with B. Every sequence that begins with B is unfavourable, and there are {displaystyle {tbinom {p+q-1}{q-1}}} such sequences with a B followed by an arbitrary sequence of (q-1) B's and p A's. Each unfavourable sequence that begins with A can be transformed to an arbitrary sequence of (q-1) B's and p A's by finding the first B that violates the rule (by causing the vote counts to tie) and deleting it, and interchanging the order of the remaining parts. To reverse the process, take any sequence of (q-1) B's and p A's and search from the end to find where the number of A's first exceeds the number of B's, and then interchange the order of the parts and place a B in between. For example, the unfavourable sequence AABBABAA corresponds uniquely to the arbitrary sequence ABAAAAB. From this, it follows that the number of favourable sequences of p A's and q B's is {displaystyle {binom {p+q}{q}}-2{binom {p+q-1}{q-1}}={binom {p+q}{q}}{frac {p-q}{p+q}}} and thus the required probability is {displaystyle {frac {p-q}{p+q}}} as expected.

Variant: ties allowed The original problem is to find the probability that the first candidate is always strictly ahead in the vote count. One may instead consider the problem of finding the probability that the second candidate is never ahead (that is, with ties are allowed). In this case, the answer is {displaystyle {frac {p+1-q}{p+1}}.} The variant problem can be solved by the reflection method in a similar way to the original problem. The number of possible vote sequences is {displaystyle {tbinom {p+q}{q}}} . Call a sequence "bad" if the second candidate is ever ahead, and if the number of bad sequences can be enumerated then the number of "good" sequences can be found by subtraction and the probability can be computed.

Represent a voting sequence as a lattice path on the Cartesian plane as follows: Start the path at (0, 0) Each time a vote for the first candidate is received move right 1 unit. Each time a vote for the second candidate is received move up 1 unit.

Each such path corresponds to a unique sequence of votes and will end at (p, q). A sequence is 'good' exactly when the corresponding path never goes above the diagonal line y = x; equivalently, a sequence is 'bad' exactly when the corresponding path touches the line y = x + 1.

'Bad' path (blue) and its reflected path (red) For each 'bad' path P, define a new path P′ by reflecting the part of P up to the first point it touches the line across it. P′ is a path from (−1, 1) to (p, q). The same operation applied again restores the original P. This produces a one-to-one correspondence between the 'bad' paths and the paths from (−1, 1) to (p, q). The number of these paths is {displaystyle {tbinom {p+q}{q-1}}} and so that is the number of 'bad' sequences. This leaves the number of 'good' sequences as {displaystyle {binom {p+q}{q}}-{binom {p+q}{q-1}}={binom {p+q}{q}}{frac {p+1-q}{p+1}}.} Since there are {displaystyle {tbinom {p+q}{q}}} altogether, the probability of a sequence being good is {displaystyle {tfrac {p+1-q}{p+1}}} .

In fact, the solutions to the original problem and the variant problem are easily related. For candidate A to be strictly ahead throughout the vote count, they must receive the first vote and for the remaining votes (ignoring the first) they must be either strictly ahead or tied throughout the count. Hence the solution to the original problem is {displaystyle {frac {p}{p+q}}{frac {p-1+1-q}{p-1+1}}={frac {p-q}{p+q}}} as required.

Conversely, the tie case can be derived from the non-tie case. Note that the number of non-tie sequences with p+1 votes for A is equal to the number of tie sequences with p votes for A. The number of non-tie votes with p + 1 votes for A votes is {displaystyle {tfrac {p+1-q}{p+1+q}}{tbinom {p+1+q}{q}}} , which by algebraic manipulation is {displaystyle {tfrac {p+1-q}{p+1}}{tbinom {p+q}{q}}} , so the fraction of sequences with p votes for A votes is {displaystyle {tfrac {p+1-q}{p+1}}} .