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

Constructing a probability distribution for random variable

Sal breaks down how to create the probability distribution of the number of "heads" after 3 flips of a fair coin. Created by Sal Khan.

Want to join the conversation?

  • spunky sam blue style avatar for user Swapnil
    At how can P(X=2) = 3/8. when there are also 2 H in HHH? Why the HHH is not considered for P(X=2)?
    (12 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user wkialeah
    How would you find the probablility when your have P(5)
    (7 votes)
    Default Khan Academy avatar avatar for user
    • hopper jumping style avatar for user Alexander Ung
      I agree, it is impossible to have 5 heads in a coin toss occurring only three times but if you were to have to flip a coin 5 times and finding out the number of times it is heads your answer would be:
      p=(X=1/32) because HHHHH is the only answer for 5 heads in a coin toss that occurs five times.
      In this situation, Master Salman is doing a coin toss only three times.
      So there is no probability distribution for 5 heads because that is impossible.
      Thank you!
      (6 votes)
  • winston baby style avatar for user Grayson Ballasteros
    Am I seeing potential pattern or connection between pascals triangle and the probability of flipping 1, 2 , or three heads 3 at ? Can that be used for anything in probability in the future? Or is this just a coincidence? It seems like it still works for the possibility of 4 coins (1 possibility of all tails, then 4 of 3 tails, six of 2 tails, 4 of 1 tail, 1 of no tails)
    (17 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Amby Nicole
    A man has three job interviews. The probability of getting the first interview is .3 the second .4 and third .5 suppose the man stops interviewing after he gets a job offer. Construct a probability distribution for X. I assumed due to the probabilities not adding exactly to one that it can't be done. Any help?
    (0 votes)
    Default Khan Academy avatar avatar for user
    • leaf blue style avatar for user Dr C
      It may help to draw a tree diagram:

              Interview 1
      |
      ------------------------
      | |
      Get it Not get it
      0.3 0.7
      |
      Interview 2
      |
      ---------------------
      | |
      Get it Not get it
      0.4 0.6
      |
      Interview 3
      |
      ---------------------
      | |
      Get it Not get it
      0.5 0.5


      There are four leaves on this tree. Assuming that the jobs are independent, then:

      Get job 1: probability = 0.3 = 0.3
      Get job 2: probability = 0.7 × 0.4 = 0.28
      Get job 3: probability = 0.7 × 0.6 × 0.5 = 0.21
      Get no job: probability = 0.7 × 0.6 × 0.5 = 0.21

      And these add up to 1.
      (24 votes)
  • blobby green style avatar for user Marielle Leigh Rubeor
    what aren't HHT and THH considered the same thing? is it the order that differentiates the two?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • piceratops tree style avatar for user D_Krest
      They are considered two different outcomes.
      Think of it as of flip of three coins of different value. Each is individual and shows tails or heads so you can tell which coin is tails or heads.
      There are 8 different outcomes: heads/tails*head/tails*head/tails.
      If HHT, THH and HTH are considered the same thing P(HTT and THH and HTH) = 1/8.
      Then P(HTT and TTH and THT) = 1/8. P(HHH)=1/8, P(TTT) = 1/8.
      Sum of this possibilities is 4/8. But we know, that the sum of all the possibilities of an event must equal 1. So you see there's flaw in this logic in terms of probability.
      (7 votes)
  • male robot hal style avatar for user Raivat Shah
    At Sal says 'You can have probability larger than 1", how is that possible?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Nathan Hoffmann
    Shouldn't the probability distribution be composed of thin vertical lines rather than bars? As it's drawn, it looks like a continuous variable rather than a discrete one. There should be a 0 probability of having any non-integer value.
    (5 votes)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user Muhammad Saqlain
    If for example we have a random variable that contains terms like pi or fraction with non recurring decimal values ,will that variable be counted as discrete or continous ? According my understanding eventhough pi has infinte long decimals , it still represents a single value or fraction 22/7 so if random variables has any of multiples of pi , then it should be discrete
    (3 votes)
    Default Khan Academy avatar avatar for user
    • leaf blue style avatar for user Dr C
      Correct. Discrete vs continuous only considers the number of possible outcomes (more or less), but not what those outcomes are. The values can be irrational, like pi, but if there are distinct multiples it takes, then it's discrete.
      (5 votes)
  • blobby green style avatar for user shubamsingh39
    how can we have probability greater than 1?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Yamanqui García Rosales
      We cannot. A probability equal to 1 means certainty, an event with probability equal to 1 is sure to happen, no questions asked, it's impossible to be more certain, and therefore it's impossible to have a probability greater than 1.

      If during a problem you end up with a probability greater than 1, then you have to go back because somewhere before that point you have an error in your calculations.
      (6 votes)
  • male robot hal style avatar for user Shaun Peterson
    My stats professor keeps insisting discrete variables always have to be integers or whole numbers. Is he wrong or is Sal?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • leaf grey style avatar for user masterYoda
      Your professor is right, a discrete variable can only take whole numbers, that's literally what a discrete variable is defined as.
      But Sal isn't wrong here, the values of X he graphed are whole numbers.

      You might be confusing them with the probabilities of X equaling 0,1,2, or 3
      (1 vote)

Video transcript

Voiceover:Let's say we define the random variable capital X as the number of heads we get after three flips of a fair coin. So given that definition of a random variable, what we're going to try and do in this video is think about the probability distributions. So what is the probability of the different possible outcomes or the different possible values for this random variable. We'll plot them to see how that distribution is spread out amongst those possible outcomes. So let's think about all of the different values that you could get when you flip a fair coin three times. So you could get all heads, heads, heads, heads. You could get heads, heads, tails. You could get heads, tails, heads. You could get heads, tails, tails. You could have tails, heads, heads. You could have tails, head, tails. You could have tails, tails, heads. And then you could have all tails. So there's eight equally, when you do the actual experiment there's eight equally likely outcomes here. But which of them, how would these relate to the value of this random variable? So let's think about, what's the probability, there is a situation where you have zero heads. So what's the probably that our random variable X is equal to zero? Well, that's this situation right over here where you have zero heads. It's one out of the eight equally likely outcomes. So that is going to be 1/8. What's the probability that our random variable capital X is equal to one? Well, let's see. Which of these outcomes gets us exactly one head? We have this one right over here. We have that one right over there. We have this one right over there. And I think that's all of them. So three out of the eight equally likely outcomes provide us, get us to one head, which is the same thing as saying that our random variable equals one. So this has a 3/8 probability. So what's the probability, I think you're getting, maybe getting the hang of it at this point. What's the probability that the random variable X is going to be equal to two? Well, for X to be equal to two, we must, that means we have two heads when we flip the coins three times. So that's this outcome meets this constraint. This outcome would get our random variable to be equal to two. And this outcome would make our random variable equal to two. And this is three out of the eight equally likely outcomes. So this has a 3/8 probability. And then finally we could say what is the probability that our random variable X is equal to three? Well, how does our random variable X equal three? Well we have to get three heads when we flip the coin. So there's only one out of the eight equally likely outcomes that meets that constraint. So it's a 1/8 probability. So now we just have to think about how we plot this, to see how this is distributed. So let me draw... So over here on the vertical axis this will be the probability. Probability. And it's going to be between zero and one. You can't have a probability larger than one. So just like this. So let's see, if this is one right over here, and let's see everything here looks like it's in eighths so let's put everything in terms of eighths. So that's half. This is a fourth. That's a fourth. That's not quite a fourth. This is a fourth right over here. And then we can do it in terms of eighths. So that's a pretty good approximation. And then over here we can have the outcomes. Outcomes. And so outcomes, I'll say outcomes for alright let's write this so value for X So X could be zero actually let me do those same colors, X could be zero. X could be one. X could be two. X could be equal to two. X could be equal to three. X could be equal to three. So these are the possible values for X. And now we're just going to plot the probability. The probability that X has a value of zero is 1/8. That's, I'll make a little bit of a bar right over here that goes up to 1/8. So let draw it like this. So goes up to, so this is 1/8 right over here. The probability that X equals one is 3/8. So 2/8, 3/8 gets us right over let me do that in the purple color So probability of one, that's 3/8. That's right over there. That's 3/8. So let me draw that bar, draw that bar. And just like that. The probability that X equals two. The probability that X equals two is also 3/8. So that's going to be on the same level. Just like that. And then, the probability that X equals three well that's 1/8. So it's going to the same height as this thing over here. I'm using the wrong color. So it's going to look like this. It's going to look like this. And actually let me just write this a little bit neater. I can write that three. Cut and paste. Move that three a little closer in so that it looks a little bit neater. And I can actually move that two in actually as well. So cut and paste. So I can move that two. And there you have it! We have made a probability distribution for the random variable X. And the random variable X can only take on these discrete values. It can't take on the value half or the value pi or anything like that. So this, what we've just done here is constructed a discrete probability distribution. Let me write that down. So this is a discrete, it only, the random variable only takes on discrete values. It can't take on any values in between these things. So discrete probability. Probability distribution. Distribution for our random variable X.