$x_t$ is a random walk with nonnegative integer time $t$ on the integer set $\mathbf Z$ with transition probability $P(x_{t+1}\mid x_t)=p\mathbf 1(x_{t+1}-x_t=1)+q\mathbf 1(x_{t+1}-x_t=-1)$, $p>0,\,q>0$, $p+q=1$ and $p\ne q$. I know $y_t := \big(\frac qp\big)^{x_t}$ is a martingale. Given $x_0=0$, $\tau:=\min\{t:x_t=a>0\,\vee x_t=-b\}$ where $a,b\in \mathbf N$.
Can anyone remind me of the martingales that give the expected value and the variance of the first exit time $\tau$, perhaps utilizing $y_t$? What is the relationship between the martingales and the probability generating function of the first exit time?
It is so very simple. The extra martingale is merely the natural "speed function" $z_t:=x_t-t(p-q)$. It is obvious that $z_t$ is a martingale. Now let $\tau:=\inf\{t: x_t\ge a\,\wedge\, x_t\le -b \}$. By Doob's optional stopping theorem, $\big(\frac pq\big)^{x_0}=\mathbf E[y_\tau]=P\big(\frac pq\big)^a+Q\big(\frac pq\big)^{-b}$, where $P=\text{Prob}(x_\tau=a)$ and $P+Q=1$. We can solve for $P$ and $Q$. Applying again Doob's optional stopping theorem $x_0=\mathbf E[z_\tau]=aP-bQ-(p-q)\mathbf E[\tau]$. We can now solve for $\mathbf E[\tau]$.