finding the generating function $\phi(s) = \mathbb{E}(s^{H_0})$. i just started the course of markov chains and i'm having a few problems with one of the excercises.
Let $Y_1,Y_2, \dots$ be i.i.d random variables with:
$\mathbb{P}(Y_1 = 1) = \mathbb{P}(Y_1 = -1) = \frac{1}{2}$ and set $X_0 = 1, X_n = X_0 + Y_1+ \cdots + Y_n$ for $n \geq0$. Further define:
$$H_0 = \inf\{n \geq0: X_n = 0\}$$
find $\phi(s) = \mathbb{E}(s^{H_0})$.
Know i know that for $0 \leq s < 1$ we have:
$$\phi(s) = \mathbb{E}(s^{H_0}) = \sum_{n<\infty} s^n \mathbb{P} (H_0 = n)$$
the most confusing part is how do i know when $X_n = 0$? The most logical thing to do here for me is to take $n = 1$, then $X_1 = X_0 + Y_1$ and $\mathbb{P}(X_1 = 0) = \mathbb{P}(X_0 = 1,Y_1 = -1) = \mathbb{P}(X_0 = 1)\mathbb{P}(Y_1 = -1) = \frac{1}{2}$
So is $\phi(s) = \frac{1}{2}s$?
Help would be appreciated :)
Kees

If $Y_1=-1$, then $X_1=0$ hence $H_0=1$. If $Y_1=1$, then $X_1=2$ hence $H_0=1+H'_0+H''_0$, where, in the RHS, $1$ accounts for the first step, $H'_0$ for the time to hit $1$ starting from $2$ and $H''_0$ for the time to hit $0$ starting from $1$. Thus, $H'_0$ and $H''_0$ are independent and distributed like $H_0$. 
Turning to generating functions, this reads $$E(s^{H_0})=\frac12s+\frac12sE(s^{H_0})^2.$$ Solving the quadratics yields $$E(s^{H_0})=\frac{1\pm\sqrt{1-s^2}}s.$$ Finally, the LHS is $0$ when $s=0$ hence, for every $|s|\leqslant1$, $$E(s^{H_0})=\frac{1-\sqrt{1-s^2}}s=\frac{s}{1+\sqrt{1-s^2}}.$$
