0 energy points

# Random variables

Basic idea and definitions of random variables. Created by Sal Khan.
Video transcript
What I want to discuss a little bit in this video is the idea of a random variable. And random variables at first can be a little bit confusing because we will want to think of them as traditional variables that you were first exposed to in algebra class. And that's not quite what random variables are. Random variables are really ways to map outcomes of random processes to numbers. So if you have a random process, like you're flipping a coin or you're rolling dice or you are measuring the rain that might fall tomorrow, so random process, you're really just mapping outcomes of that to numbers. You are quantifying the outcomes. So what's an example of a random variable? Well, let's define one right over here. So I'm going to define random variable capital X. And they tend to be denoted by capital letters. So random variable capital X, I will define it as-- It is going to be equal to 1 if my fair die rolls heads-- let me write it this way-- if heads. And it's going to be equal to 0 if tails. I could have defined this any way I wanted to. This is actually a fairly typical way of defining a random variable, especially for a coin flip. But I could have defined this as 100. And I could have defined this as 703. And this would still be a legitimate random variable. It might not be as pure a way of thinking about it as defining 1 as heads and 0 as tails. But that would have been a random variable. Notice we have taken this random process, flipping a coin, and we've mapped the outcomes of that random process. And we've quantified them. 1 if heads, 0 if tails. We can define another random variable capital Y as equal to, let's say, the sum of rolls of let's say 7 dice. And when we talk about the sum, we're talking about the sum of the 7-- let me write this-- the sum of the upward face after rolling 7 dice. Once again, we are quantifying an outcome for a random process where the random process is rolling these 7 dice and seeing what sides show up on top. And then we are taking those and we're taking the sum and we are defining a random variable in that way. So the natural question you might ask is, why are we doing this? What's so useful about defining random variables like this? It will become more apparent as we get a little bit deeper in probability. But the simple way of thinking about it is as soon as you quantify outcomes, you can start to do a little bit more math on the outcomes. And you can start to use a little bit more mathematical notation on the outcome. So for example, if you cared about the probability that the sum of the upward faces after rolling seven dice-- if you cared about the probability that that sum is less than or equal to 30, the old way that you would have to have written it is the probability that the sum of-- and you would have to write all of what I just wrote here-- is less than or equal to 30. You would have had to write that big thing. And then you would try to figure it out somehow if you had some information. But now we can just write the probability that capital Y is less than or equal to 30. It's a little bit cleaner notation. And if someone else cares about the probability that this sum of the upward face after rolling seven dice-- if they say, hey, what's the probability that that's even, instead of having to write all that over, they can say, well, what's the probability that Y is even? Now the one thing that I do want to emphasize is how these are different than traditional variables, traditional variables that you see in your algebra class like x plus 5 is equal to 6, usually denoted by lowercase variables. y is equal to x plus 7. These variables, you can essentially assign values. You either can solve for them-- so in this case, x is an unknown. You could subtract 5 from both sides and solve for x. Say that x is going to be equal to 1. In this case, you could say, well, x is going to vary. We can assign a value to x and see how y varies as a function of x. You can either assign a variable, you can assign values to them. Or you can solve for them. You could say, hey x is going to be 1 in this case. That's not going to be the case with a random variable. A random variable can take on many, many, many, many, many, many different values with different probabilities. And it makes much more sense to talk about the probability of a random variable equaling a value, or the probability that it is less than or greater than something, or the probability that it has some property. And you see that in either of these cases. In the next video, we'll continue this discussion and we'll talk a little bit about the types of random variables you can have.