Consider the symmetric random walk $$S_n = \sum_{i=1}^n X_i$$ with $ X_i$ i.i.d., $P(X_1 = 1) = P(X_1 = -1) = \frac{1}{2}$. Let $a,b \in \mathbb N\setminus \{ 1 \}$ and put $$\tau := \inf \{n\in \mathbb N: S_n \in \{-a, 0 ,b\}\},$$ which is a stopping time. Show that $P(S_\tau = b) = \frac{1}{2b}, P(S_\tau = a ) = \frac{1}{2a}, P(S_\tau = 0) = 1 - \frac{a+b}{2ab}$ and $\mathbb E[\tau ] = \frac{1}{2}(a+b)$.
My attempt: As usual I considered the stopped martingale $$S^\tau := (S_{n\wedge \tau})_{n\in \mathbb N}.$$ We get by dominated convergence that $$0 = \mathbb E[S_\tau] = -aP(S_\tau = a) + bP(S_\tau = b).$$ However, I cannot find a second equation which I need in order to solve the above for $P(S_\tau = b)$. Any idea how I can maybe reduce this to the case where the stopping time is $\inf\{n\in \mathbb N: S_n \in \{-a,b\}\}$?
You can obtain a second equation by considering the martingale $S_n^2-n$, which allows you to compute $\mathbb E\tau$ but does not help you compute the probabilities in question. Instead, the approach suggested in the other answer does the trick: conditional on $X_1=1$, we have that $S_\tau$ is equal to the first exit from $\{0,b\}$, whereas conditional on $X_1=-1$ we have that $S_\tau$ is equal to the first exit from $\{-a,0\}$.
Thus, we compute $$ \mathbb P(S_\tau=b)=\mathbb P(X_1=1,\ S_\tau=b)=\frac{1}{2}\mathbb P(S_\tau=b\mid X_1=1), $$ and the latter probability is $\frac{1}{b}$ since it is equal to the probability of a random walk started at $0$ exiting $\{-1,b-1\}$ at $b-1$. We can compute $\mathbb P(S_\tau=-a)$ similarly, and then subtract from $1$ to obtain $\mathbb P(S_\tau=0)$.