**Question: **A Markov chain whose state space is given by the integers i = 0,±1,±2, . . . is said to be a random walk if, for some number 0 < p < 1, P_{i},i+1 = p = 1 − P_{i},i−1, i = 0,±1, . . .

The preceding Markov chain is called a random walk for we may think of it as being a model for an individual walking on a straight line who at each point of time either takes one step to the right with probability p or one step to the left with probability 1 − p.

**Analytical Solution**

N/A

**Simulation Solution**

This is not actually a solution since nothing has been asked to be solved in the example. This would be a preview of what we might see in this chapter. This one is a representation of a random walk and each of the element in the grid shows the simulation when the bias to the right is equal to p. As the value of p (the probability of towards the right) increases, we see the progression of the paths accordingly. Note that the randomness in the y-direction is intentional and to just represent the path. It has no significance for the left and right bias.

- p: the probability of moving to the right
- 1 – p: the probability of moving to the left
- All random walks start at {0, 0}

**Code**

Grid[Partition[#, 3], Frame -> All, FrameStyle -> Gray] &[ Table[With[{p = probability, range = 80}, Overlay[{Graphics[ Table[{Opacity@0.5, Thickness@0.0, Line[Accumulate[{RandomChoice[{p, 1 - p} -> {-1, 1}], RandomChoice[{-1, 1}]} & /@ Range[100]]]}, 1000], PlotRange -> ConstantArray[{-range, range}, 2], ImageSize -> 262], "p = " <> ToString[p]}]], {probability, Range[0.1, 0.9, 0.1]}]]

End of the post

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.