This is preparation for an exam I have coming up, not an assignment. Hope you won't mind helping.
I've got a random walk, $Y_m, m = 0,1,2, \dots$ on $S = \{0,1,2,\dots,N\}$ with periodic boundaries at $0$ and $N$. The probability of going from $n$ to $n+1$ in the walk is $p$, the probability of going from $n$ to $n-1$ is $q$.
When we reach $N$ we are able to "loop around" to state $0$ with probability $p$. Likewise, at state $0$ we can loop to state $N$ with probability $q$.
Suppose $Y_0 = k$, let $\tau = \inf\{m \geq 0: Y_m = 0\}$ be the time where the process hits state $0$. For $p \neq q$, find $\mathbb{E}(\tau)$
I want to use Wald's lemma.
Would I be able to say this process is and problem is similar to another random walk, $X_m$ where $X_0=0$, and define another stopping time $\hat{\tau} = \inf\{m \geq 0: X_m = -k\}$ , so that $X_m = \sum_{i = 0}^m Z_i$ where $\mathbb{P}(Z_i = 1) = p$ and $\mathbb{P}(Z_i = -1) = q$.
It seems to me like $\tau$ and $\hat{\tau}$ are equivalent.
So by Wald's lemma, $\mathbb{E}(X_{\tau}) = \mathbb{E}(Z_1) \mathbb{E}(\tau)$, and it's apparent that $\mathbb{E}(X_{\tau}) = -k$ and $\mathbb{E}(Z_1) = p - q$, so that $\mathbb{E}(\tau) = \frac{k}{q - p}$.
Just wondering if I've gone about this correctly. Not entirely sure.
Many thanks.
The answer is wrong because you did not account for periodicity, i.e., the process terminating at $-k+N+1$. Notice that your formula for $E(\tau)$ is increasing with $k$. But we should expect that $E(\tau)$ is small when $k$ is close to $N$.
Unwrap the circle, we get the states $0,1,\dots,N,N+1$ where both $0$ and $N+1$ are terminal. We want to know the expected time of arrival at a terminal state, starting from $k$. First, it helps to figure out the probability of ending at $N+1$ rather than at $0$. Let $P(k)$ be this probability. Then $P(0)=0$, $P(N+1)=1$, and $$P(k) = pP(k+1)+q P(k-1) \tag{1}$$ (I am assuming $p+q=1$; modify if this is not the case). The solution can be guessed: $$P(k) = \frac{e^{ rk}-1}{e^{ r(N+1)}-1} \tag2$$ where $r$ is such that $pe^r+qe^{-r}=1$; this is what we get by plugging (2) into (1).
Since the expected value of random walk at exit time is $(N+1)P(k)$, it follows that the mean exit time starting at $k$ is $$ T(k) =\frac{1}{p-q} \left( (N+1) \frac{e^{ rk}-1}{e^{ r(N+1)}-1} - k \right) \tag3 $$
Just to be sure, I ran an numerical experiment for $p=0.7$, $q=0.3$, $N=20$. Red curve is formula (3), blue is the mean exit time over 5000 sample paths.