Practical lesson. Discrete random variables
Practical lesson: Discrete random variables
You should remember that discrete random variables take a discrete set of values, i.e. a finite value or count. In this case, a discrete random variable is given by a series of distributions, i.e. we have a certain set of values, and the distribution law is given simply by assigning these values to the probabilities р1, р2, …, рn. If we write all these probabilities in the table of the values and probabilities, we will get a series of distributions. You know that the sum of all probabilities must be equal to 1 since the events of the ξ =xi form a complete group of events.
Let’s start solving problems. Let’s take the following example. Let the shooter have three bullets, and he shoots the target till the first hit, and if the shooter hits the target, he will stop shooting. Your task is to find the number of target misses, i.e. to build a series of distributions. There can be 0 misses if he hits the target at the first try to 3 misses if he fails all his attempts. Let’s draw a table (see the video). When are there 0 misses? When the shooter hits the target at the first attempt. The probability of a hit is 0.6. So, here the probability is 0.6. When will there be 1 miss? The first time, the shooter misses, and the second time, he hits. In this case, the probability of a miss is 0.4. The probability that he will hit the target at the second try is 0.6. In total, it’s 0.4*0.6=0.24.
It is better to make calculations separately and write the final value in the table. When will there be 2 misses? He must miss the first time, the second time, and he must hit the target at the third attempt only. We get 0.42*0.6=0.96. And if the shooter misses all three times, it will be 0.43= 0.064. Let’s check that we’ve made right calculations to exclude a mistake. We remember that the sum of all probabilities must be equal to 1. So, 0.6+0.24+0.096+0.064=1. This means that the probability that we’ve calculated correctly is high, that is, do not forget to check yourselves when solving problems. Very often, this check allows you to find quite a lot of errors.
Let’s look at another example. Let a discrete random variable be given by a series of distributions. It is shown on the slide. We need to find the probability that it fell within the interval from 1 to 2.5. What values fall within this interval? -1 does not fall within it, it is less than one, 1 falls, but 5 does not fall within it. Therefore, the probability that the random variable fell within this interval is equal to the probability that the random variable took the value 1. And this probability is 0.3.
Furthermore, we need to find is the expected value of a random variable. You remember that this is a weighted average. In our case, it will be -1*0.2+1*0.3+5*0.5=-0.2+0.3+2.5=2.6. This is an expected value.
We find the variance. The variance of a random variable ξ is the square of the centered random variable. At the lecture, we used a more convenient formula. Let’s try to find it by definition. If you want to do it using the second way, see the lecture. So, we will construct the following random variable (see the video). The value ξ takes the following values: -3.6 with a probability of 0.2. -1.6 with a probability of 0.3. 2.4 with a probability of 0.5. The following distribution series was obtained (see the video). We need a square (ξ -Мξ)2. Let’s count (see the video). 12.96 with a probability of 0.3. 2.56 with a probability of 0.3. 5.76 with a probability of 0.5. We obtained this distribution series for the square of a centered random variable. The variance is as follows: 12.96*0.2+2.56*0.3+5.76*0.5=2.592+0.768+2.88=6.24. Of course, you can use a calculator to count it.
Note that if we calculated the variance using the formula (see the video), there would be fewer calculations, i.e. the calculations would be simpler. Therefore, the last formula is usually used for manual calculations. Check that you get the same with this formula. And on a computer, most often we count by definition.
Let’s consider the following example. Let the probability of solving the problem for the first student be 0.2, for the second one – 0.5, and for the third one – 0.7. One task was given to these three students. The students are not talking to each other. We will assume that they are sitting in different rooms. The task is to find the average number of students who solved this problem. This number may not be an integer.
Let’s make a series of distributions, where ξ is the number of people who solved the problem. No one solved the problem: 0.12. The three of them solved it: 0.07. One student solved the problem: 0.2*0.5+0.3+0.8*0.5+0.8*0.5=0.43. You are supposed to calculate the probability that the two students solved the problem on your own. And I’ll calculate it like this: 1 minus everything we have. It is 0.38. We get a series of distributions.
And we need to find the average number of the students who solved the problem. So we need to find the expected value: 0*0.12+1*0.43+2*0.38+3*0.07=0.43+0.76+0.21=1.4.
Let’s look at an interesting consistent pattern. What is 1.4? If we take 0.2; 0.5 and 0.7, we add them together and also get 1.4. This is not accidental since we can consider the random variable Мξ1=0.2 instead of the random variable ξ1. ξ2 is the number of problems solved by the second student, its expected value is 0.5. And for the third student – 0.7. So, our random variable ξ is nothing more than the sum of three random variables ξ1+ξ2+ξ3, which means that its expected value is equal to the sum of the expected values of these random variables.
And let’s take the last example. We know that a random variable can take two values x1 and x2, but note that x1 and x2 are unknown to us. Let’s write it down: x1 with a probability of 0.3, x2 with a probability of 0.7. At the same time, we know that the expected value is 2.7. x1*0.3+ x2*0.7=2.7 and the variance is 0.21. Let’s use the formula x12*0.3 + x22*0.7-2.72 =0.21. You need to find x1 and x2. To do this, it is enough to solve this system (see the video), where one equation is linear, and the second one is square. It’s quite easy to solve this system: express x and substitute it in the second equation. You get a square equation that has two roots. But we can only use one. That is, in one case x1<x2, and in the other case x1>x2. Check that the solution for this system is as follows: x1=2, x2 =3.
You can start solving the problems given in the piece of paper. Some of the practical tasks will be devoted to solving problems, and some tasks will be devoted to computing in Excel. There will be a video.