TITLE: Intuitive explanation to Probability question
QUESTION [6 upvotes]: I have \$3. I flip a coin. If I get heads, I get \$1. If I get tails, I lose \$1. The game stops when I have \$0 or \$7. What is the probability I get \$7?
I solved this by creating a system of linear equations, where $P_0 = 0$, $P_7 = 1$, and $P_x = 0.5 \cdot P_{x-1} + 0.5 \cdot P_{x+1}$. Solving them, I got $P_3 = 3/7$. Moreover, $P_x = x/7$. Why does it work out to such a simple fraction?
More generally, it seems that $P_{x,y} = x/y$, which is the probability that, starting from x dollars, I end up with y dollars. I haven't proven this, but why is this the case?
Finally, what is $P_{x,y,p}$, where I gain 1 dollar with probability $p$ instead of probability 0.5 .

REPLY [2 votes]: Ori Gurel-Gurervich's comment suggests a very simple way to use a martingale (an example of a Wald martingale) to evaluate the final question in which the probability of gaining a dollar is $p \ne \frac12$. 
If $m(t)$ is how much money you have at time $t$, then $m(t)$ is not a martingale for $p \ne \frac12$. However, for the right base $C$, $C^{m(t)}$ is a martingale: $E (C^{m(t+1)}) = E(C^{m(t)})$. That means we can use the same argument that the starting value of a martingale is the average of the stopping values to compute the probabilities of ending at $0$ or $y$, or even of escaping to $\infty$ (with a bit more technical work). 
The right value of $C$ is $(1-p)/p$. You start at $C^x$ and end at $C^y$ or $C^0 = 1$, so if you finish with probability 1 (easy to prove with another martingale) you end up at $C^y$ with probability $(1-C^x)/(1-C^y)$, and you end up at $C^0$ with the complementary probability $(C^x-C^y)/(1-C^y)$. 
When $p \sim \frac12$, $C^x \sim 1- x \epsilon$ and $C^y \sim 1-y\epsilon$, which is continuous with the case $p=\frac12$. 
If you don't stop at $y$, the probability that you escape to $\infty$ is $0$ if $p \le 1/2$ and $1-C^x$ if $p \gt 1/2$, which makes the probability of ruin $C^x$.