Reaching a level before another for a random walk Suppose we are given a simple random walk starting in $0$, i.e. $(X_k)_{k\in\mathbb{N}}$ with $P[X_k=+1]=P[X_k=-1]=\frac{1}{2}$. What is the probability of hitting the level $a$ before hitting the level $b$, where we assume $b<0<a$ and $|a|\le |b|$. Let's define
$$T_a:=\inf\{n|S_n=a\}$$
and similarly
$$ T_b:=\inf\{n|S_n=b\}$$
where $S_n:=\sum_{i=1}^nX_i$.
Therefore we are interested in the probability $$P[T_a< T_b]$$ I think one needs the reflection principle at some point, but I'm not sure how it is exactly applied.
 A: Hint: Since $(S_n)_{n \in \mathbb N}$ is a martingale, you can use the fact that $$\begin{align*}E[S_T]&=aP(S_T=a)+bP(S_T=b)=\\&=aP(S_T=a)+b(1-P(S_T=a))=(a-b)(P(S_T=a))+b=\\&=(a-b)P(T_a<T_b)+b\end{align*}$$ (where $S_T=\inf\{n|S_n \in \{a,b\}\}$) and the optional stopping theorem, i.e. that $$E[S_T]=E[S_0]=0$$ to deduce that
$$P(S_T=a)=P(T_a<T_b)=\frac{-b}{a-b}$$
A: @Jimmy R. Wondering how important is the original assumption: $b<0<a$ and especially $ \lvert a \rvert \leq \lvert b\rvert$. I didn't see where the above answer using this information.
I'm having a different assumption. What is the probability of hitting the level b before hitting the level a, which $b<0<a$ but $\lvert a \rvert \geq \lvert b\rvert$.
Here's the similar rewrite based on my assumption here. 
$S_T=inf\{n|S_n \in \{a,b \} \}$
Since $S_n$ is a martingale, based on optimal stopping theorem, $E[S_T]=E[S_0]$ and $E[S_0]=0$.
$E[S_T]=a*P(S_T=a)+(-b)*P(S_T=b)=a[1-P(S_T=b)]+(-b)*P(S_T=b)=a-(a+b)*P(S_T=b)=a-(a+b)*(T_b < T_a)$
Hence, we can derive that $(T_b < T_a)=\frac{a}{a+b}$
