Expected Value of a DnD/Baldur's Gate Feat

182 Views Asked by At

The Baldur's gate feat Savage Attacker lets you reroll an attack, and choose the better of the two attacks.

I am attempting to calculate the expected benefit of this feat. Assume, for the sake of simplicity, that a melee attack has a 1d10 damage, which means it follows a discrete uniform distribution with integer values from 1 to 10 (equiprobable). $$A_1\text{ follows Discrete }U(1,10)$$

If we have savage attack, we take two rolls, and then the better of the two. How do I calculate the expected value of the benefit: $$E[|A_1-A_2|] $$

Update 1: I found this video by Stand-Up Math which calculates the actual probabilities (and not just the expected value)

2

There are 2 best solutions below

0
On

One way is to directly use some CAS and compute $\frac{1}{100}\sum_{x=1}^{10}\sum_{y=1}^{10}|x-y|=3.3$ which will be your expected value i.e. $E(|X-Y|)$ where $X,Y$ are iid uniform discrete variates on $[1,10]$.

The other way is to evaluate this sum by hand.

$$\sum_{x=1}^{10}\sum_{y=1}^{10}|x-y|=\sum_{y=1}^{10}\sum_{x=1}^{y-1}(y-x)+\sum_{y=1}^{10}\sum_{x=y+1}^{10}(x-y)$$

Now both the summands on the RHS are equal by symmetry.

So we focus only on $$\sum_{y=1}^{10}\sum_{x=1}^{y-1}(y-x)$$

Notice that it does not matter if we include the term for $x=y$ as we will be only adding a $0$.

So $$\sum_{y=1}^{10}\sum_{x=1}^{y-1}(y-x)=\sum_{y=1}^{10}\sum_{x=1}^{y}(y-x)=\sum_{y=1}^{10}(y^{2}-\frac{y(y+1)}{2})$$

$$=\sum_{y=1}^{10}(\frac{y^{2}}{2}-\frac{y}{2})=\frac{n(n+1)(2n+1)}{12}-\frac{n(n+1)}{4}$$

where $n=10$ and we are using the formulas $\sum_{k=1}^{n}k=\frac{n(n+1)}{2}$ and $\sum_{k=1}^{n}k^{2}=\frac{n(n+1)(2n+1)}{6}$

If you plug in $10$ in the above expression, you'll get $$\sum_{y=1}^{10}\sum_{x=1}^{y-1}(y-x)=155$$

Hence, by symmtery, $\displaystyle \sum_{y=1}^{10}\sum_{x=1}^{y-1}(y-x)+\sum_{y=1}^{10}\sum_{x=y+1}^{10}(x-y)=155\cdot 2=330$ which agrees with the result derived on a CAS.

So $\displaystyle E(|X-Y|)=\frac{330}{100}=3.3$

In particular, you can use the same reasoning I did above to calculate that $$\sum_{x=1}^{n}\sum_{y=1}^{n}|x-y|=\frac{n(n+1)(2n+1)}{6}-\frac{n(n+1)}{2}$$

5
On

Here is a pretty fact (it's quite easy to prove): conditional on the two rolls being different, they split the interval into three parts which have identical distribution. (For example, in the image below, the parts have lengths $2,1,5$.) enter image description here

Since the sum of lengths is $8$, the expected length of each part is $8/3$. Note also that the $|A_1-A_2|$ is the length of the middle part plus 1.

That said, using the law of total expectation, $$\begin{align} \mathrm E[|A_1-A_2|]{} = {}&\mathrm E[|A_1-A_2|\mid A_1\neq A_2]\cdot \mathrm P(A_1\neq A_2)\\ {}+ {}&\mathrm E[|A_1-A_2|\mid A_1= A_2]\cdot \mathrm P(A_1= A_2) \\ {}={} &\Big(\frac83 + 1\Big)\cdot \frac9{10} + 0\cdot \frac1{10} = \frac{33}{10}, \end{align} $$ confirming @Mr.GandalfSauron's computation.

Note also that the expected benefit is not $\mathrm E[|A_1-A_2|]$, but rather $\mathrm E[\max(A_1,A_2)] - \mathrm E[A_1] = \mathrm E[|A_1-A_2|]/2 = 1.65$.