Welcome to Librarium Online!
Join our community of 80,000+ members and take part in the number one resource for Warhammer and Warhammer 40K discussion!
Registering gives you full access to take part in discussions, upload pictures, contact other members and search everything!
To introduce this essay, I will note that I am largely responding to moogash, who posted an interesting thread earlier in this forum. His post was criticized for being too arcane for the layman to follow, and I admit that I couldn't follow most of it.
So, I decided to write a response which would try to explain in layman's terms what he was trying to get across. That effort failed, but it did produce this essay.
The goal here is to describe probability and averages in a way which makes it clear what they are (without using arcane jargon) how they differ, and how to use them in developing your Warhammer skills.
So far, the essay is only half done. I got tired of writing it before I wrote the last two sections, which are meant to be a cautionary section about trying to use Mathhammer to justify claims which it can't reasonably be expected to justify and a glossary of sorts to deal with some miscellanious terminology errors I find commonplace. Hopefully, those will come shortly.
For now, though, here's:
Averages and Expectation
The most common calculation which is done in "mathhammer" is that which finds average results. Otherwise known as expectation, or expected results, the average result of a series of independent events can be found by multiplying the probability of getting the desired result (or getting least one of the desired results) by the number of times the independent event is repeated. To explain that further, let's define some terms.
Independent Event: An event in 40k is essentially the roll of a die, or a series of die rolls. An event is independent when its results are not affected by the results of other events. All events in 40k are independent.
This seems counterintuitive--after all, a roll to wound is dependent on a successful roll to hit, right? Surely that means that the roll to wound can't be independent. The difference between this type of 'dependence' and the type of dependence which is a term in probability mathematics is that, in this usage, the roll to wound doesn't happen if the roll to hit is failed. Probability mathematics aren't concerned with events that don't happen. When they say that an event is dependent on another event, they mean only that the probabilities of its different outcomes differ depending on the outcome of an earlier event.
An example of a dependent event would be pulling rabbits from a hat. If you have three rabbits in a hat: a brown rabbit, a grey rabbit, and a white rabbit and you select one randomly, then select another randomly, the probability of pulling, say, the white rabbit out of the hat on the second go changes depending on which rabbit you pull out on the first go. Obviously, if you pull out the white rabbit first, the probability of pulling it out second drops to zero, whereas if you pull out one of the other two rabbits first, the probability of getting the white rabbit on the second pull is 1/2 (or 50%). This is what a mathematician means when he says that an event is dependent.
To contrast, an independent event (like the roll to wound earlier) has the same probability of success or failure regardless of the results of earlier events. If you hit a marine with a bolter, you have a probability of 1/2 of wounding that marine. If you don't hit, you don't even roll to wound--you don't have a probability of 0, you just don't have a probability at all. The event of rolling to wound never occurs.
So, forget all that about dependent events--they never occur in 40k. All we're concerned about is independent events.
Probability: While we're at it, we'd better define probability. Probability is an expression of how likely it is to get a certain result out of a specific event (or series of events, as we'll see in just a minute).
All probabilities are between one and zero. Every. Single. One. If you think you've found a "probability" and it is greater than one, you haven't. Period. If you think you know how to find a probability, you can test to see if your method is accurate by seeing if it can possibly produce a result greater than one (or less than zero). If it can, your method is incorrect. Period. (If it can't, your method still might be incorrect, remember.) For the record, a probability of one only occurs in situations where failure in the event is actually impossible, while a probability of zero only occurs in situations where success in the event is actually impossible. These situations are fairly rare in 40k.
So, if the probability of success on an event is the likelihood of getting the result you want, how do you actually find that? Well, you simply find the number of possible results, and you count the number of those results which you would consider successful. The probability, then, is the ratio of the latter to the former. On a d6, the probability of success is always x/6, where x is the number of facings that would yield a success. Rolling to hit with a ballistics skill of 4, for example, yields success on four out of the six results. Thus, the probability of success on a roll to hit by a model with a Bs of 4 is 4/6 (which simplifies to 2/3).
Note that when the event has no degrees of success--that is it can only be passed or failed (as is almost always the case in 40k)--the probability of failing and the probability of succeeding always add up to one. Expressed another way, the probability of failing is equal to one minus the probability of succeeding, and the probability of succeeding is equal ot one minus the probability of failing. This is because, when looking at a single event, the probability of getting either one result or another result is equal to the probability of getting the one result plus the probability of getting the other result. If all the results either yield success or failure, then you are guaranteed to either succeed or fail—the probability of either succeeding or failing is one.
Often in 40k, you'll have a series of events, all of which must be successful, and often series like this will be referred to as events themselves. So, remember: an event can be a single die roll or a series of die rolls. Of course, what I'm referring to here is mainly the standard series of the roll-to-hit, roll-to-wound, and roll-to-save. In order to inflict a wound, the attacker must succeed at the first two, and the defender must fail at the last one. So, if a single attack is a event, and the attack is successful if it inflicts a wound, how do we find the probability of the attack being successful?
Simply, we multiply the probabilities of getting successful results together and find their product. (Note that here we're talking about results which allow for the success of the attack, which means we're looking for a result on the roll-to-save which is a failure from the perspective of the person making the roll.)
So, going back to the example of the marine shooting another marine, he has four chances out of six to hit, then three chances out of six to wound, and finally there are two chances out of six that the target fails its save. All of these must be successful for the attack to be successful, so the probability of success is 4/6 x 3/6 x 2/6 (which simplifies to 2/3 x 1/2 x 1/3) which equals 1/9. A marine making one attack against another marine with his bolter has a 1/9 chance of inflicting a wound.
Averages: So, getting back to averages: an average, in this context, is the expression of how much success you should expect from a set of events. Though it requires knowing the probability of success on those events, it is not, itself, an expression of any probability or likelihood. Rather, it gives you the best idea possible of what to expect from a set of events, and tells you what specific “amount” of success the set of events is most likely to yield (though it doesn't tell you how likely you are to get that amount). You can calculate expected results of a set of events (which, remember, is the same as average results) by multiplying the probability of success on those events by the number of events which occur. If the set contains events with different probabilities of success, you can simply find the expected results for each different type of event and add those together to find your total expected results.
As an example, lets go back to the marine shooting the other marine. There is a 1/9 chance that he will inflict a wound--a probability of 1/9 that his attack will be successful. When he is shooting by himself, that means that his expected results are 1/9 of a wound. His average 'damage' against his target is 1/9 of a wound. Now, obviously he can't actually get 1/9 wound against his target—a calculation of averages doesn't always yield whole numbers—but rounding to the nearest whole number will still tell you the most likely amount of success which is possible given the constraints of the game. In this case, 1/9 rounds to zero, which tells you that the marine is more likely to fail to get a wound than not. Of course, if you were paying attention, you'd have known this anyway, since 1/9 is also the probability of him getting a wound (leaving 8/9 as the probability of him failing to get a wound).
What happens, though, when ten marines each making one shooting attack at another squad of marines? Now you have ten identical events, each with a 1/9 probability of success. Now, your average is 1/9 x 10, or 10/9. That rounds to one, telling you that you are more likely to inflict one wound than you are to inflict zero, or two, or three (etc.) Later, I'll show you how to actually calculate the probability of actually getting exactly one wound, or getting two, or three, or whatever, but for now we're going to stick to averages. Note that the result in this example is greater than one, which proves that you cannot find any probabilities by simply multiplying the chance of success on an event by the number of those events which are conducted.
To make the situation more complicated, let's give that marine squad a Heavy bolter and a Plasma Gun. Now, it makes eight attacks with Bolters, one attack with plasma, and three attacks with the Heavy Bolter. To find the expected results, here, simply find the expected results from Bolters, add that to the expected result from the Plasma Gun, and finally add the expected result from the Heavy Bolter to find the total expected results. This calculation ends up looking like this: 2/3x1/2x1/3x8 + 2/3x5/6 + 2/3x2/3x1/3x3 for a total of 17/9 (approximately 1.89).
Most of the time, when 40k players do “mathhammer” what they do is try to find average results. Knowing the average results of a set of events is useful, because it gives you a pretty good idea of how much success to expect from a particular action. For example, if you have a tactical squad carrying eight bolters, one heavy bolter, and one plasma gun and you want to know about how many of those Khorne Berserkers you're likely to kill by shooting at them, you can find the average result (in this case 1.89) and you'll know that you'll most likely kill two. What is important to remember, at this point, is that this data is not a probability--it does not express the likelihood of anything.
An important thing to remember, though, is that while finding the average tells you the most likely specific amount of success, it is almost always the case that you're less likely to get that amount of success than you are to get some other amount. That is, while you're more likely to inflict two wounds with your shooting than you are to inflict three, you're more likely to inflict either zero, one, three, four, five, six, seven, eight, nine, ten, eleven, or twelve, than you are to inflict exactly two.
So, while finding the average number of results gives you a pretty good idea about what to expect, if you have your heart set on killing exactly two of those berserkers--no more and no less—you're likely to be disappointed. In this next section, we'll talk more about probability and how to find out exactly how likely it is that you inflict exactly two wounds.
Probability
As I said earlier, probability expresses the likelihood of getting a certain result (or one of a certain set of results) on a single event (which might actually be a series of sub-events). To recap quickly, you can find the probability of success on an event by finding the ratio between the number of results which yield success and the total number of possible results. When looking at an event which is actually a series of sub-events, all of which need to be successful for the 'main' event to be successful (a common situation in 40k) you can find the probability that the main event will be successful by finding the product of the probabilities for success on each sub-event.
So, the probability of success on a roll to hit is:
(chances to hit)/6
while the probability of success on an attack, where success is the attack inflicting a wound is:
(chances to hit)/6 x (chances to wound)/6 x (chances to fail save)/6
and the save part might be left out if, for whatever reason, the target does not get a save against the attack.
In this section, we'll talk about how to use this information to find the probability of getting any given number of successes, or at least any given number of successes, out of a set of events.
Probability of at least one success
The mistake I most commonly see players make occurs when they try to find the probability of multiple attacks destroying a single enemy model. For example, let's envision two guardsmen shooting Lascannons at a Space Marine Chaplain. Each has a 1/2 chance to hit and a 5/6 chance to wound. The Chaplain, with his Rosarius, has a 1/2 chance to save. That means that each lascannon has a 1/2x5/6x1/2 chance to inflict a wound on the Chaplain (that's 5/24 total, or about 20.8%), which, due to the Instant Death rule, is also the probability of killing him. But, you have two Lascannons and you want to know the probability of him dying to either of them.
Many players' first responses will be to simply add the two probabilities together. 5/24 for the first Lascannon plus 5/24 for the second Lascannon equals 10/24, or 5/12, or roughly 41.2%. As we now know, this would be the correct method for finding the average number of kills you should expect to inflict against the Chaplain. It is not, however, the correct method for finding the probability of killing the Chaplain. We can determine this by conducting the simple test I mentioned earlier. Imagine that, instead of two Lascannons, we have five Lascannons firing at the Chaplain. Each has a 5/24 probability of killing the Chaplain. If we add them together, we have a probability of 25/24. Since this is greater than one, we know that this method must not be correct.
What we really want to know, when determining how likely it is for our two Lascannons, or five Lascannons, or whatever to kill the chaplain is the probability that at least one will succeed in wounding the Chaplain. It doesn't matter how many actually succeed, all that matters is that not all of them fail. Looking at it in this light, the solution for finding this probability becomes clear. All we have to do is find the probability that they all fail. If they don't all fail, then at least one succeeds, and as I mentioned earlier, this means that the probability that either they all fail or at least one succeeds equals one (which is just to say that there is no possible result in which they don't all fail but we don't have at least one success).
So, the probability of getting at least one success (which is what we want to find) is equal to one minus the probability of them all failing. We already know how to find the probability of multiple events all succeeding, and by extension we know how to find the probability of multiple events all failing. In this case, the probability of a lascannon failing to kill a Space Marine Chaplain is equal to one minus the probability of the lascannon succeeding at killing the Chaplain, or 1-5/24, or 19/24. So, the probability of both lascannons failing to kill the Chaplain is 19/24x19/24, and the probability of at least one lascannon succeeding at killing the Chaplain is 1-19/24*19/24 (roughly 37.33%). This can be expressed in a formula as:
1-(1-p)^n
where “p” is the probability of the event succeeding and “n” is the number of times the event is repeated. So, two lascannons have a probability of killing the Chaplain equal to 1-(1-5/24)^2, which is the same as I expressed above, while five lascannons have a probability of killing the Chaplain equal to 1-(1-5/24)^5 (roughly 68.90%)
Note that this formula is only applicable to multiple identical events—such as multiple guardsmen firing lascannons at a Chaplain. If, say, we had one guardsman firing a lascannon at the Chaplain and one veteran guardsman (who is more likely to hit) also firing a lascannon at the Chaplain, we'd have to do it the long way and find the probability of the guardsman failing to kill the Chaplain (19/24) and the probability of the veteran failing to kill the Chaplain (13/1, multiply those two values together (247/432) and subtract that product from one (185/432) for roughly a 42.82% percent probability of success.
Probability of a Specific Number of Successes
While the likelihood of getting at least one success is probably the most common probability which needs to be found in 40k, it is useful to know how to determine the probability of other specific amounts of success. Remember when I said that the average represented the specific amount of success which is most likely to occur? That's true, but remember that I also said that while it's the most likely to occur of any specific amount, it's still not all that likely. It is important to be able to find the probability of actually getting the average amount of success, that amount or more, or, really, any specific amount of success or more.
The formula used for this calculation is:
n! * p^s * (1-p)^(n-s)
s! * (n-s)!
where “n” is the number of identical events, “s” is the number of successes you're looking for, and “p” is the probability of success for each event.
The above formula tells you the probability of getting exactly “s” successes out of “n” events with “p” probability of success.
To those of you who aren't big on math, the exclamation mark (!) indicates a factorial. A factorial is simply a number, times itself minus one, times itself minus two (etc) all the way down to one. So, n! Is n x n-1 x n-2 x n-3 x .... x 2 x 1. 6! would be 6x5x4x3x2x1. You can get Excel to find a factorial for you by entering: fact(number).
To determine the probability, then, of getting “s” successes or more, you find the probability of getting “s” successes, the probability of getting “s+1” successes, and so on up to the maximum number of successes possible. The sum of those probabilities is the probability of getting “s” or more successes.
To express this as an example, let's go back and consider our earlier ten Tactical Marines shooting their Bolters at enemy Space Marines. Each attack has a 1/9 chance of succeeding, and there are ten attacks. That means an average of 10/9 successes (casualties) and a probability of getting at least one success equal to 1-(8/9)^10, or roughly 69.21%. But what if we need to kill two marines? What is the probability of killing exactly two? Well, we can use our formula above to find out. Simply plug in the appropriate values and you get:
10! x (1/9)^2 x (1-1/9)^(10-2)
2!(10-2)!
which, in turn, equals roughly 21.65%. So, you have a 21.65% chance of doing exactly two wounds. But what about doing at least two wounds? Simply do the above formula again, replacing 2 with 3, then again replacing 3 with 4, then again replacing 4 with 5, and again replacing 5 with 6, then 6 with 7, 7 with 8, 8 with 9, and finally 9 with 10 (10 being the maximum possible number of wounds).
These results will tell you the probability of getting exactly 2, 3, 4, 5, 6, 7, 8, 9, or 10 successes, and the sum of those probabilities is the probability of getting at least 2 successes.
For the record, I know that this is way too complicated to do on the fly or in your head. For this reason, I suggest writing a spreadsheet to do it for you. I have such a spreadsheet assembled, and anyone who wants it should feel free to email me at cnearing@gmail.com for a copy.
The tools I've shown so far should be sufficient for you to find out just about whatever you want to know in terms of “mathhammer.” In the next section, I'll discuss some of the limitations of math as it applies to 40k, and then go on to discuss some terminology in the last section.
Last edited by Left of West; February 7th, 2010 at 15:32.
Once again, the conservative, sandwich-heavy portfolio pays off for the hungry investor!
Hey there
I haven't finished reading yet, but i am enjoying it so far (EDIT: I have just finished). Thankyou for spending the time to write this out in a format that one as simple as i can understand. I have reasonable math-sci knowledge but not quite as intense as some of the "chance" professors on these forums.
I found some sections needed to read over twice, but like any article, without an editor to be picky over english and idiot friendly sentences i think you did really well.
By the way, you may want to fix up the BS3 = 2/3 (you probably meant 3+ or BS4) part up above as the less appreciative will probably jump on the finer details instead of the articles point.
Thanks
Dom
Last edited by Dom-X; August 8th, 2008 at 08:01.
Thanks. I'm not sure what I was thinking on the Bs:3, thing. I was thinking Bs:4 when I wrote it.
Anyway, glad you liked it.
Once again, the conservative, sandwich-heavy portfolio pays off for the hungry investor!
--•-My 40K projects-•--
You are correct, and I've made the correction. Thanks!
Once again, the conservative, sandwich-heavy portfolio pays off for the hungry investor!
Solid effort. A well-written tactica and deserving of some rep. The format and concepts you expressed were very easy to understand so well done!
Any plans on completing this in the near future?
Hey! I'm glad you liked it. I actually wrote this a while ago and had more or less given up on writing the followup portions. I'm not even certain what I was going to talk about. But, I might give it a shot. What topics does it seem like I should address?
If I remember correctly, I was going to talk about what sorts of information probability calculations can give you and what sorts of information it can't give you (how to use it in the decision-making process) and...I'm not sure what else.
Reading through it again, I see that I probably need to go into dependent events a little more deeply, since they do actually occasionally occur in 40k and sometimes you even need to figure out how to deal with them in calculations.
In considering how to expand on this (after all this time) I'd be interested in your input.
Once again, the conservative, sandwich-heavy portfolio pays off for the hungry investor!
This would be a good start i think.Your original intentions here would be a worthwhile addition too, particularly the limitations of Mathhammer.I'll discuss some of the limitations of math as it applies to 40k, and then go on to discuss some terminology in the last section.
another addition would be the formula for the distribution of the probability while rolling multiple dices.
The most common is 2d6, where a 7 has 55%, 2 and 12 have both 3% etc etc.
but while a 2d6 distribution is easy to figure by hand, when the amount of dices increases this get more complicated.
I don't use Vendettas or Valks...if Guardsmen were meant to fly, the Emperor would have given them wings. (343rd Mordian)
The battle for Hidaxes SubSector (Listwar)! 184th Cadian blog: 184th.blogspot.com
If you are writing more, then I would appreciate something that explains how to calculate the successfulness of re-rolls. Great work so far.