Gambler's Ruin - Probability of Losing in t Steps I would be surprised if this hasn't been asked before, but I cannot find it anywhere. 
Suppose we're given an instance of the gambler's ruin problem where the gambler starts off with $i$ dollars and at every step she wins 1 dollar with probability $p$ and loses a dollar with probability $q = 1 - p$. The gambler stops when she has lost all her money, or when she has $n$ dollars. I am interested in the probability that the gambler loses in $t$ steps. 
I know how to find the expected number of steps before reaching either absorbing state, and how to solve the probability that she loses before winning $n$ dollars, but this one is eluding me. Let $P_{i, t}$ be the probability that the gambler goes broke in $t$ steps given that she started with $i$ dollars. I have set up the recurrence:
$$ P_{i, t} = qP_{i-1, t-1} + pP_{i+1, t-1}$$
and we know that $P_{0, j} = 1$ and $P_{n, j} = 0$for all $j$, and $P_{i, 0} = 0$ for all $i > 0$. I'm struggling to solve this two dimensional recurrence.
If it turns out to be too hard to give closed form solutions for this, can we give tighter bounds than just the probability that the gambler ever loses? 
 A: Since my previous post has been deleted, I have no chance to show the detail of my knowledge in this problem. I decided to re-post what I knew here if the editors think it is appropriate.
This topic is under the "Complements and Details" of Chapter One on the book "Probability theory I" 4th edition written by M. Loeve on page 48. And I quote the solution as follows.
The gambler has $x$ dollars and wins or loses one dollar with respective probabilities $p$ and $q = 1-p$. Find the probability $P_{x,n}$ of his ruin at the $n$-th game, that is, starting at $x$ with $0 < x < a$ to arrive at $y \leq 0$ before reaching $y \geq a$.
\begin{equation*}
P_{x,n+1} = pP_{x+1,n} + qP_{x-1,n}
\end{equation*}
with $P_{0,a} = P_{a,n} = 0$ and $P_{0,0} = 1$, $P_{x,0} = 0$. The solution is
\begin{equation*}
P_{x,n} = a^{-1}2^{n}p^{(n-x)/2}q^{(n+x)/2} \sum_{k=1}^{a-1} \cos^{n-1}\frac{\pi k}{a}\sin \frac{\pi k}{a}\sin \frac{\pi kx}{a}
\end{equation*}
M. Loeve only provided his solution without any derivation.
A: I do not know if I misinterpret your question, but I think the probability of going to ruin in $t$ steps is just the probability of losing $i$ times more than winning.
Let $m$ be the number of wins, and $n$ be the number of losses, so obviously $m+n=t$
To lose means $n=m+i$, so $n=\frac{t-i}{2}$ and $m=\frac{t-3i}{2}$
$p_0(t) = p^{\frac{t-3i}{2}}\cdot q^{\frac{t-i}{2}}$
or if you mean "losing in $\leq t$ steps", this would change of course to 
$P_0(\leq t) = \sum_{k=i}^{t} p_0(k)$
A: The first (edited) answer is the correct probability for reaching 0 Dollars at exactly step t. That is an incorrect definition of ruin as @Andrew S points out.
It is not the probability of reaching 0 Dollars for the first time without having previously reached n Dollars, during t steps or fewer steps if 0 or n Dollars is reached earlier, which is the correct definition of ruin.
This is a tough problem. I do not know of a closed solution...only a closed approximation and a path-counting summing algorithm which counts and sums only the permitted paths from i Dollars to 0 Dollars for each step from 1 to t.
