# Andre’s Reflection Method

I promised to post something about random walks. I learned the content of this post while listening to Vilppu Tarvainen’s bachelor’s degree talk and I consider it is quite cute.

Let us consider a one dimensional random walk: formally it is a sequence $$\bar a=(a_1,\dots, a_n)$$ where $$a_i$$ can be either 1 or -1 with equal probability. That is, at each step we either go right (+1) or left (-1); $$a_1$$ is the first step, $$a_2$$ the second and so on. Suppose a fellow stands at some natural number $$k$$ and then executes such a random walk: an n-step walk, and at each step goes left or right by one:

For example, if the starting position is the picture above and the walk is given by $$(-1,-1,1,1,1,-1,-1)$$, then you end up at 4.

Question: Suppose a fellow stands at the positive natural number k and makes a random walk of length n which ends up back at k. What is the probability that the fellow never visited zero? (n is assumed to be even, or otherwise it is impossible to get back to k)

This problem seems to be originated as the so-called Ballot Problem: Suppose A and B are candidates for office and there are 2n voters, n voting for A and n for B. In how many ways can the ballots be counted so that B is never ahead of A? To formulate this in the previous setting, let a vote for A be +1 and a vote for B -1. The random walk is now determined by the order of counting the votes and the starting point is 1. If you visit zero during the counting, then B is necessarily ahead of A at this step. Note that since the voters voted equally for A and B, the walk ends up at 1.

More generally one can of course ask: if 1 occurs with probability p and -1 with probability 1-p in the walk and we know that the walk starts at k>0 and ends at m>0, what is the probability that the walk does not visit zero? The answer below generalizes easily to this extend.

Answer: André’s Reflection Method. Désiré André (1840-1917)

A brute force counting might be possible; but if brute force were the solution I am going to present, I wouldn’t bother to write this post at all.

So in the following k>0 is a natural number and n>0 is an even natural number.

Denote by $$R_k$$ the number of all random walks of length n that start at k and end at k. Denote by $$R_k(0)$$ the number of all random walks of length n that start at k, end at k and visit 0. Clearly now the Question asks for the value of

$$\displaystyle 1-\frac{R_k(0)}{R_k}$$

It is easily seen that

$$R_k=\left({n}\atop {n/2}\right)$$

is just the number of subsets of n of size $$n/2$$ (The walk will get back to k from k iff the number of -1’s and 1’s in the walk is the same; so all walks with 1’s everywhere except for $$n/2$$ steps are suitable. Hence it is enough to calculate the number of subsets of $$\{1,\dots n\}$$ of size $$n/2$$. Recall that n is even). So now we are left with calculating $$R_k(0)$$.

Further, denote by $$S_k$$ the set of all random walks that start at –k and end at k.

Theorem (André’s Method.) $$R_k(0)=S_k$$.
Proof. Sets are of the same size if there is a bijection between them. We shall define a bijection f between the sets R={walks from k to k that do visit zero} and S={walks from –k to k}. Suppose that $$(a_1,\dots,a_n)$$ is a random walk in R. Let i be the first number such that $$\sum_{j=1}^i a_j=0$$; in other words i is the first step after which the walk visits zero. We know that it will happen since the walk is in R. Then put $$b_j=a_j$$, if $$j\gneq i$$ and $$b_j=-a_j$$ if $$j\le i$$ and define

$$f((a_1,\dots, a_n))=(b_1,\dots, b_n).$$

Why is it a bijection? It is easily seen to be injection: the walks $$\bar a=(a_1,\dots,a_n)$$ and $$f(\bar a)$$ meet zero first time at the same step and so if $$f(\bar a)=f(\bar b)$$, then $$\bar a$$ and $$\bar b$$ must meet zero first time at the same step. Further by definition of f they must agree before that zero and also after that zero. In order to see that it is a surjection, fix a walk $$(b_1,\dots,b_n)$$ from –k to k. Applying the obvious inverse map $$a_j=b_j$$ if $$j\gneq i$$ and $$a_j=-b_j$$ if $$j\le i$$, where i is the first step, $$\bar b$$ meets zero, we get $$\bar a$$ such that $$f(\bar a)=\bar b$$. $$\square$$

Now we have just to calculate $$S_k$$. The idea is the same as calculating $$R_k$$ above. $$S_k$$ is a walk of length n that gets from –k to k. So there are 2k more 1’s than -1’s. So we have to calculate in what possible orders can $$(n/2+k)$$ 1’s and $$(n/2-k)$$ -1’s occure in a row. This equals

$$\displaystyle \left(n\atop{n/2-k}\right)$$.

$$1-\displaystyle \frac{\left(n\atop{n/2-k}\right)}{\left(n\atop{n/2}\right)},\text{ which equals }\frac{1}{n+1}\text{ when }k=1.$$