We consider a $n$ steps random walk on $\mathbb{N}$, starting at $X_0 = 0$.
Each step is:
- Uniformly sampled from $\{-1, 1\}$ if $X > 0$
- Uniformly sampled from $\{0, 1\}$ if $X = 0$.
The final position $X_n$ is given by the sum of all $n$ steps, and can only be positive as the walker can only stays at $0$ or go to $1$ when located at $0$. The main difference with a classical random walk is that, at the origin, the walker as a $\frac{1}{2}$ probability of not moving.
What is the probability distribution of such random walk?
Especially, what is the probability that the walker ends up at the origin $X_0 = 0$ after $n$ steps? And what is the probability that the walker ends up at any point $p \in \mathbb{N}$ after $n$ steps?
We can model the problem by a Markov chain with states $S = \{0, 1, 2, ..., n\}$. Each state of the Markov chain represent a position that the walker can reach, so we don't need more than $n$ states (its impossible to reach further with $n$ steps).
The transition matrix would be as follows:
$$ T = \begin{pmatrix} 0.5 & 0.5 & 0 & 0 & 0 & ...\\ 0.5 & 0 & 0.5 & 0 & 0 & ... \\ 0 & 0.5 & 0 & 0.5 & 0 & ... \\ 0 & 0 & 0.5 & 0 & 0.5 & ... \\ ... & ... & ... & ... & ... & ... \end{pmatrix} $$
If we are interested in the location after $n$ steps, we can define this matrix with a size $n \times n$.
Then, to compute the probability $P_{ij}(n)$, the probability to reach the state $j$ from the state $i$ after $n$ steps, we can use the Chapman-Kolmogorov equation:
$$ P_{ij}(n) = T^n_{ij} $$