Risk of Ruin Last Revised 1/15/92 Copyright 1991, 1992 Michael Hall Permission to copy for own use This is really seven articles in one: I. What is the risk of ruin for a given bankroll and given win goal? II. How many units of bankroll for a given risk of ruin? III. How long will it take to go broke or win a goal amount? IV. What is the chance of taking a loss after N hands? V. George C. on the Ruin Formula VI. Mason Malmuth on the Ruin Formula VII. How about some C code? Although blackjack is frequently used as an example here, the results can be applied to other gambling games. ========================================================================== I. What is the risk of ruin for a given bankroll and given win goal? This can be estimated using the standard ruin formula, with the bankroll adjusted to reflect the standard deviation, as shown by Griffin in "Theory of Blackjack". The average squared win is very nearly the variance (i.e. the standard deviation squared), more precisely it is the variance plus the square of the win per hand. You can approximate the game of blackjack by betting the square root of the average squared wager on a biased coin with P(heads) = 0.5 + wph/2sqrt(asw), where asw is the average squared wager and wph is the expected win. So, here P(heads)= 0.5+.0151/(2sqrt(3.887)) = 0.5038. The ruin formula is: R = (1 - S^b)/(1 - S^(a+b)) where R is the probability of ruin from 0 (none) to 1 (always) a is a'/sqrt(asw), the coin toss bankroll b is b'/sqrt(asw), the amount to be won in coin toss units S is P/(1-P), the ratio of a coin winning to losing P is 0.5 + wph/2asw, the bias of the coin wph is the win per hand asw is s^2 + wph^2, the average squared win Suppose we wish to double a bankroll of 300 basic units. The bet size effectively reduces this to a=b=300/sqrt(3.887)=152.16 units. S=0.5038/(1-0.5038)= 1.0153. So R=(1-1.0153^152.16)/(1-1.0153^(152.16*2)) =9.0%. And here's the same formula, fully expanded: /sqrt(s^2 + wph^2) + wph\(b'/sqrt(s^2 + wph^2)) 1 - | ----------------------- | \sqrt(s^2 + wph^2) - wph/ R = ------------------------------- /sqrt(s^2 + wph^2) + wph\((a'+b')/sqrt(s^2 + wph^2)) 1 - | ----------------------- | \sqrt(s^2 + wph^2) - wph/ where R is the chance of ruin from 0 (none) to 1 (always) s^2 is the variance (i.e. square of the standard deviation s) wph is the win per hand in units a' is the blackjack bank size in units b' is the number of blackjack units we want to win (usually = a') If S = 1 (i.e. the game is even), then use this formula instead: R = b / (a + b) where R is the chance of ruin from 0 (none) to 1 (always) a is a'/sqrt(asw) b is b'/sqrt(asw) Here's some more examples, with the wph and s^2 as above. Here are the probabilities of ruin before doubling for breaking your bankroll into various numbers of units: CHANCE RUIN BEFORE DOUBLE ~1.5% advantage ~1.0% advantage ~0.5% advantage BANKROLL wph=0.2265 wph=0.151 wph=0.0755 -------- --------------- -------------- --------------- 100 23.8 31.5 40.4 200 8.9 17.5 31.5 300 2.9 8.9 23.8 400 0.9 4.3 17.5 500 0.2 2.0 12.5 600 0.09 0.9 8.9 700 0.03 0.4 6.2 800 0.009 0.1 4.3 900 0.003 0.09 2.9 1000 0.0009 0.04 2.0 Note: above probabilities do not apply to Frank "Almost Never Lose 40 Units" Irwin ;-) They also do not apply to Kelly Criterion bettors, but Kelly Criterion (betting proportional to current bankroll and advantage) is not practical to apply exactly in practice. ========================================================================== II. How many units of bankroll for a given risk of ruin? A special case of the ruin formula given before is the following for when we wish to *double* the bankroll: 1 R = ------- 1 + S^n where R is the risk of ruin S is the ratio of winning to losing n is the units of coin toss bankroll We can solve this in terms of n, to answer the above question, and we get: log((1/R) - 1) n = -------------- log(S) Expanding this out to head off possible confusion: log((1/R) - 1) a'= ----------------------------(sqrt(s^2 + wph^2)) /sqrt(s^2 + wph^2) + wph\ log| ---------------------- | \sqrt(s^2 + wph^2) - wph/ where R is the risk of ruin wph is the win per hand s^2 is the variance of wph a' is the necessary units of blackjack bankroll For example, plugging in R=.09, S^2=3.88681, wph=.0151, then a'~= 300. In other words, if you are willing to risk a 9% risk of ruin and use a 1-4 spread under conditions similar to my computer simulation, then you should use 300 units of bankroll. I don't believe there is any published blackjack book that accurately explains the bankroll requirements of blackjack. In fact, most of them are just plain wrong when it comes to this. This is confirmed by the full double-or-nothing simulations of myself and also independently on a different simulator by a rec.gambler who is no longer with us. For example, a 400 unit bankroll with the above single deck situation has (only) about a 80% chance of doubling before ruin, according to the simulations, which is about what we'd expect from using the ruin formula. ========================================================================== III. How long will it take to go broke or win a goal amount? From Epstein's _Theory of Gambling and Statistical Logic_, page 66: the expected number of plays before ruin or win limit of a gambler is: z a[1-(q/p)^z] E(n) = ---------- - --------------------- for p<>q (q-p)(1-r) (q-p)(1-r)[1-(q/p)^a] where E(n) is the expected number of plays before ruin or win limit n is the number of plays z is the initial capital a is the desired final capital (a > z, z-a is the desired win) p is the probability of a win q is the probability of a loss r is the probability of a tie Peter Griffin claims we can approximate blackjack by choosing p=0.5 + wph/2sqrt(asw), where asw is the average squared wager and wph is the expected win, with q=1-p and r=0. With the numbers wph=.0086 and asw=7.63 (for an 8 deck shoe, AC rules, abandoning counts of -1 or worse) then p=.5015567. Suppose z=100, and a=200, and so E(n)=9689. Thus, it would take 9689 hands on average, around 97 hours, to double or nothing 100 units on this shoe game. There are other formulas that are sometimes useful. For an even game use: z(a-z) E(n) = ------ for p = q 1 - r For an infinite win limit "a", use: z E(n) = ---------- for p < q (q-p)(1-r) E(n) = undefined for p > q E(n) = infinity for p = q For intelligent card counters, p > q, and so it doesn't make much sense to talk about the average time to ruin or winning an infinite amount. Although sometimes a card counter will go broke with a fixed unit size, sometimes a card counter *will* win an infinite amount if left to play forever. p < q represents the case of most gamblers, such as craps players, who are doomed to lose if they play long enough and so it's only a matter of how long it will take. ========================================================================== IV. What is the chance of taking a loss after N hands? Assuming the risk of ruin is low and the number of hands is more than 100 or so, the Central Limit Theorem makes the distribution normal. The mean and standard deviation of this normal distribution can be computed from the expected win per hand and the standard deviation per hand. z = (x-u)/s*sqrt(N), where z is the standardized normal variable, x is the point of interest (zero, if we want to know the chance of taking a loss), u is the expected win, s is the standard deviation, and N is the number of hands. Let's say N=40, then z=(-50-(40*.0151))/(sqrt(3.887*40))=-4.0583. Don't have my tables handy, but I'm sure that's pretty much off the scale, close to 0%. That seems reasonable, since it is pretty hard to lose 50 units in just 40 hands, even if you are spreading 1-4. I would, however, expect the "actual" figure to be a bit higher (due to the 4 unit bets having an extra large influence in the space of only 40 hands.) ========================================================================== V. George C. on the Ruin Formula From "The Ruin Formula", by George C., Blackjack Forum, September 1988... George shows how to compute variance, like so: 6 Decks Strip Rules w/DDAS, 75% Penetration Advantage Hands/Hour Bet Squared $ Product $ --------- ---------- ------------- --------- -3.4% 1.0 10000 10000 -2.9% 2.0 10000 20000 -2.4% 3.0 10000 30000 -1.9% 4.0 10000 40000 -1.4% 8.0 10000 80000 -0.9% 13.0 10000 130000 -0.4% 35.5 10000 355000 0.1% 13.0 40000 520000 0.6% 8.0 250000 2000000 1.1% 4.0 562500 2250000 1.6% 3.0 2250000 6750000 2.1% 2.0 2250000 4500000 2.6% 2.0 2250000 4500000 3.1% 1.0 2250000 2250000 3.6% 0.5 2250000 1125000 Sum of Products 24560000 Sq Root of Products 4956 Times 1.1 5451 = Hourly standard deviation in $ Note: When bet size goes to $1000, it is assumed player will play two hands of $500 each, then 2 hands of $1000 each [treated above as a bet of .75*2*bet]. The above is a reasonable method of computing variance from frequency distributions. George C. does his statistics in "hourly" units, i.e. 100 hands. Using the above chart, you can obviously come up with things like the hourly win rate too. Then George comes up with this version of the Ruin Formula: h /1 + w/v\ | ------- | - 1 \1 - w/v/ R = -------------------- s+h /1 + w/v\ | ------- | - 1 \1 - w/v/ where R is the probability of ruin w is the hourly expected win (in units) v is the hourly variance h is the hours of play s is the stake (or size of bank) He wants to figure out what his chance of halving his bank of $150,000 before doubling it is... George C.: "Since I should average $392/hour, it will take me 383 hours to double my bank of $150,000 (i.e., divide the bank size, $150k, by the hourly expectation, $392, to get 383 hours.) I want to know what my chances are of halving my bank so I divide $75,000 (half of my bank) by $500 to obtain how many units of bank I have. That equals 150 units." [George calls $500 his unit size, even though he goes down to $100 bets in bad counts, but that's okay, so long as we know what he means.] George substitutes the values w=.783,v=119,h=383,s=150 to get .14, or a 14% chance of halving his bank of 300 $500 units before doubling it. Nrrrrr.... but thanks for playing George C., and we have some nice consolation gifts for you as well as Chambliss and Rogenski. You just can't use whatever units you feel like in the ruin formula. My computations show a 11.2% chance of losing *half* the bankroll before doubling the whole bankroll. Note: general_ruin(1500.0, 1500.0, 27.016, .0392) = .013, and general_ruin( 750.0, 1500.0, 27.016, .0392) = .112, using the C code in another part of this article with $100 units. 27.016 is the variance in $100 units per hand (squared). George C.: "The answer you should get is .14 or about a 1 in 7 chance of losing half of your bank. Most high stake pros that I know play double the bet size I recommend here, considering the size of my bankroll..." I'm a bit puzzled by the "s+h" term in George's formula, and I tend to think it's totally bogus. s is the initial bankroll, while h is the hours. Whoh, ERROR type conflict. We can see the problem in George's approach by switching to a different unit size for the time, which shouldn't change the risk of ruin. Let's say instead of hours (i.e. 100 hands), how about 100 hours (i.e. 10,000 hands)? This divides the necessary units of time by 100, and multiples the variance and win by 100. Georges formula then spits out 2.463%, whereas with hourly units the answer was 14%. Clearly something wrong here. Could be me, but I think it's George. George's formula will work if you enter the data in terms of hands and bet units. Instead of hours, for "h" use the number of units you wish to win. ========================================================================== VI. Mason Malmuth on the Ruin Formula From a letter to the editor, by Mason Malmuth, Blackjack Forum, December 1988... Mason Malmuth: "George C's article on `The Ruin Formula' (BJ VIII #3) was very well done, [NOT!] but if you use the method give in my book, `Gambling Theory and Other Topics', you can extend these ideas even further and produce what I think are even more interesting numbers. Specifically, consider the following equation: LL = (WR)(N)-(3)(SD)sqrt(N) where LL is your lower limit, WR is your win rate per hour, N is the number of hours you play, and SD is the standard deviation. For all practical purposes, this is the equation that gives the lower limit (at three standard deviations) for how you would do for some period of time. That is, for practical purposes, this equation is your worst possible result." Okay, let's apply Mason's equation to George's problem, so WR=392, N=383, SD=5451, producing LL=-169898.00. Actually, come to think of it this doesn't really give you much of an indication as to your risk of ruin during those 383 hours - it is just the worst result you would expect after 383 hours IF YOU HAD AN INFINITE BANKROLL. But Mason Malmuth continues: "Going one step further, if we take the above equation and take the first derivative with respect to N, set it to zero, and solve for N, we find the number of hours where our bankroll can by minimized 0 = WR - (3)(1/2)(SD)/(sqrt(N)) 2 / (3)(SD) \ N = | -------- | \ (2)(WR) / Now by substituting this value back into the original lower limit equation, we produce practical bankroll requirements. In George C's example WR=.783, and SD=10.9. Thus N=436, 2 / (3)(10.9) \ 436 = | --------- | \ (2)(.783) / and the required bankroll is 341 units. -341 = (.783)(436)-(3)(10.9)sqrt(436)" First, note that 341 units is 341 of George C's $500 units, which is really 1705 $100 units, or $170,500. Using my version of the ruin formula, I calculate a 0.7% chance of ruin before doubling 1705 $100 units, under George C's conditions. Mason's technique seems to work okay, but I'd trust the ruin formula more. Part II of this article gave a means of determining bankroll size for a given risk of ruin. ========================================================================== VII. How about some C code? And finally, here's some C code to do the ruin formula above... Compile by doing something like: cc -c ruin.c cc -o ruin ruin.o /usr/lib/libm.a /* Gambling ruin formulas. Version 1.1. Copyright 1991, Michael Hall Permission to use pretty much however you want, but at your own risk of ruin :-) */ #include #define sqr(X) (X * X) /* Just a test. Should print following (approximately): 0.088595 300.0 */ main() { double general_ruin(), bankroll(); printf("%f\n", general_ruin(300.0, 300.0, 3.886851, 0.0151)); printf("%f\n", bankroll(0.088595, 3.886851, 0.0151)); } /* Probability of ruin when trying to win "bb" units starting with "aa" units of bankroll on a gambling game where the expected win (or loss) per trial is "wph" and the variance is "s2". Note that "aa" and "bb" are doubles, just like the other parameters. */ double general_ruin (aa, bb, s2, wph) double aa, bb, s2, wph; { double coin_units, a, b, S, asw, compute_asw(), coin_bet_size(), big_S(), coin_ruin(); asw = compute_asw(s2, wph); coin_units = coin_bet_size(asw); a = aa / coin_units; b = bb / coin_units; S = big_S(s2, wph); return(coin_ruin(a, b, S)); } /* Generates proper bankroll size for doubling given a desired risk of ruin and the other information as above. */ double bankroll (R, s2, wph) double R, s2, wph; { double S, coin_size, coin_bet_size(), coin_bankroll(); S = big_S(s2, wph); coin_size = coin_bet_size(s2, wph); return(coin_bankroll(R, S) * coin_size); } double coin_bankroll(R, S) double R, S; { double log(); return(log((1.0 / R) - 1)/log(S)); } /* asw is the average squared win, which is a simple function of s2 and wph. */ double compute_asw(s2, wph) double s2, wph; { return(s2 + sqr(wph)); } /* Number of units to bet on a coin tossing game, to get the same mean and variance as the more general game with asw average squared wager. */ double coin_bet_size(asw) double asw; { double sqrt(); return(sqrt(asw)); } /* The big S in the coin ruin formula. */ double big_S(asw, wph) double asw, wph; { double sqrt(); return((sqrt(asw) + wph) / (sqrt(asw) - wph)); } /* Probability of ruin when trying to win "b" units starting with "a" units of bankroll on a biased coin tossing game where "S" is the ratio of the probability of winning to the probability of losing (i.e. P/(1-P) where P is the probability of winning. */ double coin_ruin (a, b, S) double a, b, S; { double pow(); return((1.0 - pow(S,b)) / (1.0 - pow(S,a + b))); }