Very often in the modeling of rare events in finance and insurance industry the analysts are interested in both the probability of events and their financial consequences. That revolves around the aspect of a *probability of ruin*, i.e. when one of two dealing parties becomes insolvent (loses all its assets).

The estimation of chances of going broke may be understood by considering the following gambler’s problem. Two parties X and Y start the game with $x$ and $y$ dollars. If X wins, and its probability of winning is $p$, Y pays $\$1$ to X. The game ends when one of the parties amasses all money, $\$(a+b)$.

Let’s denote by $u_{n+1}$ the probability that X wins and holds $\$(n+1)$. If X wins again with $p$ it will hold $\$(n+2)$ and probability of winning of $u_{n+2}$ or if Y wins with $q=1-p$, it will hold $\$n$ and $u_n$:

$$

u_{n+1} = pu_{n+2} + qu_n \ \ \mbox{for}\ \ 0 < n+1 < x+y.
$$
But because $u_{n+1} = pu_{n+1} + qu_{n+1}$ we get:
$$
(u_{n+2}-u_{n+1}) = \frac{q}{p}(u_{n+1}-u_n).
$$
Applying recurrence relation for the problem we may denote:
$$
(u_2-u_1) = \frac{q}{p}(u_1) \\
(u_3-u_2) = \frac{q}{p}(u_2-u1) = \left(\frac{q}{p}\right)^2 (u_1) \\
... \\
(u_i-u_{i-1}) = \left(\frac{q}{p}\right)^{i-1}(u_1) .
$$
Now, if we sum both sides we will find:
$$
(u_i-u_1) = \left[\sum_{j=1}^{i-1} \left(\frac{q}{p}\right)^{j}\right](u_1), \ \ \ \mbox{or} \\
u_i = \left[1+\frac{q}{p}+\left(\frac{q}{p}\right)^2+ ... + \left(\frac{q}{p}\right)^{i-1} \right](u_1)
$$
Doing maths, one can prove that:
$$
\left(1-\frac{q}{p}\right) \left[1+\sum_{j=1}^{i-1} \left(\frac{q}{p}\right)^{j} \right] = 1-\left(\frac{q}{p}\right)^i
$$
therefore for $p\neq q$ we have
$$
u_i = \left[ \frac{1-\left(\frac{q}{p}\right)^i}{1-\left(\frac{q}{p}\right)} \right] u_1 .
$$
Making a note that $u_{x+y}=1$, we evaluate it to:
$$
u_1 = \left[ \frac{1-\left(\frac{q}{p}\right)}{1-\left(\frac{q}{p}\right)^{x+y}} \right]u_{x+y}
$$
what generalized for $i$ gives
$$
u_i = \left[ \frac{1-\left(\frac{q}{p}\right)^i}{1-\left(\frac{q}{p}\right)^{x+y}} \right]
$$
therefore we have:
$$
u_x = \left[ \frac{1-\left(\frac{q}{p}\right)^x}{1-\left(\frac{q}{p}\right)^{x+y}}\right] .
$$
For the case of $p=q=\frac{1}{2}$ we have:
$$
u_x = \frac{x}{x+y} .
$$
So, what this $u_x$ means for us? Let's illustrate it using a real-life example.
**Learn to count cards before going to Las Vegas**

If you start playing poker-like game having $y=\$1000$ in your pocket and casino’s total cash that you may win equals $x=\$$50,000,000 but your winning rate solely depends on your luck (favorably, say your $q=1-p=0.49$, i.e. only a bit lower that bank’s odds to win) then your chances of going broke are equal $u_x = 1$. However, if you can count carts and do it consistently over and over again (now your q=0.51) then $u_x \approx 4 \times 10^{-18}$ what simply means you have a huge potential to be very rich over night using your skills and mathematics.