 This is a video about finding the mean and variance of a continuous random variable. Now the mean is the same as the expected value of the random variable. And you may remember that for a discrete random variable, that's equal to the sum of the probabilities times the possible values of the random variable. Now for a continuous random variable, we replace the sum with an integral sign, and we replace the probabilities with the probability density function. So the mean of a continuous random variable is the integral of x f of x, overall possible values of x. The variance of a random variable, which can be written sigma squared or var x, you may remember, is equal to the expected value of x squared take away the square of the mean. And for a discrete random variable, that's equal to the sum of the probabilities times the squares of the possible values of x, take away the mean squared. And again, for a continuous random variable, we replace the sum with an integral sign, and we replace the probabilities with the probability density function. So the variance of a continuous random variable is the integral of x squared f of x, evaluated overall possible values of x, minus the square of the mean. And these are the two things that you need to know to find the mean and the variance of a continuous random variable. You need to know that the mean is the integral of x f of x, overall possible values of x, and the variance is the integral of x squared f of x, overall possible values of x, take away the square of the mean. Okay, now let's look at some examples. First of all, suppose that we've got a random variable with the probability density function given by f of x is 3 tenths of 3x minus x squared between 0 and 2, and 0 otherwise. Let's find the mean and the variance of x. Well, to find the mean, we have to integrate x f of x, overall possible values of x. And that's going to be the integral between 0 and 2 of x times 3 tenths of 3x minus x squared. We integrate between 0 and 2 because f of x is 0 everywhere else. We can integrate this by multiplying out the brackets. That gives us the integral of 9 tenths of x squared minus 3 tenths of x cubed, evaluated between 0 and 2, which is 3 tenths of x cubed minus 3 fourths of x to the power 4, evaluated between 0 and 2, which is 3 tenths of 2 cubed minus 3 fourths of 2 to the power 4, take away nothing, which is 1 and 1 fifth. So that's the mean of this random variable. Secondly, in order to find the variance of the random variable, we have to calculate the expected value of x squared, which is the integral of x squared f of x, evaluated overall possible values of x. And in order to do that, we integrate x squared times 3 tenths of 3x minus x squared between 0 and 2. That's the integral between 0 and 2 of 9 tenths of x cubed minus 3 tenths of x to the power 4, which is 9 fourths of x to the power 4, take away 3 fifths of x to the power 5, evaluated between 0 and 2. In other words, 9 fourths times 2 to the power 4 minus 3 fifths times 2 to the power 5, which is 42 over 25. OK, well that's the value of the expected value of x squared. But remember that in order to find the variance, we have to take the expected value of x squared and subtract the square of the mean. So the variance is going to be 42 over 25, take away the square of 6 fifths. Remember that the mean was 6 fifths. So the answer here is that the variance is 6 over 25. OK, now let's look at another example. Let's look at the random variable, whose probability density function is given by f of x is a quarter of x, when x is between 0 and 2, a quarter of 4 minus x, when x is between 2 and 4, and 0 otherwise. This is the mean and the standard deviation of x. Now we could work out the mean using integration, but if you think about what the graph looks like, there's a simpler way of doing it this time. Here's the graph of the probability density function, and the first thing you'll notice is that it's symmetrical. Because it's symmetrical, we can see straight away that the mean must be 2. OK, so the mean for this random variable is 2. Now let's work out the variance. In order to find the variance, we have to find the expected value of x squared, and that would be the integral of x squared f of x, overall possible values of x. Now to work that out, we'll have to integrate x squared times a quarter of x between 0 and 2, and then add the integral of x squared times a quarter of 4 minus x, between 2 and 4. This is because f of x is a piecewise defined function with one definition for when x is between 0 and 2, and a separate definition for when x is between 2 and 4. OK, so we have to evaluate these two integrals and add them up. Let's tackle the first one. Let's work out the integral of x squared times a quarter of x between 0 and 2. That's the same as the integral of a quarter of x cubed between 0 and 2, which is going to be a sixteenth of x to the power of 4 evaluated between 0 and 2, which is the sixteenth times 2 to the power of 4 take away 0, which turns out to be 1. The other integral that we need to do is the integral of x squared times a quarter of 4 minus x evaluated between 2 and 4, and that's the integral of x squared minus a quarter of x cubed evaluated between 2 and 4, which is a third of x cubed minus the sixteenth of x to the power of 4 between 2 and 4, which if you work it out turns out to be 11 thirds. So now we know the value of each of these integrals. We know that the first one is 1, and the second one is 11 thirds. So we can say that the expected value of x squared is equal to 1 plus 11 thirds, which is 14 thirds. But remember it's terribly important that the variance is equal to the expected value of x squared take away the square of the mean. So that's going to be 14 thirds take away 2 squared, because 2 is the mean, and that's equal to 2 thirds. Now this is the variance and the question asked us for the standard deviation. We find the standard deviation by square-routing the variance and so it's equal to the square root of 2 thirds, which is 0.816 to 3 significant figures. Okay, let's look at one more example. This is about the same random variable as before with the same probability density function, but this time I'm asking you to calculate the probability that x is less than the mean take away the standard deviation. Remember that the mean was 2 and the standard deviation was the square root of 2 thirds, so the mean take away the standard deviation will be to take away the square root of 2 thirds, which is about 1.1835034. So the question is asking us to find the probability that x is less than 2 take away the square root of 2 thirds, which is approximately the probability that x is less than 1.1835034. Now there are different ways to work out this probability. One way would be to integrate the function between 0 and 1.1835034. But if you remember that the graph of the probability density function is linear, it's made up out of straight lines, it's probably easier to work out the area of some basic geometric shapes. We have to work out the area of this triangle, and as the area of a triangle is half base times height, the area is going to be a half times 1.1835034, because that's the base, times a quarter times 1.1835034, because that's the height. Better and more accurately, we can say that the area is a half times 2 minus the square root of 2 thirds, which is the base, times a quarter times 2 minus the square root of 2 thirds, which is the height. In other words, the area is an eighth of the square of 2 take away the square root of 2 thirds, which is 0.175 to 3 significant figures. One last question on the same example. This time, let's calculate the probability that the absolute value of x take away the mean is less than the standard deviation. And I want to look at this example because questions of this sort come up quite frequently in A-level exams. Now remember that the mean is 2 and the standard deviation is the square root of 2 thirds. So what the question is asking you is to find the probability that the absolute value of x minus 2 is less than the square root of 2 thirds. Before we go any further though, I'd like to look at what it means to take the absolute value of A minus B, the modulus of A minus B. And I want to think of it in terms of a number line. There are two cases. One possibility is that A is more than B. For example, A could be 8 and B could be 5. In that case, the modulus of A minus B will be the modulus of 8 take away 5, which is the modulus of 3, which is 3. The other possibility is that B is greater than A. For example, B could be 8 and A could be 5. In that case, the absolute value of A minus B is the absolute value of 5 minus 8, which is the absolute value of minus 3, and that's still equal to 3. And hopefully what you've noticed is that in both cases, the modulus of A minus B, or the absolute value of A minus B, is the distance between A and B on the number line. So now let's look at the probability that we're supposed to work out again. We're supposed to work out the probability that the absolute value of x minus 2 is less than the square root of 2 thirds. Now what this inequality is saying is that the distance between x and 2 is less than the square root of 2 thirds. x is no further away from 2 than the square root of 2 thirds. Or in other words, it's greater than 2 minus the square root of 2 thirds, and it's less than 2 plus the square root of 2 thirds. So the probability that we're looking for is the probability that x is greater than 2 less a little bit and less than 2 plus a little bit. It's probably easier to imagine this as an area on the graph. So we're trying to find this area, the region where x is greater than 2 take away the square root of 2 thirds and x is less than 2 plus the square root of 2 thirds. Now there are various ways to work out this area. Perhaps the simplest, however, is to realize that there's a connection between the red area and the yellow area here. The red area is going to be one take away the yellow area because the total area of the triangle must be one. The total area under a probability density function has to be one. So that means that the red area is about one take away, twice the probability that x is less than 1.1835034. Remember that the area of one yellow triangle is the probability that x is less than 1.1835034. But there are two yellow triangles which have the same area. Using the answer that we got earlier, we can say that this is about one take away two times 0.17508504. OK, well these calculations will give us the approximate answers, but we can probably do a little bit better by thinking in terms of thirds. We can say that the red area will be one take away two times the probability that x is less than two minus the square root of two-thirds. And again, using the answer that we got earlier, that's going to be one take away two times an eighth of the square of two minus the square root of two-thirds, which is one take away a quarter of the square of two minus the square root of two-thirds, which is 0.65023 significant figures. OK, this is the end of my video about finding the mean and the variance of a continuous random variable. The main things that you need to remember are that the mean is given by the integral of x f of x over all possible values of x. And the variance is given by the integral of x squared f of x, evaluated over all possible values of x, take away the square of the mean. OK, I hope that you found this video useful. Thank you very much for watching.