How do you calculate odds of successive rolls in "x of outcome 1 before y of outcome 2" scenarios? I'm specifically trying to figure out how much effect certain adjustments to the death save mechanic have on dnd5e's lethality, but it would also be useful for estimating things like montage tests in Draw Steel.
Fortunately, death saving throws are a lot simpler than the general case of "X of outcome 1 before Y of outcome 2" because (probability of outcome 1 + probability of outcome 2) equals 1; the presence of a "neither" case can throw a monkey into the wrench.
Since there's no "neither" outcome, the number of rolls you can possibly make is bounded; "three successes before three failures", for example, will never exceed five rolls, because after the fifth roll you're guaranteed to have at least three of one outcome or the other. That makes it possible to enumerate every possible sequence of outcomes:
SSS SSFS SFSS FSSS SSFFS SFSFS FSSFS SFFSS FSFSS FFSSS FFSSF FSFSF SFFSF FSSFF SFSFF SSFFF FFSF FSFF SFFF FFF
Let's assume that our S (success) result is rolling a 4 on 1d4, and our F (failure) result is rolling anything else. We can then work out the odds of each case, like so:
SSS = 1/64 = 16/1024 SSFS = 3/256 = 12/1024 SFSS = 3/256 = 12/1024 FSSS = 3/256 = 12/1024 SSFFS = 9/1024 SFSFS = 9/1024 FSSFS = 9/1024 SFFSS = 9/1024 FSFSS = 9/1024 FFSSS = 9/1024 FFSSF = 27/1024 FSFSF = 27/1024 SFFSF = 27/1024 FSSFF = 27/1024 SFSFF = 27/1024 SSFFF = 27/1024 FFSF = 27/256 = 108/1024 FSFF = 27/256 = 108/1024 SFFF = 27/256 = 108/1024 FFF = 27/64 = 432/1024
Adding up our target outcomes, we get 106/1024 odds of three successes before three failures, and 918/1024 odds of three failures before three successes. (If these don't add up to 1, you know you missed a case somewhere.)
Once we've got the symmetrical case (i.e., X successes before X failures), we can deal with asymmetrical cases simply by changing up which rows in the probability tree we've already constructed count as which outcome – we needn't start from scratch. For example, the odds of two successes before three failures moves all the 27/1024 rows in the above table into the "overall success" bucket, and we arrive at 268/1024 odds. Similarly, "three successes before two failures" would flip the 9/1024 rows over to the "overall failure" bucket.
(Now that we know what's going on "under the hood", the obvious follow-up question is "is there a general formula I can use to skip constructing the probability tree and get the answer directly?". The answer is "probably, but I don't recall it off the top of my head". If we're lucky, one of the several mathematicians following this blog will be able to correct my omission!)










