Recursionhard
0:00.0

In the Gambler's Ruin problem, the probability P(k)P(k) of reaching nn dollars (winning) before going broke (reaching $0), starting from kk dollars, satisfies: P(k)=12P(k−1)+12P(k+1)P(k) = \frac{1}{2}P(k-1) + \frac{1}{2}P(k+1) with boundary conditions P(0)=0P(0) = 0 and P(n)=1P(n) = 1. This rearranges to the linear recurrence P(k+1)−2P(k)+P(k−1)=0P(k+1) - 2P(k) + P(k-1) = 0. Which is the closed form for P(k)P(k)?