Solution (source code)

= Solution

Let each step have <length> $a$, and let $K$ be the number of right steps among $N$ independent steps. Then $K$ has a <binomial distribution> and the physical displacement is $x=a[K-(N-K)]=a(2K-N)$. Therefore $K=(N+x/a)/2$, and the position <probability mass> is
$$
\boxed{P_{\rm 1D}(x,N)=\binom{N}{(N+x/a)/2}
 w_+^{(N+x/a)/2}w_-^{(N-x/a)/2}.}
$$
This is zero unless $x/a$ is an integer, $|x/a|\leq N$, and $N+x/a$ is even. The parity condition matters because the walk alternates between the two sublattices. If distance is measured in lattice spacings, replace $x/a$ by $x$.

Normalization follows from the <binomial theorem>. Its first two <moments> provide useful checks:
$$
\langle x\rangle=Na(w_+-w_-),\qquad
\operatorname{Var}(x)=4Na^2w_+w_-=Na^2\left[1-(w_+-w_-)^2\right].
$$
These are exact discrete-time statements; a smooth continuum <probability density> requires coarse-graining over the lattice and its parity oscillation.