I have to solve the following situation about Random walk :
Let consider random walk in one dimension. Assume that each step we might move forward with probability $p$, and might move backward with probability $q = 1-p.$ I would like to compute the probability that in $n$ moves I go back to the initial point exactly $r$ times, $0 \leq r \leq n$.
I think of it a kind of random walk with Binomial trials, like if I set $$ X =\# \ \mbox{of success} $$ when success mean I reach the initial point. Then I am interested in $\mathbb{P}(X = r)$. But the success probability is not constant, so it is not Binomail (just something analogous in trials manner)
Could anyone suggest what I should do to calculate the probability ? And even better how can I find its probability function ?