Let $(X_i)_{n\in\mathbb{N}}$ be independent with $\mathbb{P}(X_i=1)=p=1-\mathbb{P}(X_i=-1)$, $i\in\mathbb{N}$.Let $a,b\in\mathbb{N}$. For $n\in\mathbb{N}$, let $S_n=\sum_{i=1}^nX_i$ and finally $\tau$ be the first hitting time of $\{ -a,b\}$ by $(S_n)_n$.
For $p=\frac{1}{2}$, I can calculate $\mathbb{P}(S_\tau = b$) as follows:
For $x\in\mathbb{N}\cap [-a,b]$, let $\tau_x$ be the first hitting time of $\{ -a,b\}$ by $(x+S_n)_n$ and $\phi (x)=\mathbb{P}(x+S_{\tau_x}=b)$. Then we see that $\phi(-a)=0$, $\phi(b)=1$ and $$\phi (x)=\frac{1}{2}\phi (x+1) + \frac{1}{2}\phi (x-1) \quad \mbox{for }x\notin\{-a,b\}.$$ Hence, $\phi(x)=mx+n$ for some $m,n\in\mathbb{N}$ (we can use the formula above for induction) and with the two boundary conditions, we can calculate $\phi (0)$.
My Question:
I want to generalize the solution above to arbitrary $p\in (0,1)$. But I don't recognise the function $\phi$ after calculating $\phi(x)$ for $x=-a+1,\dots ,-a+5$. Does anybody recognise it or maybe even have a more elegant idea to obtain $\phi$?
These are the values I calculated:
\begin{align}
\phi(-a)&=0\cdot \phi(-a+1)\\
\phi(-a+1)&=1\cdot\phi(-a+1)\\
\phi(-a+2)&=\frac{1}{p}\cdot\phi(-a+1)\\
\phi(-a+3)&=\frac{1}{p^2}(p^2-p+1)\cdot\phi(-a+1)\\
\phi(-a+4)&=\frac{1}{p^3}(2p^2-2p+1)\cdot\phi(-a+1)\\
\phi(-a+5)&=\frac{1}{p^4}(p^4-2p^3+4p^2-3p+1)\cdot\phi(-a+1)
\end{align}