Originally Posted by

**Failure** Let p be the probability that he takes a step to the right, then the probability of his being at position 2k-n after n steps is

$\displaystyle \mathrm{P}(X_n=2k-n)=\binom{n}{k}p^k (1-p)^{n-k}$

If p=1/2 this simplifies to $\displaystyle \mathrm{P}(X_n=2k-n)=\binom{n}{k}2^{-n}$, of course.

By setting x := 2k-n it follows from this that if $\displaystyle x\in \{-n,-n+1,\ldots, 0, 1, \ldots, n-1, n\}$, we have

$\displaystyle \mathrm{P}(X_n=x)=\begin{cases} \binom{n}{\frac{x+n}{2}}p^k(1-p)^{n-k}, & \text{if } x+n\text{ is even} \\

0,&\text{otherwise}

\end{cases}$

Given that, the probability that $\displaystyle |X_n|\leq a$ is

$\displaystyle \mathrm{P}(|X_n|\leq a) = \sum_{x=-a}^a\mathrm{P}(X_n=x)$

(assuming that $\displaystyle a\in\{0,1,\ldots,n\}$).