Let us take a random walk as follows, $$X_0 = 0;\ X_n = \sum_{i=1}^{n} e_i$$
where, $$ e_n= \begin{cases} +1 \text{ with probability } p; \\ -1 \text{ with probability } q; \end{cases} $$ and all $e_n$ are independent variables, so I have to calculate
$$ \mathbb{P}(X_n\ge0,\forall\ n = 1,2,3,4 )$$
I know the standard results regarding random walks but I am drawing blanks here.
The following binary tree shows all possible ways that we can have the event $X_n \geq 0,\;\forall{n}\in\{1,2,3,4\}$
Number of ways favorable to the event = number of possible paths from the root node to a leaf node in the tree = number of leaf nodes in the tree = 6, with the total probability $P(X_n \geq 0)$ summing up to $p^4 + p^3q + p^2qp + p^2q^2 + pqp^2 + pqpq=p^2(p^2+3pq+2q^2)$