Let $X_1,X_2,..,X_n,...,$ be i.i.d. random variables with distribution $P(X_i=1)=p$ and $P(X_i=-1)=q$, $q<p$. Given $S_n=\sum_{i=1}^n X_i$ with $S_0=0$, $a,b$ positive integers and $T=\inf\{n\in\mathbb{N}\,|\, S_n=-a\,\,\text{or}\,\,S_n=b\}$.
How can I compute $P(S_T=-a)$, $P(S_T=b)$, and $E(T)$ using the fact that $Z_n=\left(\frac{q}{p}\right)^{S_n}$ and $Y_n=S_n-nE(X_1)$ are martingales under the usual filtration given by $\{X_n\}$?
I was thinking to apply the optional stopping theorem, but I am not sure how to apply it. If anyone could give some hint, I really appreciate it so much.
We may apply the optional stopping theorem to the first problem, because $|Z_{n \land T}| \leq r < \infty$ for some $r$, and get: $$1 = E(Z_0) = E(Z_T) = (q/p)^{-a} P(S_T = -a) + (q/p)^{b} P(S_T = b)$$
Using the fact that $P(S_T = b) = 1 - P(S_T = -a)$, we may rearrange to get: $$ \begin{align*} P(S_T = b) &= \frac{1- (q/p)^{-a}}{(q/p)^b - (q/p)^{-a}} \\ P(S_T = -a) &= \frac{(q/p)^b - 1}{(q/p)^b - (q/p)^{-a}} \end{align*}$$
To see that the optional stopping theorem holds for $Y_n$, note that it has bounded increments and that you may stochastically bound $Y_n$ by a geometric random variable (e.g. $T \leq (a+b)G$ where $G \sim Geo(q^{a+b})$) to get that $E(T) < \infty$.
You may also apply the optional stopping theorem to $Y_n$ to get: $$0 = E(Y_0) = E(Y_T) = E(S_T) - E(T)E(X_1)$$
So that $E(T) = E(S_T) / E(X_1)$, whose exact value you can now calculate from a previous question.