# Why doesn't my approach work for this probability question?

So there's this dungeons and dragons themed question where you're a wizard facing 6 trolls. The trolls spawn with 1d4 health (meaning that their health points are chosen randomly from 1-4) and the wizard is able to attack all of them with a fireball that deals 2d2 damage (the damage is calculated by randomly choosing two numbers from the set {1,2} and adding them together). The question asks to find the probability that all of the trolls are killed.

The way I approached this problem is by looking at one troll and using case decomposition. If the troll has 1 or 2 health points, then no matter what I roll for the fireball, it will be killed. If it has 3 health points, there's only one way it survives: if I roll a 1,1 so there's a 75% I kill it in this case. And if it has 4 health points, I can only kill it if I roll a 2,2 => 25% chance.

So the probability I kill a single troll is 75% and for the wizard to kill 6 trolls, the probability must be (0.75)^6 = 0.17798.

To check my answer, I simulated the scenario in Matlab as shown below:

%this function calculates the probability that the fireball
%killed all of the trolls

function prob = probAllKilled()
N = 10e6;

count = 0;

%for each simulation
for i = 1:N

%set the damage for the fireball
damage = randi([1, 2]) + randi([1, 2]);

%we generate the 6 trolls and check how many were killed by the
%fireball. If all were killed, we increment the count
if sum((randi([1, 4], 6, 1) - damage) <= 0) == 6
count = count + 1;
end

end
%then we divide by N to get the probability
prob = count/N;

end



However, this gave me that the probability is 0.34295 which is nearly twice what I got on paper. I found out that in my calculations, I must have assumed that I was rolling for the fireball damage for each troll. To check this, I modified my code so that it matches my assumption:

function prob = probAllKilled()
N = 10e6;

count = 0;

%for each simulation
for i = 1:N

%set the damage for the fireball
%damage = randi([1, 2]) + randi([1, 2]);

%we generate the 6 trolls and check how many were killed by the
%fireball. If all were killed, we increment the count
if sum((randi([1, 4], 6, 1) - randi([1, 2], 6, 1) - randi([1, 2], 6, 1) ) <= 0) == 6
count = count + 1;
end

end
%then we divide by N to get the probability
prob = count/N;

end


and that gave me a probability of 0.17807.

I don't really understand where in my calculations I made the assumption that I was rolling every time I dealt damage to a troll. And I'm not really sure how I should approach the problem differently so that I don't make that assumption.

• Do I understand correctly that one fireball only hits one enemy? Then I don't understand the win condition. The mage just has to keep throwing fireballs until all trolls are dead. So, the probability is 100%. Commented Jan 21, 2023 at 15:23
• Raskolnikov Sorry I should have been more clear. It's one fireball that hits all of the trolls and you want to find the probability that all of the trolls are killed in one fireball Commented Jan 21, 2023 at 17:40

and for the wizard to kill $$6$$ trolls, the probability must be $$(0.75)^6$$
This would be the case if the one-on-one battles between the wizard and each troll are indepedent - two new random numbers are generated per battle. If, however, the wizard damage is one number that applies to all trolls, then the calculated probability is incorrect, since only the troll health is generated. To find the correct probability for this case, you can again apply casework, but this time, apply it over the wizard damage value. If the wizard damage is $$2$$ (with probability $$\frac{1}{4}$$), then all trolls have to have health $$2$$ or below, which happens with probability $$\left( \frac{1}{2} \right)^6 = \frac{1}{64}$$. If the wizard damage is $$3$$ (probability $$\frac{1}{2}$$), then each troll's health must be $$3$$ or below, with probability $$\left( \frac{3}{4} \right)^6 = \frac{729}{4096}$$. If the wizard damage is $$4$$ (probability $$\frac{1}{4}$$), it kills any troll with certainty. So,
$$p = \left( \frac{1}{4} \right) \left( \frac{1}{64} \right) + \left( \frac{1}{2} \right) \left( \frac{729}{4096} \right) + \frac{1}{4} = \frac{2809}{8192}$$
which is approximately $$0.34290$$, to which your simulated probability is close.