Let $[\xi_i]_{i\geq 0}$ be i.i.d. random variable with $\mathbb{P}(\xi_1=1)=\frac{p}{2} , \mathbb{P}(\xi_1=-1)=\frac{1-p}{2}$ and $\mathbb{P}(\xi_1=0)=\frac{1}{2}$ for some $p\in(1/2,1)$. Define $X_0 = 0$ and $X_n = \sum^n_i \xi_i$ , and $T:= \inf [n\in\mathbb{N} s.t. |X_n|\geq b]$. I want to calculate $\mathbb{E}(T)$.
I would like to see if this math is a correct solution for this.
let $Y_n = X^2_n -\frac{1}{2}n$, could be proved that $Y_n$ is a martingale. If $T$ is the time that hit $\pm b$ then by optional stopping theorem.
$$ 0 = \mathbb{E}(Y_0) = \mathbb{E}(Y_T) = \mathbb{E}(X^2_T) - \frac{1}{2}\mathbb{E}(T) \implies 2\mathbb{E}(X^2_T) = \mathbb{E}(T)$$
The probability that hits $b$ or $-b$ is the same and equal $\frac{1}{2}$ (can be proved but looks to me by the symmetry).
$$\mathbb{E}(X^2_T) = b^2\frac{1}{2}+(-b)^2\frac{1}{2}=b^2=\frac{1}{2}\mathbb{E}(T)$$
$(X_n)_n$ is known as the birth-and-death chain. Let $T_i := \inf\{n : X_n = i\}, i \in \mathbb{Z}$. Then, $T = T_b \wedge T_{-b}$ and $X_T = b$ if $T_b < T_{-b}$ and $X_T = -b$ if $T_b > T_{-b}$.
It is known that $$ \mathbb{P}(T_{-b} < T_{b}) = \frac{(1-p)^b}{p^b + (1-p)^{b}}. $$ This is also known as the gambler's ruin theorem. See Section 1.4 in Schinazi's book "Classical and Spacial Stochastic Processes" for example.
Here $Y_n := X_n - nE[\xi_1] = X_n - n\left(p - \frac{1}{2}\right)$ is a martingale with respect to the standard filtration $\mathcal{F}_n := \sigma(\xi_1, \dots, \xi_n)$. (We changed the definition. See also @Nate Eldredge's comment.) Hence $$E[X_T] - E[T] \left(p - \frac{1}{2}\right) = E[Y_T] = E[Y_1] = 0.$$
Here $$E[X_T] = b\mathbb{P}(T_b < T_{-b}) - b\mathbb{P}(T_b > T_{-b}) = b\frac{p^b - (1-p)^b}{p^b + (1-p)^{b}}.$$
Hence, $$E[T] = \frac{2b}{2p-1} \frac{p^b - (1-p)^b}{p^b + (1-p)^{b}}.$$