Conditional Probability. Bayes' theorem

Do you want to know what are the mathematical chances of your bet being successful? Then there are two for you. good news. First: to calculate the patency, you do not need to carry out complex calculations and spend a lot of time. Enough to take advantage simple formulas, which will take a couple of minutes to work with. Second, after reading this article, you will easily be able to calculate the probability of passing any of your trades.

To correctly determine the patency, you need to take three steps:

  • Calculate the percentage of the probability of the outcome of an event according to the bookmaker's office;
  • Calculate the probability from statistical data yourself;
  • Find out the value of a bet given both probabilities.

Let us consider in detail each of the steps, using not only formulas, but also examples.

Fast passage

Calculation of the probability embedded in the betting odds

The first step is to find out with what probability the bookmaker evaluates the chances of a particular outcome. After all, it is clear that bookmakers do not bet odds just like that. For this we use the following formula:

PB=(1/K)*100%,

where P B is the probability of the outcome according to the bookmaker's office;

K - bookmaker odds for the outcome.

Let's say the odds are 4 for the victory of the London Arsenal in a duel against Bayern. This means that the probability of its victory by the BC is regarded as (1/4) * 100% = 25%. Or Djokovic is playing against South. The multiplier for Novak's victory is 1.2, his chances are equal to (1/1.2)*100%=83%.

This is how the bookmaker itself evaluates the chances of success for each player and team. Having completed the first step, we move on to the second.

Calculation of the probability of an event by the player

The second point of our plan is our own assessment of the probability of the event. Since we cannot mathematically take into account such parameters as motivation, game tone, we will use a simplified model and use only the statistics of previous meetings. To calculate the statistical probability of an outcome, we use the formula:

PAND\u003d (UM / M) * 100%,

wherePAND- the probability of the event according to the player;

UM - the number of successful matches in which such an event took place;

M is the total number of matches.

To make it clearer, let's give examples. Andy Murray and Rafael Nadal have played 14 matches. In 6 of them, total under 21 games were recorded, in 8 - total over. It is necessary to find out the probability that the next match will be played for a total over: (8/14)*100=57%. Valencia played 74 matches at the Mestalla against Atlético, in which they scored 29 victories. Probability of Valencia winning: (29/74)*100%=39%.

And we all know this only thanks to the statistics of previous games! Naturally, such a probability cannot be calculated for some new team or player, so this betting strategy is only suitable for matches in which opponents meet not for the first time. Now we know how to determine the betting and own probabilities of outcomes, and we have all the knowledge to go to the last step.

Determining the value of a bet

The value (valuability) of the bet and the passability are directly related: the higher the valuation, the higher the chance of a pass. The value is calculated in the following way:

V=PAND*K-100%,

where V is the value;

P I - the probability of an outcome according to the better;

K - bookmaker odds for the outcome.

Let's say we want to bet on Milan to win the match against Roma and we calculated that the probability of the Red-Blacks winning is 45%. The bookmaker offers us a coefficient of 2.5 for this outcome. Would such a bet be valuable? We carry out calculations: V \u003d 45% * 2.5-100% \u003d 12.5%. Great, we have a valuable bet with good chances of passing.

Let's take another case. Maria Sharapova plays against Petra Kvitova. We want to make a deal for Maria to win, which, according to our calculations, has a 60% probability. Bookmakers offer a multiplier of 1.5 for this outcome. Determine the value: V=60%*1.5-100=-10%. As you can see, this rate is of no value and should be refrained from.

In his blog, a translation of the next lecture of the course "Principles of Game Balance" by game designer Jan Schreiber, who worked on projects such as Marvel Trading Card Game and Playboy: the Mansion.

Before today almost everything we talked about was deterministic, and last week we took a close look at transitive mechanics, breaking it down in as much detail as I can explain. But until now, we have not paid attention to other aspects of many games, namely, non-deterministic moments - in other words, randomness.

Understanding the nature of randomness is very important for game designers. We create systems that affect the user experience in a given game, so we need to know how these systems work. If there is randomness in the system, we need to understand the nature of this randomness and know how to change it in order to get the results we need.

Dice

Let's start with something simple - rolling dice. When most people think of dice, they think of a six-sided die known as a d6. But most gamers have seen many other dice: four-sided (d4), eight-sided (d8), twelve-sided (d12), twenty-sided (d20). If you're a real geek, you might have 30- or 100-grain dice somewhere.

If you are not familiar with this terminology, d stands for a die, and the number after it is the number of its faces. If the number comes before d, then it indicates the number of dice when throwing. For example, in Monopoly, you roll 2d6.

So in this case the phrase "dice" is a conventional designation. There are a huge number of other random number generators that do not look like plastic figures, but perform the same function - they generate random number from 1 to n. An ordinary coin can also be represented as a dihedral d2 die.

I saw two designs of a seven-sided die: one of them looked like a dice, and the second looked more like a seven-sided wooden pencil. A tetrahedral dreidel, also known as a titotum, is an analogue of a tetrahedral bone. The game board with a spinning arrow in Chutes & Ladders, where the result can be from 1 to 6, corresponds to a six-sided die.

A random number generator in a computer can generate any number from 1 to 19 if the designer gives such a command, although the computer does not have a 19-sided dice (in general, I will talk more about the probability of getting numbers on a computer next week). All of these items look different, but in fact they are equivalent: you have an equal chance of each of several possible outcomes.

Dice have some interesting properties that we need to know about. First, the probability of any of the faces coming up is the same (I'm assuming you're rolling the dice with the correct geometric shape). If you want to know the average value of the toss (to those who are fond of probability theory, it is known as expected value), sum the values ​​on all faces and divide this number by the number of faces.

The sum of the values ​​of all faces for a standard six-sided die is 1 + 2 + 3 + 4 + 5 + 6 = 21. Divide 21 by the number of faces and get the average value of the roll: 21 / 6 = 3.5. This a special case, because we assume that all outcomes are equally likely.

What if you have special dice? For example, I saw a game with a six-sided dice with special stickers on the faces: 1, 1, 1, 2, 2, 3, so it behaves like a strange three-sided dice, which is more likely to roll the number 1 than 2, and it's more likely to roll a 2 than a 3. What is the average roll value for this die? So, 1 + 1 + 1 + 2 + 2 + 3 = 10, divide by 6 - you get 5/3, or about 1.66. So if you have a special dice and players roll three dice and then add up the results, you know that their total will be about 5, and you can balance the game based on that assumption.

Dice and independence

As I already said, we proceed from the assumption that the dropout of each face is equally probable. It doesn't matter how many dice you roll here. Each roll of the die is independent, which means that previous rolls do not affect the results of subsequent rolls. With enough trials, you're bound to notice a series of numbers—for example, rolling mostly higher or lower values—or other features, but that doesn't mean the dice are "hot" or "cold." We'll talk about this later.

If you roll a standard six-sided die and the number 6 comes up twice in a row, the probability that the result of the next roll will be a 6 is also 1 / 6. The probability does not increase because the die "warmed up". At the same time, the probability does not decrease: it is incorrect to argue that the number 6 has already fallen out twice in a row, which means that now another face must fall out.

Of course, if you roll a die twenty times and the number 6 comes up each time, the chance of a 6 coming up the twenty-first time is pretty high: you might just have the wrong die. But if the die is correct, the probability of getting each of the faces is the same, regardless of the results of other rolls. You can also imagine that we change the die each time: if the number 6 rolled twice in a row, remove the “hot” die from the game and replace it with a new one. I'm sorry if any of you already knew about this, but I needed to clarify this before moving on.

How to make dice roll more or less random

Let's talk about how to get different results on different dice. If you roll the die only once or several times, the game will feel more random when the die has more edges. The more often you roll the dice and the more dice you roll, the more the results approach the average.

For example, in the case of 1d6 + 4 (that is, if you roll a standard six-sided die once and add 4 to the result), the average will be a number between 5 and 10. If you roll 5d2, the average will also be a number between 5 and 10. The result of rolling 5d2 will be mostly the numbers 7 and 8, less often other values. The same series, even the same average value (7.5 in both cases), but the nature of the randomness is different.

Wait a minute. Didn't I just say that dice don't "heat up" or "cool down"? And now I say: if you roll a lot of dice, the results of the rolls are closer to the average value. Why?

Let me explain. If you roll a single die, the probability of each of the faces coming up is the same. This means that if you roll a lot of dice over time, each face will come up about the same number of times. The more dice you roll, the more the total result will approach the average.

This is not because the rolled number "causes" another number to roll that hasn't yet been rolled. Because a small streak of rolling the number 6 (or 20, or some other number) won't make much of a difference in the end if you roll the dice ten thousand more times and it's mostly the average. Now you will have a few large numbers, and later a few small ones - and over time they will approach the average value.

This is not because previous rolls affect the dice (seriously, a dice is made of plastic, it doesn't have the brains to think, "Oh, it's been a long time since a 2 came up"), but because it usually happens with a lot of rolls. playing dice.

So it's pretty easy to calculate for one random roll of a die - at least calculate the average value of the roll. There are also ways to calculate "how random" something is and say that the results of a 1d6 + 4 roll will be "more random" than 5d2. For 5d2, rolled results will be distributed more evenly. To do this, you need to calculate the standard deviation: the larger the value, the more random the results will be. I would not like to give so many calculations today, I will explain this topic later.

The only thing I'm going to ask you to remember is that, as a general rule, the fewer dice you roll, the more random. And the more sides the die has, the more randomness, since there are more possible options for the value.

How to Calculate Probability Using Counting

You may be wondering: how can we calculate the exact probability of a particular result coming up? In fact, this is quite important for many games: if you roll the die initially, there is likely to be some optimal outcome. The answer is: we need to calculate two values. Firstly, the total number of outcomes when throwing a dice, and secondly, the number of favorable outcomes. By dividing the second value by the first, you get the desired probability. To get a percentage, multiply the result by 100.

Examples

Here is a very simple example. You want to roll a 4 or higher and roll a six-sided die once. The maximum number of outcomes is 6 (1, 2, 3, 4, 5, 6). Of these, 3 outcomes (4, 5, 6) are favorable. So, to calculate the probability, we divide 3 by 6 and get 0.5 or 50%.

Here's an example that's a little more complicated. You want the roll of 2d6 to come up with an even number. The maximum number of outcomes is 36 (6 options for each die, one die does not affect the other, so we multiply 6 by 6 and get 36). The difficulty with this type of question is that it is easy to count twice. For example, on a roll of 2d6, there are two possible outcomes of a 3: 1+2 and 2+1. They look the same, but the difference is which number is displayed on the first dice and which one is on the second.

You can also imagine that the dice are of different colors: so, for example, in this case, one dice is red, the other is blue. Then count the number of possible occurrences of an even number:

  • 2 (1+1);
  • 4 (1+3);
  • 4 (2+2);
  • 4 (3+1);
  • 6 (1+5);
  • 6 (2+4);
  • 6 (3+3);
  • 6 (4+2);
  • 6 (5+1);
  • 8 (2+6);
  • 8 (3+5);
  • 8 (4+4);
  • 8 (5+3);
  • 8 (6+2);
  • 10 (4+6);
  • 10 (5+5);
  • 10 (6+4);
  • 12 (6+6).

It turns out that there are 18 options for a favorable outcome out of 36 - as in the previous case, the probability is 0.5 or 50%. Perhaps unexpected, but quite accurate.

Monte Carlo simulation

What if you have too many dice for this calculation? For example, you want to know what is the probability that a total of 15 or more will come up on a roll of 8d6. There are a huge number of different outcomes for eight dice, and manually counting them would take a very long time - even if we could find some good solution to group the different series of dice rolls.

In this case, the easiest way is not to count manually, but to use a computer. There are two ways to calculate probability on a computer. The first way can get the exact answer, but it involves a bit of programming or scripting. The computer will go through each possibility, evaluate and count the total number of iterations and the number of iterations that match the desired result, and then provide the answers. Your code might look something like this:

If you're not a programmer and you don't want an exact answer, but an approximate answer, you can simulate this situation in Excel, where you roll 8d6 a few thousand times and get the answer. To roll 1d6 in Excel use the formula =FLOOR(RAND()*6)+1.

There is a name for the situation when you don't know the answer and just try many times - Monte Carlo simulation. This is a great solution to fall back on when it's too hard to calculate the probability. The great thing is that in this case, we don't need to understand how the math works, and we know that the answer will be "pretty good" because, as we already know, the more rolls, the more the result approaches the average value.

How to combine independent trials

If you ask about multiple repeated but independent trials, then the outcome of one roll does not affect the outcome of other rolls. There is another simpler explanation for this situation.

How to distinguish between something dependent and independent? In principle, if you can isolate each roll (or series of rolls) of a die as a separate event, then it is independent. For example, we roll 8d6 and want to roll a total of 15. This event cannot be divided into several independent rolls of dice. To get the result, you calculate the sum of all the values, so the result rolled on one die affects the results that should roll on others.

Here's an example of independent rolls: you're playing a game of dice and you're rolling six-sided dice a few times. The first roll must roll a 2 or higher for you to stay in the game. For the second roll - 3 or higher. Third requires 4 or more, fourth requires 5 or more, and fifth requires 6. If all five rolls are successful, you win. In this case, all throws are independent. Yes, if one roll fails, it will affect the outcome of the entire game, but one roll does not affect the other. For example, if your second roll of the dice is very good, it does not mean that the next rolls will be just as good. Therefore, we can consider the probability of each roll of the dice separately.

If you have independent probabilities and want to know what is the probability that all events will occur, you determine each individual probability and multiply them. Another way: if you use “and” to describe several conditions (for example, what is the probability of some random event and some other independent random event?) - calculate the individual probabilities and multiply them.

It doesn't matter what you think - never sum the independent probabilities. This is a common mistake. To understand why this is wrong, imagine a situation where you are tossing a coin and you want to know what is the probability of getting heads twice in a row. The probability of falling out of each side is 50%. If you sum these two probabilities, you get a 100% chance of getting heads, but we know that's not true, because two consecutive tails could come up. If instead you multiply the two probabilities, you get 50% * 50% = 25% - which is the correct answer for calculating the probability of getting heads twice in a row.

Example

Let's go back to the game of six-sided dice, where you first need to roll a number greater than 2, then more than 3 - and so on up to 6. What are the chances that in a given series of five rolls, all outcomes will be favorable?

As mentioned above, these are independent trials, so we calculate the probability for each individual roll, and then multiply them. The probability that the outcome of the first toss will be favorable is 5/6. The second - 4/6. Third - 3/6. The fourth - 2/6, the fifth - 1/6. We multiply all the results by each other and get about 1.5%. Wins in this game are quite rare, so if you add this element to your game, you will need a pretty big jackpot.

Negation

Here is another useful hint: sometimes it is difficult to calculate the probability that an event will occur, but it is easier to determine the chances that an event will not occur. For example, suppose we have another game: you roll 6d6 and you win if you roll a 6 at least once. What is the probability of winning?

In this case, there are many options to consider. It is possible that one number 6 will fall out, that is, the number 6 will fall on one of the dice, and the numbers from 1 to 5 will fall on the others, then there are 6 options for which of the dice will have a 6. You can get the number 6 on two dice bones, or three, or even more, and each time you will need to do a separate calculation, so it's easy to get confused here.

But let's look at the problem from the other side. You lose if none of the dice rolls a 6. In this case, we have 6 independent trials. The probability that each of the dice will roll a number other than 6 is 5/6. Multiply them - and get about 33%. Thus, the probability of losing is one in three. Therefore, the probability of winning is 67% (or two to three).

From this example, it is obvious that if you are calculating the probability that an event will not occur, you need to subtract the result from 100%. If the probability of winning is 67%, then the probability of losing is 100% minus 67%, or 33%, and vice versa. If it is difficult to calculate one probability, but it is easy to calculate the opposite, calculate the opposite, and then subtract this number from 100%.

Connecting conditions for one independent test

I said a little earlier that you should never sum probabilities in independent trials. Are there any cases where it is possible to sum the probabilities? Yes, in one particular situation.

If you want to calculate the probability of multiple unrelated favorable outcomes on the same trial, sum the probabilities of each favorable outcome. For example, the probability of rolling 4, 5, or 6 on 1d6 is equal to the sum of the probability of rolling 4, the probability of rolling 5, and the probability of rolling 6. This situation can be represented as follows: if you use the conjunction "or" in a question about probability (for example, what the probability of one or another outcome of one random event?) - calculate the individual probabilities and sum them up.

Please note: when you calculate all the possible outcomes of the game, the sum of the probabilities of their occurrence must be equal to 100%, otherwise your calculation was made incorrectly. This good way recheck your calculations. For example, you analyzed the probability of getting all combinations in poker. If you add up all the results you get, you should get exactly 100% (or at least a value pretty close to 100%: if you're using a calculator, there might be a small rounding error, but if you're adding the exact numbers by hand, everything should add up. ). If the sum does not add up, then you most likely did not take into account some combinations or calculated the probabilities of some combinations incorrectly, and the calculations need to be rechecked.

Unequal probabilities

Until now, we have assumed that each face of the die falls out at the same frequency, because this is how the die works. But sometimes you can encounter a situation where different outcomes are possible and they have different chances of falling out.

For example, in one of the additions to the card game Nuclear War, there is a playing field with an arrow, which determines the result of a rocket launch. Most often, it deals normal damage, more or less, but sometimes the damage is doubled or tripled, or the rocket explodes on the launch pad and harms you, or some other event occurs. Unlike playing field with an arrow in Chutes & Ladders or A Game of Life, the results of the playing field in Nuclear War are unequal. Some sections of the playing field are larger and the arrow stops on them much more often, while other sections are very small and the arrow stops on them rarely.

So, at first glance, the bone looks something like this: 1, 1, 1, 2, 2, 3 - we already talked about it, it is something like a weighted 1d3. Therefore, we need to divide all these sections into equal parts, find the smallest unit of measure, the divisor, to which everything is a multiple, and then represent the situation in the form d522 (or some other), where the set of dice faces will represent the same situation, but with more outcomes. This is one way to solve the problem, and it is technically feasible, but there is an easier option.

Let's go back to our standard six-sided dice. We said that to calculate the average value of a roll for a normal dice, you need to sum the values ​​\u200b\u200bof all the faces and divide them by the number of faces, but how exactly is the calculation done? You can express it differently. For a six-sided dice, the probability of each face coming up is exactly 1/6. Now we multiply the outcome of each facet by the probability of that outcome (in this case 1/6 for each facet) and then sum the resulting values. So summing (1 * 1/6) + (2 * 1/6) + (3 * 1/6) + (4 * 1/6) + (5 * 1/6) + (6 * 1/6 ), we get the same result (3.5) as in the calculation above. In fact, we calculate this every time: we multiply each outcome by the probability of that outcome.

Can we do the same calculation for the arrow on the game board in Nuclear War? Of course we can. And if we sum up all the found results, we get the average value. All we need to do is calculate the probability of each outcome for the arrow on the playing field and multiply by the value of the outcome.

Another example

The mentioned method of calculating the average is also appropriate if the results are equally likely but have different advantages - for example, if you roll a die and win more on some faces than others. For example, let's take a game that happens in a casino: you place a bet and roll 2d6. If three numbers come up with the smallest value(2, 3, 4) or four high value numbers (9, 10, 11, 12) - you will win an amount equal to your stake. The numbers with the lowest and highest value are special: if a 2 or 12 comes up, you will win twice as much as your bet. If any other number comes up (5, 6, 7, 8), you will lose your bet. It's pretty simple game. But what is the probability of winning?

Let's start by counting how many times you can win. The maximum number of outcomes on a 2d6 roll is 36. What is the number of favorable outcomes?

  • There is 1 option that will roll 2, and 1 option that will roll 12.
  • There are 2 options for a 3 and 2 options for an 11.
  • There are 3 options for a 4 and 3 options for a 10.
  • There are 4 options that will roll 9.

Summing up all the options, we get 16 favorable outcomes out of 36. Thus, under normal conditions, you will win 16 times out of 36 possible - the probability of winning is slightly less than 50%.

But two times out of those sixteen you will win twice as much - it's like winning twice. If you play this game 36 times, betting $1 each time, and each of all possible outcomes comes up once, you will win a total of $18 (you actually win 16 times, but two of them count as two wins). ). If you play 36 times and win $18, doesn't that mean the probabilities are even?

Do not hurry. If you count the number of times you can lose, you get 20, not 18. If you play 36 times, betting $1 each time, you'll win a total of $18 when all the odds roll. But you will lose a total of $20 on all 20 bad outcomes. As a result, you will be slightly behind: you lose an average of $2 net for every 36 games (you can also say that you lose an average of $1/18 a day). Now you see how easy it is to make a mistake in this case and calculate the probability incorrectly.

Permutation

So far, we have assumed that the order in which the numbers are thrown does not matter when rolling the dice. A roll of 2 + 4 is the same as a roll of 4 + 2. In most cases, we manually count the number of favorable outcomes, but sometimes this method is impractical and it is better to use a mathematical formula.

An example of this situation is from the Farkle dice game. For each new round, you roll 6d6. If you are lucky and all possible outcomes of 1-2-3-4-5-6 (straight) come up, you will get big bonus. What is the probability that this will happen? In this case, there are many options for the loss of this combination.

The solution is as follows: on one of the dice (and only on one) the number 1 must fall out. How many options for the number 1 to fall out on one dice? There are 6 options, since there are 6 dice, and the number 1 can fall on any of them. Accordingly, take one dice and put it aside. Now the number 2 should fall on one of the remaining dice. There are 5 options for this. Take another dice and set it aside. Then 4 of the remaining dice may land on a 3, 3 of the remaining dice may land on a 4, and 2 of the remaining dice may land on a 5. As a result, you are left with one dice, on which the number 6 should fall (in the latter case, a dice there is only one bone, and there is no choice).

In order to count the number of favorable outcomes for a straight combination to come up, we multiply all the different independent options: 6 x 5 x 4 x 3 x 2 x 1 = 720 - there seems to be a fairly large number of options for this combination to come up.

To calculate the probability of getting a straight combination, we need to divide 720 by the number of all possible outcomes for rolling 6d6. What is the number of all possible outcomes? Each die can roll 6 faces, so we multiply 6 x 6 x 6 x 6 x 6 x 6 = 46656 (a much larger number than the previous one). We divide 720 by 46656 and we get a probability equal to about 1.5%. If you were designing this game, it would be useful for you to know this so that you can create an appropriate scoring system. Now we understand why in the game Farkle you get such a big bonus if you get a combination of "straight": this situation is quite rare.

The result is also interesting for another reason. The example shows how rarely in a short period the result corresponding to the probability falls out. Of course, if we rolled several thousand dice, different sides of the dice would come up quite often. But when we roll only six dice, it almost never happens that every single one of the dice comes up. It becomes clear that it is foolish to expect that now a face will fall out that has not yet been, because "we have not dropped the number 6 for a long time." Look, your random number generator is broken.

This leads us to the common misconception that all outcomes come up at the same rate over a short period of time. If we roll the dice several times, the frequency of each of the faces will not be the same.

If you have ever worked on an online game with some kind of random number generator before, then most likely you have come across a situation where a player writes to technical support with a complaint that the random number generator does not show random numbers. He came to this conclusion because he killed 4 monsters in a row and received 4 exactly the same rewards, and these rewards should only drop 10% of the time, so this should obviously almost never happen.

You are doing math. The probability is 1/10 * 1/10 * 1/10 * 1/10, that is, 1 outcome out of 10 thousand is a rather rare case. That's what the player is trying to tell you. Is there a problem in this case?

Everything depends on the circumstances. How many players are on your server now? Suppose you have a fairly popular game, and every day 100,000 people play it. How many players will kill four monsters in a row? Maybe everything, several times a day, but let's assume that half of them are just exchanging different subjects at auctions, rewrites on RP servers, or perform other game actions - thus, only half of them hunt monsters. What is the probability that someone will get the same reward? In this situation, you can expect this to happen at least a few times a day.

Incidentally, this is why it seems like every few weeks someone wins the lottery, even if that someone has never been you or someone you know. If enough people play regularly, chances are there will be at least one lucky person somewhere. But if you play the lottery yourself, then you are unlikely to win, you are more likely to be invited to work at Infinity Ward.

Maps and addiction

We have discussed independent events, such as throwing a die, and now we know many powerful tools for analyzing randomness in many games. The probability calculation is a bit more complicated when it comes to drawing cards from the deck, because every card we take out affects the ones that remain in the deck.

If you have a standard deck of 52 cards, you draw 10 hearts from it and you want to know the probability that the next card will be the same suit - the probability has changed from the original because you have already removed one heart card from the deck. Each card you remove changes the chance of appearing next card in the deck. In this case, the previous event affects the next, so we call this probability dependent.

Note that when I say "cards" I mean any game mechanic that has a set of objects and you remove one of the objects without replacing it. A “deck of cards” in this case is analogous to a bag of chips from which you take out one chip, or an urn from which colored balls are taken out (I have never seen games with an urn from which colored balls would be taken out, but teachers of probability theory on what for some reason, this example is preferred).

Dependency properties

I would like to clarify that when we are talking about cards, I'm assuming you draw cards, look at them, and remove them from the deck. Each of these actions is an important property. If I had a deck of, say, six cards numbered from 1 to 6, I would shuffle them and draw one card, then shuffle all six cards again - this would be similar to rolling a six-sided die, because one result does not affect here for the next ones. And if I draw cards and do not replace them, then by drawing a 1 card, I increase the probability that the next time I draw a card with the number 6. The probability will increase until I eventually draw this card or shuffle the deck.

The fact that we are looking at cards is also important. If I take a card out of the deck and don't look at it, I won't have additional information and in fact the probability will not change. This may sound illogical. How can simply flipping a card magically change the odds? But it's possible because you can only calculate the probability for unknown items based on what you know.

For example, if you shuffle a standard deck of cards, reveal 51 cards and none of them are queen of clubs, then you can be 100% sure that the remaining card is a queen of clubs. If you shuffle a standard deck of cards and draw 51 cards without looking at them, then the probability that the remaining card is the queen of clubs is still 1/52. As you open each card, you get more information.

Calculating the probability for dependent events follows the same principles as for independent events, except that it's a bit more complicated, as the probabilities change when you reveal the cards. Thus, you need to multiply many different values, instead of multiplying the same value. In fact, this means that we need to combine all the calculations that we did into one combination.

Example

You shuffle a standard deck of 52 cards and draw two cards. What is the probability that you will take out a pair? There are several ways to calculate this probability, but perhaps the simplest is as follows: what is the probability that, after drawing one card, you will not be able to draw a pair? This probability is zero, so it doesn't really matter which first card you draw, as long as it matches the second. It doesn't matter which card we draw first, we still have a chance to draw a pair. Therefore, the probability of taking out a pair after taking out the first card is 100%.

What is the probability that the second card will match the first? There are 51 cards left in the deck, and 3 of them match the first card (actually it would be 4 out of 52, but you already removed one of the matching cards when you drew the first card), so the probability is 1/17. So the next time the guy across from you at the table is playing Texas Hold'em, he says, “Cool, another pair? I'm lucky today", you will know that with a high degree of probability he is bluffing.

What if we add two jokers, so we have 54 cards in the deck, and we want to know what is the probability of drawing a pair? The first card can be a joker, and then there will be only one card in the deck that matches, not three. How to find the probability in this case? We divide the probabilities and multiply each possibility.

Our first card could be a joker or some other card. The probability of drawing a joker is 2/54, the probability of drawing some other card is 52/54. If the first card is a joker (2/54), then the probability that the second card will match the first is 1/53. We multiply the values ​​(we can multiply them because they are separate events and we want both events to happen) and we get 1/1431 - less than one tenth of a percent.

If you draw some other card first (52/54), the probability of matching the second card is 3/53. We multiply the values ​​​​and get 78/1431 (a little more than 5.5%). What do we do with these two results? They don't intersect, and we want to know the probability of each of them, so we sum up the values. We get the final result 79/1431 (still about 5.5%).

If we wanted to be sure of the accuracy of the answer, we could calculate the probability of all other possible outcomes: drawing the joker and not matching the second card, or drawing some other card and not matching the second card. Summing up these probabilities and the probability of winning, we would get exactly 100%. I won't give the math here, but you can try the math to double check.

The Monty Hall Paradox

This brings us to a rather well-known paradox that often confuses many, the Monty Hall Paradox. The paradox is named after the host of the TV show Let's Make a Deal. For those who have never seen this TV show, I will say that it was the opposite of The Price Is Right.

In The Price Is Right, the host (previously hosted by Bob Barker, now Drew Carey? Nevermind) is your friend. He wants you to win money or cool prizes. It tries to give you every opportunity to win, as long as you can guess how much the sponsored items are actually worth.

Monty Hall behaved differently. He was like the evil twin of Bob Barker. His goal was to make you look like an idiot on national television. If you were on the show, he was your opponent, you played against him and the odds were in his favor. Maybe I'm being overly harsh, but looking at a show you're more likely to get into if you're wearing a ridiculous costume, that's exactly what I'm coming to.

One of the most famous memes of the show was this: there are three doors in front of you, door number 1, door number 2 and door number 3. You can choose one door for free. Behind one of them is a magnificent prize - for example, a new car. There are no prizes behind the other two doors, both of them are of no value. They are supposed to humiliate you, so behind them is not just nothing, but something stupid, for example, a goat or a huge tube of toothpaste - anything but a new car.

You choose one of the doors, Monty is about to open it to let you know if you won or not... but wait. Before we know, let's take a look at one of those doors you didn't choose. Monty knows which door the prize is behind, and he can always open a door that doesn't have a prize behind it. “Do you choose door number 3? Then let's open door number 1 to show that there was no prize behind it." And now, out of generosity, he offers you the opportunity to exchange the chosen door number 3 for what is behind door number 2.

At this point, the question of probability arises: does this opportunity increase your probability of winning, or lower it, or does it remain unchanged? How do you think?

Correct answer: the ability to choose another door increases the chance of winning from 1/3 to 2/3. This is illogical. If you haven't encountered this paradox before, then most likely you are thinking: wait, how is it: by opening one door, we magically changed the probability? As we saw with the maps example, this is exactly what happens when we get more information. Obviously, when you choose for the first time, the probability of winning is 1/3. When one door opens, it does not change the probability of winning for the first choice at all: the probability is still 1/3. But the probability that the other door is correct is now 2/3.

Let's look at this example from the other side. You choose a door. The probability of winning is 1/3. I suggest you change the other two doors, which is what Monty Hall does. Of course, he opens one of the doors to show that there is no prize behind it, but he can always do this, so it doesn't really change anything. Of course, you will want to choose a different door.

If you don't quite understand the question and need a more convincing explanation, click on this link to go to a great little Flash application that will allow you to explore this paradox in more detail. You can start with about 10 doors and then gradually move up to a game with three doors. There is also a simulator where you can play with any number of doors from 3 to 50 or run several thousand simulations and see how many times you would win if you played.

Choose one of the three doors - the probability of winning is 1/3. Now you have two strategies: to change the choice after opening the wrong door or not. If you do not change your choice, then the probability will remain 1/3, since the choice is only at the first stage, and you must guess right away. If you change, then you can win if you first choose the wrong door (then they open another wrong one, the right one remains - changing the decision, you just take it). The probability of choosing the wrong door at the beginning is 2/3 - so it turns out that by changing your decision, you double the probability of winning.

Remarque from a teacher of higher mathematics and a specialist in game balance Maxim Soldatov - of course, Schreiber did not have her, but without her it is quite difficult to understand this magical transformation

Revisiting the Monty Hall Paradox

As for the show itself: even if Monty Hall's rivals were not strong in mathematics, he understood it well. Here's what he did to change the game a bit. If you chose the door behind which the prize was, with a probability of 1/3, he always offered you the option to choose another door. You choose a car and then swap it for a goat and you look pretty stupid - which is exactly what you need, because Hall is kind of an evil guy.

But if you pick a door that doesn't have a prize, he'll only offer you another one half the time, or he'll just show you your new goat and you'll leave the stage. Let's analyze this new game, in which Monty Hall can decide whether or not to offer you the chance to choose another door.

Suppose he follows this algorithm: if you choose a door with a prize, he always offers you the opportunity to choose another door, otherwise he is equally likely to offer you to choose another door or give you a goat. What is the probability of your winning?

In one of three options you immediately choose the door behind which the prize is located, and the host invites you to choose another one.

Of the remaining two options out of three (you initially choose the door without a prize), in half the cases the host will offer you to change your decision, and in the other half of the cases it will not.

Half of 2/3 is 1/3, that is, in one case out of three you will get a goat, in one case out of three you will choose the wrong door and the host will offer you to choose another one, and in one case out of three you will choose the correct door, but he again offer another.

If the facilitator offers to choose another door, we already know that one of the three cases when he gives us a goat and we leave did not happen. This useful information: it means that our chances of winning have changed. Two out of three cases where we have a choice: in one case it means that we guessed correctly, and in the other case, that we guessed incorrectly, so if we were offered a choice at all, then the probability of our winning is 1/2 , and mathematically it doesn't matter whether you stick with your choice or choose another door.

Like poker, it's a psychological game, not a mathematical one. Why did Monty offer you a choice? He thinks that you are a simpleton who does not know that choosing another door is the “right” decision and will stubbornly hold on to your choice (after all, psychologically the situation is more complicated when you chose a car and then lost it)?

Or does he, deciding that you are smart and choose another door, offer you this chance, because he knows that you initially guessed correctly and fall on the hook? Or maybe he is uncharacteristically kind and pushes you to do something beneficial for you, because he has not donated cars for a long time and the producers say that the audience is getting bored, and it would be better to donate soon big prize so that the ratings do not fall?

Thus, Monty manages to sometimes offer a choice, while the overall probability of winning remains equal to 1/3. Remember that the probability that you will lose immediately is 1/3. There is a 1/3 chance that you will guess right right away, and 50% of those times you will win (1/3 x 1/2 = 1/6).

The probability that you guess wrong at first, but then have a chance to choose another door is 1/3, and in half of these cases you will win (also 1/6). Add up two independent winning possibilities and you get a probability of 1/3, so it doesn't matter if you stay on your choice or choose another door - the total probability of your winning throughout the game is 1/3.

The probability does not become greater than in the situation when you guessed the door and the host simply showed you what is behind it, without offering to choose another one. The point of the proposal is not to change the probability, but to make the decision-making process more fun for television viewing.

By the way, this is one of the reasons why poker can be so interesting: in most formats between rounds, when bets are made (for example, the flop, turn and river in Texas Hold'em), the cards are gradually revealed, and if at the beginning of the game you have one chance to win , then after each round of betting, when more cards are open, this probability changes.

Boy and girl paradox

This brings us to another well-known paradox that tends to puzzle everyone, the boy-girl paradox. The only thing I write about today that is not directly related to games (although I guess I just have to push you to create appropriate game mechanics). This is more of a puzzle, but an interesting one, and in order to solve it, you need to understand the conditional probability that we talked about above.

Task: I have a friend with two children, at least one of them is a girl. What is the probability that the second child is also a girl? Let's assume that in any family the chances of having a girl and a boy are 50/50, and this is true for every child.

In fact, some men have more sperm with an X chromosome or a Y chromosome in their semen, so the odds vary slightly. If you know that one child is a girl, the chance of having a second girl is slightly higher, and there are other conditions, such as hermaphroditism. But to solve this problem, we will not take this into account and assume that the birth of a child is an independent event and the birth of a boy and a girl are equally likely.

Since we're talking about a 1/2 chance, we intuitively expect the answer to be 1/2 or 1/4, or some other multiple of two in the denominator. But the answer is 1/3. Why?

The difficulty in this case is that the information that we have reduces the number of possibilities. Suppose the parents are fans of Sesame Street and regardless of the sex of the children named them A and B. Under normal conditions, there are four equally likely possibilities: A and B are two boys, A and B are two girls, A is a boy and B is a girl, A is a girl and B is a boy. Since we know that at least one child is a girl, we can rule out the possibility that A and B are two boys. So we're left with three possibilities - still equally likely. If all possibilities are equally likely and there are three of them, then the probability of each of them is 1/3. Only in one of these three options are both children girls, so the answer is 1/3.

And again about the paradox of a boy and a girl

The solution to the problem becomes even more illogical. Imagine that my friend has two children and one of them is a girl who was born on Tuesday. Let us assume that under normal conditions a child is equally likely to be born on each of the seven days of the week. What is the probability that the second child is also a girl?

You might think the answer would still be 1/3: what does Tuesday mean? But in this case, intuition fails us. The answer is 13/27, which is not just not intuitive, but very strange. What is the matter in this case?

Actually, Tuesday changes the probability because we don't know which baby was born on Tuesday, or perhaps both were born on Tuesday. In this case, we use the same logic: we count all possible combinations when at least one child is a girl who was born on Tuesday. As in the previous example, suppose the children are named A and B. The combinations look like this:

  • A is a girl who was born on Tuesday, B is a boy (in this situation there are 7 possibilities, one for each day of the week when a boy could have been born).
  • B - a girl who was born on Tuesday, A - a boy (also 7 possibilities).
  • A is a girl who was born on Tuesday, B is a girl who was born on a different day of the week (6 possibilities).
  • B - a girl who was born on Tuesday, A - a girl who was not born on Tuesday (also 6 probabilities).
  • A and B are two girls who were born on Tuesday (1 possibility, you need to pay attention to this so as not to count twice).

We sum up and get 27 different equally possible combinations of the birth of children and days with at least one possibility of a girl being born on Tuesday. Of these, 13 possibilities are when two girls are born. It also looks completely illogical - it seems that this task was invented only to cause a headache. If you're still puzzled, the website of game theorist Jesper Juhl has a good explanation of this.

If you are currently working on a game

If there is randomness in the game you are designing, this is a great opportunity to analyze it. Select any element you want to analyze. First ask yourself what you would expect the probability of a given element to be in the context of the game.

For example, if you're making an RPG and you're thinking about how likely it should be for a player to beat a monster in battle, ask yourself what win percentage feels right to you. Usually, in the case of console RPGs, players get very upset when they lose, so it's better that they lose infrequently - 10% of the time or less. If you're an RPG designer, you probably know better than me, but you need to have a basic idea of ​​what the probability should be.

Then ask yourself if your probabilities are dependent (as with cards) or independent (as with dice). Discuss all possible outcomes and their probabilities. Make sure that the sum of all probabilities is 100%. And, of course, compare your results with your expectations. Is it possible to roll dice or draw cards as you intended, or it is clear that the values ​​​​need to be adjusted. And, of course, if you find flaws, you can use the same calculations to determine how much you need to change the values.

Homework

Your " homework» this week will help you hone your skills with probability. Here are two dice games and a card game that you have to analyze using probability, as well as a strange game mechanic that I once developed - you will test the Monte Carlo method on its example.

Game #1 - Dragon Bones

This is a dice game that my colleagues and I once came up with (thanks to Jeb Havens and Jesse King) - it deliberately blows people's minds with its probabilities. This is a simple casino game called "Dragon Dice" and it is a gambling dice competition between the player and the establishment.

You are given a regular 1d6 die. The goal of the game is to roll a number higher than the house's. Tom is given a non-standard 1d6 - the same as yours, but on one of its faces instead of one - the image of a dragon (thus, the casino has a dragon-2-3-4-5-6 die). If the institution gets a dragon, it automatically wins, and you lose. If both get the same number, it's a draw and you roll the dice again. The one who rolls the highest number wins.

Of course, everything is not entirely in favor of the player, because the casino has an advantage in the form of a dragon face. But is it really so? This is what you have to calculate. But first check your intuition.

Let's say the win is 2 to 1. So if you win, you keep your bet and get double the amount. For example, if you bet $1 and win, you keep that dollar and get another $2 on top, for a total of $3. If you lose, you only lose your bet. Would you play? Do you intuitively feel that the probability is greater than 2 to 1, or do you still think it is less? In other words, on average over 3 games, do you expect to win more than once, or less, or once?

Once you've got your intuition out of the way, apply the math. There are only 36 possible positions for both dice, so you can easily count them all. If you're unsure about this 2-to-1 offer, consider this: Let's say you played the game 36 times (betting $1 each time). For every win you get $2, for every loss you lose $1, and a draw doesn't change anything. Count all your likely wins and losses and decide if you will lose some dollars or gain. Then ask yourself how right your intuition turned out to be. And then realize what a villain I am.

And, yes, if you have already thought about this question - I deliberately confuse you by distorting the real mechanics of dice games, but I'm sure you can overcome this obstacle with just a good thought. Try to solve this problem yourself.

Game #2 - Roll of Luck

This gambling in a dice called Lucky Roll (also Birdcage, because sometimes the dice are not rolled, but placed in a large wire cage, reminiscent of the cage from Bingo). The game is simple, it basically boils down to this: Bet, say, $1 on a number between 1 and 6. Then you roll 3d6. For each die that hits your number, you get $1 (and keep your original bet). If your number doesn't land on any of the dice, the casino gets your dollar and you get nothing. So if you bet on 1 and you get 1 on the face three times, you get $3.

Intuitively, it seems that in this game the chances are even. Each dice is an individual 1 in 6 chance of winning, so your chance of winning is 3 to 6 on three rolls. However, remember, of course, that you are stacking three separate dice and you are only allowed to add if we talking about individual winning combinations the same bone. Something you will need to multiply.

Once you've calculated all the possible outcomes (probably easier to do in Excel than by hand, there are 216 of them), the game still looks even-odd at first glance. In fact, the casino is still more likely to win - how much more? In particular, how much money do you expect to lose on average per game round?

All you have to do is add up the wins and losses of all 216 results and then divide by 216, which should be pretty easy. But as you can see, there are a few pitfalls that you can fall into, which is why I'm saying that if you think there's an even chance of winning in this game, you've misunderstood.

Game #3 - 5 Card Stud

If you have already warmed up on previous games, let's check what we know about conditional probability using this card game as an example. Let's imagine poker with a deck of 52 cards. Let's also imagine 5 card stud where each player only gets 5 cards. Can't discard a card, can't draw a new one, no common deck - you only get 5 cards.

A royal flush is 10-J-Q-K-A in one hand, for a total of four, so there are four possible ways to get a royal flush. Calculate the probability that you will get one of these combinations.

I have one thing to warn you about: remember that you can draw these five cards in any order. That is, at first you can draw an ace, or a ten, it doesn’t matter. So when doing your calculations, keep in mind that there are actually more than four ways to get a royal flush, assuming the cards were dealt in order.

Game #4 - IMF Lottery

The fourth task will not be so easy to solve using the methods that we talked about today, but you can easily simulate the situation using programming or Excel. It is on the example of this problem that you can work out the Monte Carlo method.

I mentioned earlier the game Chron X that I once worked on, and there was one very interesting map- IMF lottery. Here's how it worked: you used it in a game. After the round ended, the cards were redistributed, and there was a 10% chance that the card would be out of play and that a random player would receive 5 units of each type of resource that was present on that card. A card was put into play without a single token, but each time it remained in play at the beginning of the next round, it received one token.

So there was a 10% chance that you would put it into play, the round would end, the card would leave play, and no one would get anything. If it doesn't (with a 90% chance), there is a 10% chance (actually 9%, since that's 10% of 90%) that she will leave the game on the next round and someone will get 5 resources. If the card leaves the game after one round (10% of the 81% available, so the probability is 8.1%), someone will receive 10 units, another round - 15, another 20, and so on. Question: what is the expected value of the number of resources that you will receive from this card when it finally leaves the game?

Normally we would try to solve this problem by calculating the probability of each outcome and multiplying by the number of all outcomes. There is a 10% chance that you will get 0 (0.1 * 0 = 0). 9% that you will receive 5 units of resources (9% * 5 = 0.45 resources). 8.1% of what you get is 10 (8.1% * 10 = 0.81 resources - in general, the expected value). Etc. And then we would sum it all up.

And now the problem is obvious to you: there is always a chance that the card will not leave the game, it can stay in the game forever, for an infinite number of rounds, so there is no way to calculate any probability. The methods we have learned today do not allow us to calculate the infinite recursion, so we will have to create it artificially.

If you are good enough at programming, write a program that will simulate this card. You should have a time loop that brings the variable to the initial position of zero, shows a random number, and with a 10% chance the variable exits the loop. Otherwise, it adds 5 to the variable and the loop repeats. When it finally exits the loop, increase the total number of trial runs by 1 and the total number of resources (by how much depends on where the variable stopped). Then reset the variable and start over.

Run the program several thousand times. In the end, divide the total resources by the total number of runs - this will be your expected value of the Monte Carlo method. Run the program several times to make sure the numbers you get are roughly the same. If the spread is still large, increase the number of repetitions in the outer loop until you start getting matches. You can be sure that whatever numbers you end up with will be approximately correct.

If you're new to programming (even if you are), here's a little exercise to test your Excel skills. If you are a game designer, these skills will never be superfluous.

Now the if and rand functions will be very useful to you. Rand doesn't require values, it just produces a random decimal number between 0 and 1. We usually combine it with floor and pluses and minuses to simulate a roll of the die, which I mentioned earlier. However, in this case we're just leaving a 10% chance that the card will leave the game, so we can just check to see if rand is less than 0.1 and not worry about it anymore.

If has three values. In order, the condition that is either true or not, then the value that is returned if the condition is true, and the value that is returned if the condition is false. So the following function will return 5% of the time, and 0 the other 90% of the time: =IF(RAND()<0.1,5,0) .

There are many ways to set this command, but I would use this formula for the cell that represents the first round, let's say it is cell A1: =IF(RAND()<0.1,0,-1) .

Here I'm using a negative variable meaning "this card hasn't left the game and hasn't given any resources yet". So if the first round is over and the card is out of play, A1 is 0; otherwise it is -1.

For the next cell representing the second round: =IF(A1>-1, A1, IF(RAND()<0.1,5,-1)) . So if the first round ends and the card immediately leaves the game, A1 is 0 (number of resources) and this cell will simply copy that value. Otherwise, A1 is -1 (the card hasn't left the game yet), and this cell continues to randomly move: 10% of the time it will return 5 units of resources, the rest of the time its value will still be -1. If we apply this formula to additional cells, we will get additional rounds, and whichever cell you end up with, you will get the final result (or -1 if the card has not left the game after all the rounds you played).

Take this row of cells, which is the only round with this card, and copy and paste a few hundred (or thousands) of rows. We may not be able to do an infinite test for Excel (there is a limited number of cells in the table), but at least we can cover most cases. Then select one cell where you will put the average of the results of all rounds - Excel kindly provides the average() function for this.

On Windows, at least you can press F9 to recalculate all random numbers. As before, do this a few times and see if you get the same values. If the spread is too large, double the number of runs and try again.

Unsolved problems

If you happen to have a degree in probability theory and the above problems seem too easy for you - here are two problems that I have been scratching my head over for years, but, alas, I am not so good at mathematics to solve them.

Unsolved Problem #1: IMF Lottery

The first unsolved problem is the previous homework assignment. I can easily use the Monte Carlo method (using C++ or Excel) and be sure of the answer to the question "how many resources the player will receive", but I do not know exactly how to provide an exact provable answer mathematically (this is an infinite series) .

Unsolved Problem #2: Shape Sequences

This task (it also goes far beyond the tasks that are solved in this blog) was thrown to me by a familiar gamer more than ten years ago. While playing blackjack in Vegas, he noticed one interesting feature: drawing cards from an 8-deck shoe, he saw ten pieces in a row (a piece or face card is 10, Joker, King or Queen, so there are 16 in total in a standard deck of 52 cards or 128 in a 416-card shoe).

What is the probability that this shoe contains at least one sequence of ten or more pieces? Let's assume that they were shuffled honestly, in random order. Or, if you prefer, what is the probability that there is no sequence of ten or more shapes anywhere?

We can simplify the task. Here is a sequence of 416 parts. Each part is 0 or 1. There are 128 ones and 288 zeros randomly scattered throughout the sequence. How many ways are there to randomly interleave 128 ones with 288 zeros, and how many times will there be at least one group of ten or more ones in these ways?

Whenever I set about solving this problem, it seemed easy and obvious to me, but as soon as I delved into the details, it suddenly fell apart and seemed simply impossible.

So take your time blurting out the answer: sit down, think carefully, study the conditions, try plugging in real numbers, because all the people I spoke to about this problem (including several graduate students working in this field) reacted in much the same way: “It’s completely obvious… oh no, wait, not obvious at all.” This is the case when I do not have a method for calculating all the options. Of course, I could brute force the problem through a computer algorithm, but it would be much more interesting to find out the mathematical way to solve it.

Knowing that the probability can be measured, let's try to express it in numbers. There are three possible paths.

Rice. 1.1. Measuring Probability

PROBABILITY DETERMINED BY SYMMETRY

There are situations in which the possible outcomes are equally likely. For example, when tossing a coin once, if the coin is standard, the probability of getting heads or tails is the same, i.e. P(heads) = P(tails). Since only two outcomes are possible, then P(heads) + P(tails) = 1, therefore P(heads) = P(tails) = 0.5.

In experiments where outcomes have equal chances of occurring, the probability of the event E, P(E) is:

Example 1.1. The coin is tossed three times. What is the probability of two heads and one tail?

To begin with, let's find all possible outcomes: To make sure that we have found all possible options, we will use a tree diagram (see Chapter 1 section 1.3.1).

So, there are 8 equally likely outcomes, therefore, the probability of them is 1/8. Event E - two "eagles" and "tails" - there were three. That's why:

Example 1.2. A standard die is rolled twice. What is the probability that the sum of the points is 9 or more?

Let's find all possible outcomes.

Table 1.2. The total number of points obtained by rolling a dice twice

So, in 10 out of 36 possible outcomes, the sum of points is 9, or therefore:

EMPIRICALLY DETERMINED PROBABILITY

An example with a coin from Table. 1.1 clearly illustrates the mechanism for determining probabilities.

With the total number of experiments of which are successful, the probability of the desired result is calculated as follows:

The ratio is the relative frequency of occurrence of a certain result in a sufficiently long experiment. The probability is calculated either on the basis of the data of the experiment, on the basis of past data.

Example 1.3. Of the five hundred electric lamps tested, 415 have worked for more than 1000 hours. Based on the data of this experiment, it can be concluded that the probability of normal operation of a lamp of this type for more than 1000 hours is:

Note. The control is destructive, so not all lamps can be tested. If only one lamp were tested, then the probability would be 1 or 0 (i.e. will it be able to work 1000 hours or not). Hence the need to repeat the experiment.

Example 1.4. In table. 1.3 shows data on the experience of men working in the company:

Table 1.3. Male work experience

What is the probability that the next person hired by the firm will work for at least two years?

Solution.

The table shows that 38 out of 100 employees have been with the company for more than two years. The empirical probability that the next employee will stay with the company for more than two years is:

At the same time, we assume that the new employee is “typical, and the working conditions are unchanged.

SUBJECTIVE EVALUATION OF PROBABILITY

In business, there are often situations in which there is no symmetry, and there are no experimental data either. Therefore, determining the probability of a favorable outcome under the influence of the views and experience of the researcher is subjective.

Example 1.5.

1. An investment expert believes that the probability of making a profit during the first two years is 0.6.

2. Marketing manager's forecast: the probability of selling 1000 units of a product in the first month after its introduction to the market is 0.4.

  • Section 1. Random events (50 hours)
  • Thematic plan of discipline for part-time students
  • Thematic plan of discipline for students of correspondence courses
  • 2.3. Structural-logical scheme of the discipline
  • Mathematics Part 2. Probability theory and elements of mathematical statistics Theory
  • Section 1 Random Events
  • Section 3 Elements of mathematical statistics
  • Section 2 Random Variables
  • 2.5. Practice block
  • 2.6. Point-rating system
  • Information resources of the discipline
  • Bibliographic list Main:
  • 3.2. Reference abstract for the course “Mathematics Part 2. Probability theory and elements of mathematical statistics” introduction
  • Section 1. Random events
  • 1.1. The concept of a random event
  • 1.1.1. Information from set theory
  • 1.1.2. Space of elementary events
  • 1.1.3. Event classification
  • 1.1.4. Sum and product of events
  • 1.2. Probabilities of random events.
  • 1.2.1. Relative frequency of an event, axioms of probability theory. The classical definition of probability
  • 1.2.2. Geometric definition of probability
  • Calculation of the probability of an event through elements of combinatorial analysis
  • 1.2.4. Properties of event probabilities
  • 1.2.5. Independent events
  • 1.2.6. Calculation of the probability of no-failure operation of the device
  • Formulas for calculating the probability of events
  • 1.3.1. Sequence of independent trials (Bernoulli scheme)
  • 1.3.2. Conditional probability of an event
  • 1.3.4. Total probability formula and Bayes formula
  • Section 2. Random variables
  • 2.1. Description of random variables
  • 2.1.1. Definition and methods of setting a random variable One of the basic concepts of probability theory is the concept of a random variable. Consider some examples of random variables:
  • To specify a random variable, you must specify its distribution law. Random variables are usually denoted by Greek letters , , , and their possible values ​​- by Latin letters with indices xi, yi, zi.
  • 2.1.2. Discrete random variables
  • Consider events Ai containing all elementary events  leading to the value XI:
  • Let pi denote the probability of the event Ai:
  • 2.1.3. Continuous random variables
  • 2.1.4. Distribution function and its properties
  • 2.1.5. Probability density distribution and its properties
  • 2.2. Numerical characteristics of random variables
  • 2.2.1. Mathematical expectation of a random variable
  • 2.2.2. Variance of a random variable
  • 2.2.3. Normal distribution of a random variable
  • 2.2.4. Binomial distribution
  • 2.2.5. Poisson distribution
  • Section 3. Elements of mathematical statistics
  • 3.1. Basic definitions
  • bar graph
  • 3.3. Point estimates of distribution parameters
  • Basic concepts
  • Point estimates of mathematical expectation and variance
  • 3.4. Interval Estimates
  • The concept of interval estimation
  • Building interval estimates
  • Basic statistical distributions
  • Interval Estimates of the Expectation of the Normal Distribution
  • Interval estimation of the variance of the normal distribution
  • Conclusion
  • Glossary
  • 4. Guidelines for performing laboratory work
  • Bibliographic list
  • Laboratory work 1 description of random variables. Numerical characteristics
  • Procedure for performing laboratory work
  • Laboratory work 2 Basic definitions. Systematization of the sample. Point estimates of distribution parameters. Interval estimates.
  • The concept of a statistical hypothesis about the type of distribution
  • Procedure for performing laboratory work
  • Cell Value Cell Value
  • 5. Guidelines for the performance of the control work Task for the control work
  • Guidelines for the performance of control work Events and their probabilities
  • random variables
  • Standard deviation
  • Elements of mathematical statistics
  • 6. Block of control of mastering the discipline
  • Questions for the exam on the course "Mathematics Part 2. Probability theory and elements of mathematical statistics»
  • Continuation of the table in
  • End of table in
  • Uniformly distributed random numbers
  • Content
  • Section 1. Random events…………………………………………. eighteen
  • Section 2. Random variables..………………………………….. 41
  • Section 3. Elements of mathematical statistics............... . 64
  • 4. Guidelines for the implementation of laboratory
  • 5. Guidelines for the implementation of the control
      1. Formulas for calculating the probability of events

    1.3.1. Sequence of independent trials (Bernoulli scheme)

    Suppose that some experiment can be carried out repeatedly under the same conditions. Let this experience be made n times, i.e., a sequence of n tests.

    Definition. Subsequence n tests are called mutually independent if any event associated with a given test is independent of any events associated with other tests.

    Let's say that some event A likely to happen p as a result of one test or not happen with probability q= 1- p.

    Definition . Sequence of n test forms a Bernoulli scheme if the following conditions are met:

      subsequence n tests are mutually independent,

    2) probability of an event A does not change from test to test and does not depend on the result in other tests.

    Event A is called a "success" of the test, and the opposite event is called a "failure". Consider an event

    =( in n tests happened exactly m"success").

    To calculate the probability of this event, the Bernoulli formula is valid

    p() =
    , m = 1, 2, …, n , (1.6)

    where - number of combinations of n elements by m :

    =
    =
    .

    Example 1.16. Throw the dice three times. To find:

    a) the probability that 6 points will fall out twice;

    b) the probability that the number of sixes does not appear more than twice.

    Solution . The “success” of the test will be considered the loss of a face on the die with the image of 6 points.

    a) Total number of tests - n=3, number of “successes” – m = 2. Probability of “success” - p=, and the probability of "failure" - q= 1 - =. Then, according to the Bernoulli formula, the probability that the side with six points falls out twice as a result of throwing the die three times will be equal to

    .

    b) Denote by BUT an event that a face with a score of 6 will appear at most twice. Then the event can be represented as sums of three incompatible events A=
    ,

    where IN 3 0 – event when the face of interest never appears,

    IN 3 1 - event when the face of interest appears once,

    IN 3 2 - event when the face of interest appears twice.

    By the Bernoulli formula (1.6) we find

    p(BUT) = p(
    ) = p(
    )=
    +
    +
    =

    =
    .

    1.3.2. Conditional probability of an event

    The conditional probability reflects the impact of one event on the probability of another. Changing the conditions under which the experiment is conducted also affects

    the probability of occurrence of the event of interest.

    Definition. Let be A And B- some events, and the probability p(B)> 0.

    Conditional Probability developments A provided that "event Balready happened” is the ratio of the probability of producing these events to the probability of an event that occurred earlier than the event whose probability is to be found. The conditional probability is denoted as p(AB). Then by definition

    p (A B) =
    . (1.7)

    Example 1.17. Throw two dice. The space of elementary events consists of ordered pairs of numbers

    (1,1) (1,2) (1,3) (1,4) (1,5) (1,6)

    (2,1) (2,2) (2,3) (2,4) (2,5) (2,6)

    (3,1) (3,2) (3,3) (3,4) (3,5) (3,6)

    (4,1) (4,2) (4,3) (4,4) (4,5) (4,6)

    (5,1) (5,2) (5,3) (5,4) (5,5) (5,6)

    (6,1) (6,2) (6,3) (6,4) (6,5) (6,6).

    In example 1.16 it was found that the event A=(number of points on the first die > 4) and event C=(the sum of points is 8) are dependent. Let's make a relation

    .

    This relationship can be interpreted as follows. Assume that the result of the first roll is known to be that the number of points on the first die is > 4. It follows that the throwing of the second die can lead to one of the 12 outcomes that make up the event A:

    (5,1) (5,2) (5,3) (5,4) (5,5) (5,6)

    (6,1) (6,2) (6,3) (6,4) (6,5) (6,6) .

    At the same time, the event C only two of them (5.3) (6.2) can match. In this case, the probability of the event C will be equal to
    . Thus, information about the occurrence of an event A influenced the likelihood of an event C.

          Probability of producing events

    Multiplication theorem

    Probability of producing eventsA 1 A 2 A n is determined by the formula

    p(A 1 A 2 A n)=p(A 1)p(A 2 A 1))p(A n A 1 A 2 A n- 1). (1.8)

    For the product of two events, it follows that

    p(AB)=p(AB)p{B)=p(BA)p{A). (1.9)

    Example 1.18. In a batch of 25 items, 5 items are defective. 3 items are chosen at random. Determine the probability that all selected products are defective.

    Solution. Let's denote the events:

    A 1 = (first product is defective),

    A 2 = (second product is defective),

    A 3 = (third product is defective),

    A = (all products are defective).

    Event BUT is the product of three events A = A 1 A 2 A 3 .

    From the multiplication theorem (1.6) we get

    p(A)= p( A 1 A 2 A 3 ) = p(A 1) p(A 2 A 1))p(A 3 A 1 A 2).

    The classical definition of probability allows us to find p(A 1) is the ratio of the number of defective products to the total number of products:

    p(A 1)= ;

    p(A 2) this the ratio of the number of defective products remaining after the withdrawal of one, to the total number of remaining products:

    p(A 2 A 1))= ;

    p(A 3) is the ratio of the number of defective products remaining after the withdrawal of two defective products to the total number of remaining products:

    p(A 3 A 1 A 2)=.

    Then the probability of the event A will be equal to

    p(A) ==
    .

    This is the ratio of the number of those observations in which the event in question occurred to the total number of observations. Such an interpretation is admissible in the case of a sufficiently large number of observations or experiments. For example, if about half of the people you meet on the street are women, then you can say that the probability that the person you meet on the street is a woman is 1/2. In other words, the frequency of its occurrence in a long series of independent repetitions of a random experiment can serve as an estimate of the probability of an event.

    Probability in mathematics

    In the modern mathematical approach, the classical (that is, not quantum) probability is given by Kolmogorov's axiomatics. Probability is a measure P, which is set on the set X, called the probability space. This measure must have the following properties:

    It follows from these conditions that the probability measure P also has the property additivity: if sets A 1 and A 2 do not intersect, then . To prove it, you need to put everything A 3 , A 4 , … equal to the empty set and apply the property of countable additivity.

    The probability measure may not be defined for all subsets of the set X. It suffices to define it on the sigma-algebra consisting of some subsets of the set X. In this case, random events are defined as measurable subsets of the space X, that is, as elements of the sigma algebra.

    Probability sense

    When we find that the reasons for some possible fact to actually occur outweigh the opposite reasons, we consider this fact probable, otherwise - incredible. This predominance of positive bases over negative ones, and vice versa, can represent an indefinite set of degrees, as a result of which probability(And improbability) happens more or less .

    Complicated single facts do not allow an exact calculation of their degrees of probability, but even here it is important to establish some large subdivisions. So, for example, in the field of law, when a personal fact subject to trial is established on the basis of witness testimony, it always remains, strictly speaking, only probable, and it is necessary to know how significant this probability is; in Roman law, a quadruple division was accepted here: probatio plena(where the probability practically turns into authenticity), Further - probatio minus plena, then - probatio semiplena major and finally probatio semiplena minor .

    In addition to the question of the probability of the case, there may arise, both in the field of law and in the field of morality (with a certain ethical point of view), the question of how likely it is that a given particular fact constitutes a violation of the general law. This question, which serves as the main motif in the religious jurisprudence of the Talmud, has also given rise to Roman Catholic moral theology (especially since late XVI century) very complex systematic constructions and huge literature, dogmatic and polemical (see Probabilism).

    The concept of probability admits of a definite numerical expression in its application only to such facts which are part of certain homogeneous series. So (in the simplest example), when someone throws a coin a hundred times in a row, we find here one general or large series (the sum of all falls of a coin), which is composed of two private or smaller, in this case numerically equal, series (falls " eagle" and falling "tails"); The probability that in this time the coin will fall tails, that is, that this new member of the general series will belong to this of the two smaller series, equals a fraction expressing the numerical ratio between this small series and the large one, namely 1/2, that is, the same probability belongs to one or the other of the two private rows. In less simple examples the conclusion cannot be drawn directly from the data of the problem itself, but requires prior induction. So, for example, one asks: what is the probability for this newborn live to be 80 years old? Here should make a general, or large, series of known number people born in similar conditions and dying at different ages (this number should be large enough to eliminate random deviations, and small enough to preserve the homogeneity of the series, because for a person born, for example, in St. Petersburg in a wealthy cultural family , the entire millionth population of the city, a significant part of which consists of people of various groups that can die ahead of time - soldiers, journalists, workers dangerous professions, - represents a group too heterogeneous for the present definition of probability); let this total number consist of ten thousand human lives; it includes smaller rows representing the number of those who live to this or that age; one of these smaller rows represents the number of those living to 80 years of age. But it is impossible to determine the size of this smaller series (as well as all others). a priori; this is done in a purely inductive way, through statistics. Suppose statistical studies have established that out of 10,000 Petersburgers of the middle class, only 45 survive to the age of 80; thus this smaller series is related to the larger one as 45 to 10,000, and the probability for this person to belong to this smaller series, that is, to live to 80 years old, is expressed as a fraction of 0.0045. The study of probability from a mathematical point of view constitutes a special discipline, the theory of probability.

    see also

    Notes

    Literature

    • Alfred Renyi. Letters on Probability / transl. from Hung. D. Saas and A. Crumley, ed. B. V. Gnedenko. M.: Mir. 1970
    • Gnedenko B.V. Probability course. M., 2007. 42 p.
    • Kuptsov V.I. Determinism and probability. M., 1976. 256 p.

    Wikimedia Foundation. 2010 .

    Synonyms:

    Antonyms:

    See what "Probability" is in other dictionaries:

      General scientific and philosophical. a category denoting the quantitative degree of the possibility of the appearance of mass random events under fixed observation conditions, characterizing the stability of their relative frequencies. In logic, the semantic degree ... ... Philosophical Encyclopedia

      PROBABILITY, a number in the range from zero to one inclusive, representing the possibility of accomplishment this event. The probability of an event is defined as the ratio of the number of chances that an event can occur to the total number of possible ... ... Scientific and technical encyclopedic dictionary

      In all likelihood .. Dictionary of Russian synonyms and expressions similar in meaning. under. ed. N. Abramova, M.: Russian dictionaries, 1999. probability, possibility, probability, chance, objective possibility, maza, admissibility, risk. Ant. impossibility... ... Synonym dictionary

      probability- A measure that an event can occur. Note The mathematical definition of probability is "a real number between 0 and 1 related to a random event." The number may reflect the relative frequency in a series of observations ... ... Technical Translator's Handbook

      Probability- "a mathematical, numerical characteristic of the degree of possibility of the occurrence of any event in certain specific conditions that can be repeated an unlimited number of times." Based on this classic… … Economic and Mathematical Dictionary

      - (probability) The possibility of the occurrence of an event or a certain result. It can be represented as a scale with divisions from 0 to 1. If the probability of an event is zero, its occurrence is impossible. With a probability equal to 1, the onset of ... Glossary of business terms