# How do I calculate d20 success probability using the Halfling 'lucky' trait with advantage?

Here is a comprehensive DPR calculator, and here is the mathematics behind it. I'm trying to follow along with the equations.

At the bottom of the second page are formulas for success probability $$\L\$$ of a Halfling (who has luck) in normal circumstances and with advantage and disadvantage. With advantage it is $$L_{adv} = P_{adv} + \left(\frac{2}{20}(1-P) - \frac{1}{400}\right)P,$$ where:

• $$\P\$$ is the probability of succeeding on any single roll and
• $$\P_{adv} = 1 - (1-P)^2\$$ is the probability of succeeding with advantage (ie not failing both rolls).

In my attempt for deriving this (below), I have a sign error. Please can someone explain where I've gone wrong/show a correct derivation?

To succeed you require:

• succeeding outright while advantaged, OR
• rolling a $$\1\$$ with die $$\a\$$ AND failing with die $$\b\$$, AND THEN succeeding the reroll, OR
• rolling a $$\1\$$ with die $$\b\$$ AND failing with die $$\a\$$, AND THEN succeeding the reroll, OR
• rolling two $$\1\$$s AND THEN succeeding a reroll: $$L_{adv} = P_{adv} + \frac{1}{20}*(1-P)*P + \frac{1}{20}*(1-P)*P + \frac{1}{400}*P\\= P_{adv} + \left(\frac{2}{20}(1-P) + \frac{1}{400}\right)P$$
• @Anagkai Please consider putting that into a full answer below Commented Jun 1, 2020 at 12:25