If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Discrete and continuous random variables

Discrete random variables can only take on a finite number of values. For example, the outcome of rolling a die is a discrete random variable, as it can only land on one of six possible numbers. Continuous random variables, on the other hand, can take on any value in a given interval. For example, the mass of an animal would be a continuous random variable, as it could theoretically be any non-negative number. Created by Sal Khan.

Want to join the conversation?

  • leaf green style avatar for user David Bernard Williams II
    Can there really be any value for time? Isn't there a smallest unit of time? And if there isn't shouldn't there be?

    If there is such a unit, then the variable cannot be continuous between one smallest unit and the next.
    (73 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Daekyun Yoon
    About the New Orleans Zoo example...

    I think when we say "discrete" it means "countable" or "enumerable". In zoo example, although the exact mass would vary from almost 0 to say 5000kg (if that 5T elephant is indeed the biggest animal found in the zoo), we can count every individual animal at any moment. In other words, then total number of animal is somehow fixed at one moment. Therefore, I might say your zoo example is also an example of "discrete random variable".

    How do you think?
    (33 votes)
    Default Khan Academy avatar avatar for user
    • leaf blue style avatar for user Matthew Daly
      What "discrete" really means is that a measure is separable. For instance, how many elephants does a zoo have? A zoo might have six elephants or seven elephants, but it can't have something between those two. Also, all zoos that have seven elephants definitely have the same number of elephants. Those two features make the number of elephants owned a discrete measure.

      By contrast, the weight of an elephant is a continuous measure. If we say that one elephant weighs 945kg and another weighs 946kg, there are any range of possible weights between those two things. In fact, it is impossible for an elephant to weigh 945kg; we really mean that it is close enough to 945kg for our satisfaction. Unlike the count of elephants, a herd of elephants each of whom weighs 945kg each actually weighs something different. These are the clues that weight is a continuous measure and not discrete. Clear?
      (43 votes)
  • mr pants teal style avatar for user Hollerdog
    Why is the word "random" in front of variable here. What's the difference between a discrete variable and a discrete random variable?
    (0 votes)
    Default Khan Academy avatar avatar for user
  • piceratops tree style avatar for user Kehlan
    so the distinction between discreet and continues random variables is determined by whether or not the possible outcomes are infinitely divisible into more possible outcomes?
    (13 votes)
    Default Khan Academy avatar avatar for user
  • orange juice squid orange style avatar for user nandroid
    I'm struggling to find a rigorous definition of discrete vs continuous. There are a lot of examples of discrete variables which produce integers as data but this doesn't seem to be the definition and I can think of many examples which do not adhere to this. For example:

    X = "The number of blonde people divided by the total number of people in the elevator in my office whenever the door opens on the 5th floor." This random variable could yield rational numbers like 7/9 that are not integers, but which seem to be discrete. Is this discrete?

    or X = "The length of a hypotenuse c, of a right angle triangle, where the lengths of sides a and b are determined by the roll of two 6 sided dice." Is this a discrete variable? I think it is but I'm not sure. There are only 36 possible lengths of hypotenuse c, but there can be irrational numbers like the square root of 2.

    Or what if we defined that last example more mathematically and didn't constrain the lengths of sides a and b to 36 combinations?

    Like, X = "the square root of a^2 + b^2, where a and b are any two random integers."
    Now there are an infinite number of possible outcomes. Is this variable discrete? I still think it is, but I'm not sure because the definition of discrete and continuous seems a bit vague.

    Tell me if you think this is an okay definition for a continuous variable : "A variable that can have an infinite number of possible values within ANY selected range." So in the zoo example that Sal gives at , if you look for any value, even within the range of 1 elephant, you can get an infinite number of possible values. And then discrete is anything that doesn't meet this strict definition of continuous. Does this sound right?
    (6 votes)
    Default Khan Academy avatar avatar for user
    • female robot ada style avatar for user Janet Leahy
      Good points. Your definition is very close, but to spare yourself a few technicalities (the range of 0 elephants, for example), I would use the definition:
      "A discrete variable is one that can take on finitely many, or countably infinitely many values", whereas a continuous random variable is one that is not discrete, i.e. "can take on uncountably infinitely many values", such as a spectrum of real numbers.
      Your Pythagorean X is a good example. Although there are infinitely many possible values, they are still countable (because the combinations of a and b are countable), so X is indeed discrete.
      (9 votes)
  • blobby green style avatar for user Prashant
    Would the winning time for a horse running in the Kentucky Derby (measured at 121 seconds or 121.25 seconds, for example) be classified as a discrete or continuous variable ?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • orange juice squid orange style avatar for user Troy Cook
      Based on the video, it depends on how time is recorded.

      For a digital clock with a precision of 1/10,000 of a second, the number of discrete outcomes between 0 and 1 second (exclusive) is 9,999 ( 1/10,000 ... 9,999/10,000 ). Digital clocks and mechanical clocks with ratchets (the ones that tick) all produce discrete positions and the random variable would be discrete.

      For a mechanical clock with a sweeping hand--no ratchet (doesn't tick)--the number of outcomes between 0 and 1 second would be infinite. Position the hand between 0 and 1. Now move the hand toward 0, then toward 1, now toward 0, and so on. You could put the hand in a new position each time and it would never repeat any previous position. The random variable is continuous.
      (10 votes)
  • male robot donald style avatar for user sharankrishnappan
    the exact time of the running time in the 2016 Olympics even in the hundredths is still continuous because it is still very hard to get to count a hundredth of a minute. If we do this couldn't we even count thousandths. That was my only problem but still great video and is helping me a lot for my slope test. Way better than my textbook, but still that was kind of confusing.
    (3 votes)
    Default Khan Academy avatar avatar for user
    • male robot johnny style avatar for user Thomas B
      I think the point being made is that the exact time it takes to do something is a continuous, while any sort of measurement and recording of the time, no matter how precise it may seem, is discrete since we have to cut off that precision at some point when measuring.
      (5 votes)
  • blobby green style avatar for user richard
    and conversely, sometimes a discrete variable is actually treated continuously, such as population growth, even though strictly you can't have divisions of people , (what is a 13.43 people?) THe reason why is because we can use the tools of calculus to analyze population growth, and also because the sample space is so large (in the millions or billions), that it is relatively continuous. of course if your population is tiny you might want to use a discrete variable.
    (4 votes)
    Default Khan Academy avatar avatar for user
  • piceratops seed style avatar for user 2000maria408380
    whats the diffrence between the graph of a set of discrete data and the graph set of continouse data ?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • starky sapling style avatar for user Naobotic24
      i think there is no graph (a line, or curve) for a set of discrete data. A graph presents a set of continuous data. Because a line, no matter how small it is, it must have the beginning point and the end point. The difference between 2 points is a collection of infinite points. Actually, a point itself is an infinite number. There is no point. There is nothing to be exact. so... we just make all the things up to define the world with less difficulties.
      That's my opinion, i am not sure whether it helps your answer completely solved.
      (1 vote)
  • blobby green style avatar for user 😊
    i really don't have any idea in differentiating discreet from continuous in terms of its statement. can you help me by citing the tips on how to recognize the two of them separately
    (1 vote)
    Default Khan Academy avatar avatar for user
    • piceratops seed style avatar for user akmelendez1
      When I'm trying to figure it out, I ask myself whether you can have "in between" values. Like Phantranduyanh said above, you can't have fractions of a number when you roll dice. There's just no such thing as rolling a 1.5 or a 3.7. But, there's an endless number of values between even just 60 and 61 kg. One thing that can be confusing is that we can't generally measure that endless number of values. But, just because the scale doesn't show the difference between 60.11111111111111kg and 60.111111111111111112 kg, the difference in exact value still exists.
      (5 votes)

Video transcript

We already know a little bit about random variables. What we're going to see in this video is that random variables come in two varieties. You have discrete random variables, and you have continuous random variables. And discrete random variables, these are essentially random variables that can take on distinct or separate values. And we'll give examples of that in a second. So that comes straight from the meaning of the word discrete in the English language-- distinct or separate values. While continuous-- and I guess just another definition for the word discrete in the English language would be polite, or not obnoxious, or kind of subtle. That is not what we're talking about. We are not talking about random variables that are polite. We're talking about ones that can take on distinct values. And continuous random variables, they can take on any value in a range. And that range could even be infinite. So any value in an interval. So with those two definitions out of the way, let's look at some actual random variable definitions. And I want to think together about whether you would classify them as discrete or continuous random variables. So let's say that I have a random variable capital X. And it is equal to-- well, this is one that we covered in the last video. It's 1 if my fair coin is heads. It's 0 if my fair coin is tails. So is this a discrete or a continuous random variable? Well, this random variable right over here can take on distinctive values. It can take on either a 1 or it could take on a 0. Another way to think about it is you can count the number of different values it can take on. This is the first value it can take on, this is the second value that it can take on. So this is clearly a discrete random variable. Let's think about another one. Let's define random variable Y as equal to the mass of a random animal selected at the New Orleans zoo, where I grew up, the Audubon Zoo. Y is the mass of a random animal selected at the New Orleans zoo. Is this a discrete random variable or a continuous random variable? Well, the exact mass-- and I should probably put that qualifier here. I'll even add it here just to make it really, really clear. The exact mass of a random animal, or a random object in our universe, it can take on any of a whole set of values. I mean, who knows exactly the exact number of electrons that are part of that object right at that moment? Who knows the neutrons, the protons, the exact number of molecules in that object, or a part of that animal exactly at that moment? So that mass, for example, at the zoo, it might take on a value anywhere between-- well, maybe close to 0. There's no animal that has 0 mass. But it could be close to zero, if we're thinking about an ant, or we're thinking about a dust mite, or maybe if you consider even a bacterium an animal. I believe bacterium is the singular of bacteria. And it could go all the way. Maybe the most massive animal in the zoo is the elephant of some kind. And I don't know what it would be in kilograms, but it would be fairly large. So maybe you can get up all the way to 3,000 kilograms, or probably larger. Let's say 5,000 kilograms. I don't know what the mass of a very heavy elephant-- or a very massive elephant, I should say-- actually is. It may be something fun for you to look at. But any animal could have a mass anywhere in between here. It does not take on discrete values. You could have an animal that is exactly maybe 123.75921 kilograms. And even there, that actually might not be the exact mass. You might have to get even more precise, --10732. 0, 7, And I think you get the picture. Even though this is the way I've defined it now, a finite interval, you can take on any value in between here. They are not discrete values. So this one is clearly a continuous random variable. Let's think about another one. Let's think about-- let's say that random variable Y, instead of it being this, let's say it's the year that a random student in the class was born. Is this a discrete or a continuous random variable? Well, that year, you literally can define it as a specific discrete year. It could be 1992, or it could be 1985, or it could be 2001. There are discrete values that this random variable can actually take on. It won't be able to take on any value between, say, 2000 and 2001. It'll either be 2000 or it'll be 2001 or 2002. Once again, you can count the values it can take on. Most of the times that you're dealing with, as in the case right here, a discrete random variable-- let me make it clear this one over here is also a discrete random variable. Most of the time that you're dealing with a discrete random variable, you're probably going to be dealing with a finite number of values. But it does not have to be a finite number of values. You can actually have an infinite potential number of values that it could take on-- as long as the values are countable. As long as you can literally say, OK, this is the first value it could take on, the second, the third. And you might be counting forever, but as long as you can literally list-- and it could be even an infinite list. But if you can list the values that it could take on, then you're dealing with a discrete random variable. Notice in this scenario with the zoo, you could not list all of the possible masses. You could not even count them. You might attempt to-- and it's a fun exercise to try at least once, to try to list all of the values this might take on. You might say, OK, maybe it could take on 0.01 and maybe 0.02. But wait, you just skipped an infinite number of values that it could take on, because it could have taken on 0.011, 0.012. And even between those, there's an infinite number of values it could take on. There's no way for you to count the number of values that a continuous random variable can take on. There's no way for you to list them. With a discrete random variable, you can count the values. You can list the values. Let's do another example. Let's let random variable Z, capital Z, be the number ants born tomorrow in the universe. Now, you're probably arguing that there aren't ants on other planets. Or maybe there are ant-like creatures, but they're not going to be ants as we define them. But how do we know? So number of ants born in the universe. Maybe some ants have figured out interstellar travel of some kind. So the number of ants born tomorrow in the universe. That's my random variable Z. Is this a discrete random variable or a continuous random variable? Well, once again, we can count the number of values this could take on. This could be 1. It could be 2. It could be 3. It could be 4. It could be 5 quadrillion ants. It could be 5 quadrillion and 1. We can actually count the values. Those values are discrete. So once again, this right over here is a discrete random variable. This is fun, so let's keep doing more of these. Let's say that I have random variable X. So we're not using this definition anymore. Now I'm going to define random variable X to be the winning time-- now let me write it this way. The exact winning time for the men's 100-meter dash at the 2016 Olympics. So the exact time that it took for the winner-- who's probably going to be Usain Bolt, but it might not be. Actually, he's aging a little bit. But whatever the exact winning time for the men's 100-meter in the 2016 Olympics. And not the one that you necessarily see on the clock. The exact, the precise time that you would see at the men's 100-meter dash. Is this a discrete or a continuous random variable? Well, the way I've defined, and this one's a little bit tricky. Because you might say it's countable. You might say, well, it could either be 956, 9.56 seconds, or 9.57 seconds, or 9.58 seconds. And you might be tempted to believe that, because when you watch the 100-meter dash at the Olympics, they measure it to the nearest hundredths. They round to the nearest hundredth. That's how precise their timing is. But I'm talking about the exact winning time, the exact number of seconds it takes for that person to, from the starting gun, to cross the finish line. And there, it can take on any value. It can take on any value between-- well, I guess they're limited by the speed of light. But it could take on any value you could imagine. It might be anywhere between 5 seconds and maybe 12 seconds. And it could be anywhere in between there. It might not be 9.57. That might be what the clock says, but in reality the exact winning time could be 9.571, or it could be 9.572359. I think you see what I'm saying. The exact precise time could be any value in an interval. So this right over here is a continuous random variable. Now what would be the case, instead of saying the exact winning time, if instead I defined X to be the winning time of the men's 100 meter dash at the 2016 Olympics rounded to the nearest hundredth? Is this a discrete or a continuous random variable? So let me delete this. I've changed the random variable now. Is this going to be a discrete or a continuous random variable? Well now, we can actually count the actual values that this random variable can take on. It might be 9.56. It could be 9.57. It could be 9.58. We can actually list them. So in this case, when we round it to the nearest hundredth, we can actually list of values. We are now dealing with a discrete random variable. Anyway, I'll let you go there. Hopefully this gives you a sense of the distinction between discrete and continuous random variables.