## Mathematical Calculation of Risk of Ruin For a Fixed EV

Applies to a fixed expectation with a fixed bet of 1 unit

let win = probability of win
let loss = probability of loss
let tie = probability of tie (win + loss + tie = 1)
let bank = number of units gambler is willing to risk
let profit = number of units gambler hopes to win
let goal = bank + profit = number of units gambler wishes to achieve
let Sbank = probability of succeeding with bank units

Sgoal = 1, since if goal is reached chance of success = 1
S0 = 0, since if gambler has 0 units chance of success = 0
Sbank = win*Sbank+1 + loss*Sbank-1 + tie*Sbank

Since win + loss + tie = 1

1. (win + loss + tie) * Sbank = win*Sbank+1 + loss*Sbank-1 + tie*Sbank
2. win*Sbank + loss*Sbank + tie*Sbank = win*Sbank+1 + loss*Sbank-1 + tie*Sbank
3. win*Sbank + loss*Sbank = win*Sbank+1 + loss*Sbank-1
4. win*(Sbank+1 - Sbank) = loss*(Sbank - Sbank-1)
5. Sbank+1 - Sbank = loss/win*(Sbank - Sbank-1)
6. if bank = 1, S2 - S1 = loss/win*(S1 - S0)
7. since S0 = 0, S2 - S1 = loss/win*(S1)
8. if bank = 2, S3 - S2 = loss/win*(S2 - S1)
9. since S2 - S1 = loss/win*(S1), S3 - S2 = (loss/win)2 * S1
10. in general if bank = x, Sx+1 - Sx = (loss/win)x * S1 where (0 < x < goal)
11. Sum(Sx+1 - Sx) = Sum((loss/win)x * S1) as x varies from 1 to x
12. Sum(Sx+1 - Sx) = (S2-S1)+(S3-S2)+(S4-S3)+....+(Sx-Sx-1)+(Sx+1-Sx) as x varies from 1 to x
13. Sum(Sx+1 - Sx) = Sx+1 - S1 = Sum((loss/win)x * S1) as x varies from 1 to x
14. Sx+1 = S1 + Sum((loss/win)x * S1) as x varies from 1 to x
15. Sx+1 = S1 * (1 + Sum((loss/win)x) as x varies from 1 to x
16. since (loss/win)0 = 1, Sx+1 = Sum((loss/win)x) as x varies from 0 to x
17. Sum((loss / win)x) is the sum of a geometric sequence whose initial term equals 1
18. Sx+1 = S1 * (1 - (loss/win)x+1) / (1 - loss/win)
19. Let x = goal - 1 and since Sgoal = 1, 1 = S1 * (1 - (loss/win)goal) / (1 - loss/win)
20. S1 = (1 - loss/win) / (1 - (loss/win)goal)
21. substituting 20 into 18, Sx+1 = (1 - (loss/win)x+1) / (1 - (loss/win)goal)
22. if x = bank - 1, Sbank = (1 - (loss/win)bank) / (1 - (loss/win)goal)
23. Sbank = (1 - (loss/win)bank) / (1 - (loss/win)goal) = probability of reaching goal with bank units

Let R = probability of ruin
R = (1 - probability of success) = (1 - Sbank)
R = 1 - (1 - (loss/win)bank) / (1 - (loss/win)goal)
R = (1 - (loss/win)goal) / (1 - (loss/win)goal) - (1 - (loss/win)bank) / (1 - (loss/win)goal)
R = ((loss/win)bank - (loss/win)goal) / (1 - (loss/win)goal) = probability of of being ruined with a bank of bank units and a goal of goal units