Probability Theory. Problem solving (2019)

11.10.2019

Probability event is the ratio of the number of elementary outcomes that favor a given event to the number of all equally possible outcomes of experience in which this event may occur. The probability of an event A is denoted by P(A) (here P is the first letter of the French word probabilite - probability). According to the definition
(1.2.1)
where is the number of elementary outcomes favoring event A; - the number of all equally possible elementary outcomes of experience, forming a complete group of events.
This definition of probability is called classical. It arose at the initial stage of the development of probability theory.

The probability of an event has the following properties:
1. The probability of a certain event is equal to one. Let's designate a certain event by the letter . For a certain event, therefore
(1.2.2)
2. The probability of an impossible event is zero. We denote the impossible event by the letter . For an impossible event, therefore
(1.2.3)
3. The probability of a random event is expressed as a positive number less than one. Since the inequalities , or are satisfied for a random event, then
(1.2.4)
4. The probability of any event satisfies the inequalities
(1.2.5)
This follows from relations (1.2.2) -(1.2.4).

Example 1 An urn contains 10 balls of the same size and weight, of which 4 are red and 6 are blue. One ball is drawn from the urn. What is the probability that the drawn ball is blue?

Solution. The event "the drawn ball turned out to be blue" will be denoted by the letter A. This trial has 10 equally possible elementary outcomes, of which 6 favor event A. In accordance with formula (1.2.1), we obtain

Example 2 All natural numbers from 1 to 30 are written on identical cards and placed in an urn. After thoroughly mixing the cards, one card is removed from the urn. What is the probability that the number on the card drawn is a multiple of 5?

Solution. Denote by A the event "the number on the taken card is a multiple of 5". In this test, there are 30 equally possible elementary outcomes, of which 6 outcomes favor event A (numbers 5, 10, 15, 20, 25, 30). Hence,

Example 3 Two dice are thrown, the sum of points on the upper faces is calculated. Find the probability of the event B, consisting in the fact that the top faces of the cubes will have a total of 9 points.

Solution. There are 6 2 = 36 equally possible elementary outcomes in this trial. Event B is favored by 4 outcomes: (3;6), (4;5), (5;4), (6;3), so

Example 4. A natural number not exceeding 10 is chosen at random. What is the probability that this number is prime?

Solution. Denote by the letter C the event "the chosen number is prime". In this case, n = 10, m = 4 (primes 2, 3, 5, 7). Therefore, the desired probability

Example 5 Two symmetrical coins are tossed. What is the probability that both coins have digits on the top sides?

Solution. Let's denote by the letter D the event "there was a number on the top side of each coin". There are 4 equally possible elementary outcomes in this test: (G, G), (G, C), (C, G), (C, C). (The notation (G, C) means that on the first coin there is a coat of arms, on the second - a number). Event D is favored by one elementary outcome (C, C). Since m = 1, n = 4, then

Example 6 What is the probability that the digits in a randomly chosen two-digit number are the same?

Solution. Two-digit numbers are numbers from 10 to 99; there are 90 such numbers in total. 9 numbers have the same digits (these are the numbers 11, 22, 33, 44, 55, 66, 77, 88, 99). Since in this case m = 9, n = 90, then
,
where A is the "number with the same digits" event.

Example 7 From the letters of the word differential one letter is chosen at random. What is the probability that this letter will be: a) a vowel b) a consonant c) a letter h?

Solution. There are 12 letters in the word differential, of which 5 are vowels and 7 are consonants. Letters h this word does not. Let's denote the events: A - "vowel", B - "consonant", C - "letter h". The number of favorable elementary outcomes: - for event A, - for event B, - for event C. Since n \u003d 12, then
, And .

Example 8 Two dice are tossed, the number of points on the top face of each dice is noted. Find the probability that both dice have the same number of points.

Solution. We denote this event by the letter A. Event A is favored by 6 elementary outcomes: (1;]), (2;2), (3;3), (4;4), (5;5), (6;6). In total there are equally possible elementary outcomes that form a complete group of events, in this case n=6 2 =36. So the desired probability

Example 9 The book has 300 pages. What is the probability that a randomly opened page will have a sequence number that is a multiple of 5?

Solution. It follows from the conditions of the problem that there will be n = 300 of all equally possible elementary outcomes that form a complete group of events. Of these, m = 60 favor the occurrence of the specified event. Indeed, a number that is a multiple of 5 has the form 5k, where k is a natural number, and , whence . Hence,
, where A - the "page" event has a sequence number that is a multiple of 5".

Example 10. Two dice are thrown, the sum of points on the upper faces is calculated. What is more likely to get a total of 7 or 8?

Solution. Let's designate the events: A - "7 points fell out", B - "8 points fell out". Event A is favored by 6 elementary outcomes: (1; 6), (2; 5), (3; 4), (4; 3), (5; 2), (6; 1), and event B - by 5 outcomes: (2; 6), (3; 5), (4; 4), (5; 3), (6; 2). There are n = 6 2 = 36 of all equally possible elementary outcomes. Hence, And .

So, P(A)>P(B), that is, getting a total of 7 points is a more likely event than getting a total of 8 points.

Tasks

1. A natural number not exceeding 30 is chosen at random. What is the probability that this number is a multiple of 3?
2. In the urn a red and b blue balls of the same size and weight. What is the probability that a randomly drawn ball from this urn is blue?
3. A number not exceeding 30 is chosen at random. What is the probability that this number is a divisor of zo?
4. In the urn A blue and b red balls of the same size and weight. One ball is drawn from this urn and set aside. This ball is red. Then another ball is drawn from the urn. Find the probability that the second ball is also red.
5. A natural number not exceeding 50 is chosen at random. What is the probability that this number is prime?
6. Three dice are thrown, the sum of points on the upper faces is calculated. What is more likely - to get a total of 9 or 10 points?
7. Three dice are tossed, the sum of the dropped points is calculated. What is more likely to get a total of 11 (event A) or 12 points (event B)?

Answers

1. 1/3. 2 . b/(a+b). 3 . 0,2. 4 . (b-1)/(a+b-1). 5 .0,3.6 . p 1 \u003d 25/216 - the probability of getting 9 points in total; p 2 \u003d 27/216 - the probability of getting 10 points in total; p2 > p1 7 . P(A) = 27/216, P(B) = 25/216, P(A) > P(B).

Questions

1. What is called the probability of an event?
2. What is the probability of a certain event?
3. What is the probability of an impossible event?
4. What are the limits of the probability of a random event?
5. What are the limits of the probability of any event?
6. What definition of probability is called classical?

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.

Until today, almost everything we've talked about has been deterministic, and last week we took a closer 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 don't look like plastic figures, but perform the same function - they generate a 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 looked like a dice, and the other 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 getting any of the faces is the same (I'm assuming you're throwing a regular geometric dice). If you want to know the average value of a toss (known as the mathematical expectation to those who are fond of probability theory), sum the values ​​​​on all the edges and divide this number by the number of edges.

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 is 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 die with special stickers on the faces: 1, 1, 1, 2, 2, 3, so it behaves like a strange three-sided die, 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 replace 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, the 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 look at 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 want an approximate answer instead of an exact one, 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 the conjunction “and” to describe several conditions (for example, what is the probability of some random event and some other independent random event occurring?) - 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).

It is obvious from this example 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 a particular 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 is a good way to double check 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, it should all 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 the arrow board in Chutes & Ladders or A Game of Life, the results of the board in Nuclear War are not equally probable. 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 as 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 ​​​​on all sides and divide them by the number of sides, but how exactly does the calculation work? 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 low value numbers (2, 3, 4) or four high value numbers (9, 10, 11, 12) come up, you will win an amount equal to your bet. 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. This is a 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 win a total of $18 (actually you 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?

Take your time. 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 a 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 should 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 Farkle you get such a big bonus if you hit a straight combination: 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 encountered 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? Probably everything, several times a day, but let's assume that half of them are just trading different items at auctions, chatting on RP servers, or doing other game activities - so only half of them are hunting 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.

By the way, that's 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 little more complicated when it comes to drawing cards from the deck, because each 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 probability of the next card appearing 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 it comes to cards, I assume that 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 won't 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, having drawn 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? Never mind) 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.

A remark from a teacher of higher mathematics and a specialist in game balance Maxim Soldatov - of course, Schreiber did not have it, but without it 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 weren't good at math, he was good at it. 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 a different door half the time, or he'll just show you your new goat and you'll leave the stage. Let's analyze this new game where Monty Hall can decide whether to offer you the chance to choose another door or not.

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 the three options, you immediately choose the door behind which the prize is located, and the host invites you to choose another.

Of the remaining two options out of three (you initially choose the door without a prize), in half of 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 is useful information: it means that our chances of winning have changed. Two of the 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? Does he think that you are a simpleton who does not know that choosing another door is the “right” decision and will stubbornly hold on to his choice (after all, the situation is psychologically more difficult when you choose a car and then lose 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 given cars for a long time and the producers say that the audience is getting bored, and it would be better to give a big prize soon so that did the ratings go down?

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 Sesame Street fans and regardless of the sex of the children they 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 percentage of wins 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 probability skills. 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 that you will test the Monte Carlo method on.

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 is a dice game called Roll of Luck (also Birdcage because sometimes the dice are not rolled but placed in a large wire cage, reminiscent of the Bingo cage). 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 the sum of the three rolls. Remember, of course, that you are stacking three separate dice and you are only allowed to add if we we are talking about separate winning combinations of the same dice. 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 Chron X game that I once worked on, and there was one very interesting card - the 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 of each type of resource that had a token 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). And so on. 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 is 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 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?

Every time 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 don't rush to blurt out the answer: sit down, think carefully, study the conditions, try plugging in real numbers, because all the people I talked 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.

probability is a number from 0 to 1 that reflects the chances that a random event will occur, where 0 is the complete absence of the probability of the occurrence of the event, and 1 means that the event in question will definitely occur.

The probability of an event E is a number between and 1.
The sum of the probabilities of mutually exclusive events is 1.

empirical probability- probability, which is calculated as the relative frequency of the event in the past, extracted from the analysis of historical data.

The probability of very rare events cannot be calculated empirically.

subjective probability- the probability based on a personal subjective assessment of the event, regardless of historical data. Investors who make decisions to buy and sell stocks often act on the basis of subjective probability.

prior probability -

Chance 1 out of… (odds) that an event will occur through the concept of probability. The chance of an event occurring is expressed in terms of probability as follows: P/(1-P).

For example, if the probability of an event is 0.5, then the chance of an event is 1 out of 2, since 0.5/(1-0.5).

The chance that the event will not occur is calculated by the formula (1-P)/P

Inconsistent Probability- for example, in the price of shares of company A, 85% of the possible event E is taken into account, and in the price of shares of company B, only 50%. This is called the mismatched probability. According to the Dutch Betting Theorem, mismatched probability creates opportunities for profit.

Unconditional Probability is the answer to the question "What is the probability that the event will occur?"

Conditional Probability is the answer to the question: "What is the probability of event A if event B happened." The conditional probability is denoted as P(A|B).

Joint Probability is the probability that events A and B will happen at the same time. Designated as P(AB).

P(A|B) = P(AB)/P(B) (1)

P(AB) = P(A|B)*P(B)

Probability summation rule:

The probability that either event A or event B will happen is

P(A or B) = P(A) + P(B) - P(AB) (2)

If events A and B are mutually exclusive, then

P(A or B) = P(A) + P(B)

Independent events- events A and B are independent if

P(A|B) = P(A), P(B|A) = P(B)

That is, it is a sequence of outcomes where the probability value is constant from one event to the next.
A coin toss is an example of such an event - the result of each next toss does not depend on the result of the previous one.

Dependent events These are events in which the probability of one occurring depends on the probability of the other occurring.

Rule for multiplying the probabilities of independent events:
If events A and B are independent, then

P(AB) = P(A) * P(B) (3)

Total Probability Rule:

P(A) = P(AS) + P(AS") = P(A|S")P(S) + P(A|S")P(S") (4)

S and S" are mutually exclusive events

expected value random variable is the average of the possible outcomes of the random variable. For the event X, the expectation is denoted as E(X).

Suppose we have 5 values ​​​​of mutually exclusive events with a certain probability (for example, the company's income amounted to such and such an amount with such a probability). The expectation is the sum of all outcomes multiplied by their probability:

The variance of a random variable is the expected value of square deviations of a random variable from its expected value:

s 2 = E( 2 ) (6)

Conditional expected value - the expectation of a random variable X, provided that the event S has already occurred.

as an ontological category reflects the measure of the possibility of the emergence of any entity in any conditions. In contrast to the mathematical and logical interpretations of this concept, ontological V. does not associate itself with the necessity of a quantitative expression. The value of V. is revealed in the context of understanding determinism and the nature of development in general.

Great Definition

Incomplete definition ↓

PROBABILITY

a concept that characterizes quantities. a measure of the possibility of the appearance of a certain event at a certain. conditions. In scientific knowledge there are three interpretations of V. The classical concept of V., which arose from the mathematical. analysis of gambling and most fully developed by B. Pascal, J. Bernoulli and P. Laplace, considers V. as the ratio of the number of favorable cases to the total number of all equally possible. For example, when throwing a die that has 6 sides, each of them can be expected to come up with a V equal to 1/6, since neither side has advantages over the other. Such symmetry of the outcomes of experience is specially taken into account when organizing games, but is relatively rare in the study of objective events in science and practice. Classic V.'s interpretation gave way to statistical. V.'s concepts, at the heart of which are valid. observation of the appearance of a certain event during the duration. experience under precisely fixed conditions. Practice confirms that the more often an event occurs, the greater the degree of the objective possibility of its occurrence, or V. Therefore, the statistical. V.'s interpretation is based on the concept of relates. frequencies, a cut can be determined empirically. V. as theoretical. the concept never coincides with an empirically determined frequency, however, in many ways. cases, it practically differs little from the relative. frequency found as a result of the duration. observations. Many statisticians regard V. as a "double" refers. frequency, edge is determined by statistical. study of observational results

or experiments. Less realistic was the definition of V. as the limit relates. frequencies of mass events, or collectives, proposed by R. Mises. As a further development of the frequency approach to V., a dispositional, or propensity, interpretation of V. is put forward (K. Popper, J. Hecking, M. Bunge, T. Setl). According to this interpretation, V. characterizes the property of generating conditions, for example. experiment. installation, to obtain a sequence of massive random events. It is this attitude that gives rise to the physical dispositions, or predispositions, V. to-rykh can be checked by means of relative. frequencies.

Statistical V.'s interpretation dominates the scientific. knowledge, because it reflects the specific. the nature of the patterns inherent in mass phenomena of a random nature. In many physical, biological, economic, demographic and other social processes, it is necessary to take into account the action of many random factors, to-rye are characterized by a stable frequency. Identification of this stable frequency and quantities. its assessment with the help of V. makes it possible to reveal the necessity, which makes its way through the cumulative action of many accidents. This is where the dialectic of the transformation of chance into necessity finds its manifestation (see F. Engels, in the book: K. Marx and F. Engels, Soch., vol. 20, pp. 535-36).

Logical or inductive reasoning characterizes the relationship between the premises and the conclusion of non-demonstrative and, in particular, inductive reasoning. Unlike deduction, the premises of induction do not guarantee the truth of the conclusion, but only make it more or less plausible. This credibility, with precisely formulated premises, can sometimes be estimated with the help of V. The value of this V. is most often determined by comparing. concepts (greater than, less than or equal to), and sometimes in a numerical way. Logic interpretation is often used to analyze inductive reasoning and build various systems of probabilistic logics (R. Carnap, R. Jeffrey). In the semantic logical concepts. V. is often defined as the degree of confirmation of one statement by others (for example, the hypothesis of its empirical data).

In connection with the development of theories of decision-making and games, the so-called. personalistic interpretation of V. Although V. in this case expresses the degree of faith of the subject and the occurrence of a certain event, V. themselves must be chosen in such a way that the axioms of the calculation of V. are satisfied. Therefore, V., with such an interpretation, expresses not so much the degree of subjective as rational faith . Consequently, decisions made on the basis of such V. will be rational, because they do not take into account the psychological. characteristics and inclinations of the subject.

From epistemological t. sp. difference between statistic., logical. and personalistic interpretations of V. lies in the fact that if the first characterizes the objective properties and relations of mass phenomena of a random nature, then the last two analyze the features of the subjective, cognizant. human activities under conditions of uncertainty.

PROBABILITY

one of the most important concepts of science, characterizing a special systemic vision of the world, its structure, evolution and cognition. The specificity of the probabilistic view of the world is revealed through the inclusion of the concepts of chance, independence and hierarchy (ideas of levels in the structure and determination of systems) among the basic concepts of being.

Ideas about probability originated in antiquity and were related to the characteristics of our knowledge, while the presence of probabilistic knowledge was recognized, which differs from reliable knowledge and from false. The impact of the idea of ​​probability on scientific thinking, on the development of knowledge is directly related to the development of the theory of probability as a mathematical discipline. The origin of the mathematical doctrine of probability dates back to the 17th century, when the development of the core of concepts that allow. quantitative (numerical) characteristics and expressing a probabilistic idea.

Intensive applications of probability to the development of knowledge fall on the 2nd floor. 19- 1st floor. 20th century Probability has entered the structures of such fundamental sciences of nature as classical statistical physics, genetics, quantum theory, cybernetics (information theory). Accordingly, probability personifies that stage in the development of science, which is now defined as non-classical science. To reveal the novelty, features of the probabilistic way of thinking, it is necessary to proceed from the analysis of the subject of probability theory and the foundations of its many applications. Probability theory is usually defined as a mathematical discipline that studies the laws of mass random phenomena under certain conditions. Randomness means that within the framework of mass character, the existence of each elementary phenomenon does not depend on and is not determined by the existence of other phenomena. At the same time, the very mass nature of phenomena has a stable structure, contains certain regularities. A mass phenomenon is quite strictly divided into subsystems, and the relative number of elementary phenomena in each of the subsystems (relative frequency) is very stable. This stability is compared with probability. A mass phenomenon as a whole is characterized by a distribution of probabilities, i.e., the assignment of subsystems and their corresponding probabilities. The language of probability theory is the language of probability distributions. Accordingly, the theory of probability is defined as the abstract science of operating with distributions.

Probability gave rise in science to ideas about statistical regularities and statistical systems. The latter are systems formed from independent or quasi-independent entities, their structure is characterized by probability distributions. But how is it possible to form systems from independent entities? It is usually assumed that for the formation of systems with integral characteristics, it is necessary that between their elements there are sufficiently stable bonds that cement the systems. The stability of statistical systems is given by the presence of external conditions, the external environment, external rather than internal forces. The very definition of probability is always based on setting the conditions for the formation of the initial mass phenomenon. Another important idea that characterizes the probabilistic paradigm is the idea of ​​hierarchy (subordination). This idea expresses the relationship between the characteristics of individual elements and the integral characteristics of systems: the latter, as it were, are built on top of the former.

The significance of probabilistic methods in cognition lies in the fact that they allow us to explore and theoretically express the patterns of structure and behavior of objects and systems that have a hierarchical, "two-level" structure.

Analysis of the nature of probability is based on its frequency, statistical interpretation. At the same time, for a very long time, such an understanding of probability dominated in science, which was called logical, or inductive, probability. Logical probability is interested in questions of the validity of a separate, individual judgment under certain conditions. Is it possible to assess the degree of confirmation (reliability, truth) of an inductive conclusion (hypothetical conclusion) in a quantitative form? In the course of the formation of the theory of probability, such questions were repeatedly discussed, and they began to talk about the degrees of confirmation of hypothetical conclusions. This measure of probability is determined by the information at the disposal of a given person, his experience, views on the world and the psychological mindset. In all such cases, the magnitude of the probability is not amenable to strict measurements and practically lies outside the competence of probability theory as a consistent mathematical discipline.

An objective, frequency interpretation of probability was established in science with considerable difficulty. Initially, the understanding of the nature of probability was strongly influenced by those philosophical and methodological views that were characteristic of classical science. Historically, the formation of probabilistic methods in physics occurred under the decisive influence of the ideas of mechanics: statistical systems were treated simply as mechanical ones. Since the corresponding problems were not solved by strict methods of mechanics, statements arose that the appeal to probabilistic methods and statistical regularities is the result of the incompleteness of our knowledge. In the history of the development of classical statistical physics, numerous attempts have been made to substantiate it on the basis of classical mechanics, but they all failed. The basis of probability is that it expresses the features of the structure of a certain class of systems, other than the systems of mechanics: the state of the elements of these systems is characterized by instability and a special (not reducible to mechanics) nature of interactions.

The entry of probability into cognition leads to the denial of the concept of rigid determinism, to the denial of the basic model of being and cognition developed in the process of the formation of classical science. The basic models represented by statistical theories are of a different, more general nature: they include the ideas of randomness and independence. The idea of ​​probability is connected with the disclosure of the internal dynamics of objects and systems, which cannot be completely determined by external conditions and circumstances.

The concept of a probabilistic vision of the world, based on the absolutization of ideas about independence (as before, the paradigm of rigid determination), has now revealed its limitations, which most strongly affects the transition of modern science to analytical methods for studying complex systems and the physical and mathematical foundations of self-organization phenomena.

Great Definition

Incomplete definition ↓

Do you want to know what are the mathematical chances of your bet being successful? Then there are two good news for you. First: to calculate the patency, you do not need to carry out complex calculations and spend a lot of time. It is enough to use 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 as follows:

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 bet is of no value and should be refrained from.



Similar articles