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

Conditional probability with Bayes' Theorem

Conditional probability visualized using trees. Created by Brit Cruise.

Want to join the conversation?

  • mr pants teal style avatar for user Nick Corrado
    This is awesome! Your videos will really help confused students over at Udacity's stats class--this is one of the first things they learn. :) Thank you for this!
    (123 votes)
    Default Khan Academy avatar avatar for user
  • leafers sapling style avatar for user l1ghtbringer
    At , Brit says that the probability of Bob picking out the fair coin was 1/3. But since he picked 1 out of 2 coins, fair and unfair, at random, wouldn't the probability just be 1/2?
    (16 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user Veli
      Yes, picking one out of the two coins at random would result in a 1/2 probability of having picked the fair coin. However, the question was, what is the probability of having picked the fair coin, GIVEN THAT the coin came up heads. As the title "Conditional Probability" suggests, the probability of having picked the fair coin is dependant on the evidence we have (it came up heads)

      Consider the opposite scenario - the coin comes up tails when flipped. Before tossing it, you would be correct in saying there's a 1/2 chance you're holding the fair coin. But given the new evidence we have from the flip - it came up tails - you could be 100% certain of having the fair coin, since the double sided coin only has heads. The probability of the event (you picked the fair coin) is dependant on the evidence (the coin came up tails).
      (48 votes)
  • leafers ultimate style avatar for user Jucá Costa
    I just didn't understand the "rules" of the "game". He picks a random coin for each flip OR he picks a random coin only at the beginning, continuing with that one to the rest of the problem?
    (9 votes)
    Default Khan Academy avatar avatar for user
  • orange juice squid orange style avatar for user Ohad
    If f I have an unfair coin, with a possibility of 2/3 to land on T and 1/3 to land on H, and I flip it 3 times, what are the chances of me to result with 2 Tails and 1 Head?
    The order isn't important. Heads can be the first coin, the second or the third.
    (4 votes)
    Default Khan Academy avatar avatar for user
    • aqualine ultimate style avatar for user alleigh76
      Let's pretend it's fair, first.
      The long way, you can just list them. Three flips can be
      HHH
      HHT, HTH, THH
      HTT, THT, TTH
      TTT
      There are 8 possibilities, and there are 3 ways to make 2T 1H, so it's 3/8.

      To use math, you could do this: (p represents H, q represents T, and both are 1/2)
      p^3 + 3p^2q + 3pq^2 + q^3 (notice how this matches with the possibilities listed)
      This is the binomal expansion of (p+q)^3, 3 being the number of tosses you have. If you want a different number of tosses, you just change the exponent for (p+q)^n.

      This will always add to one, because that represents 100% of the possibilities. Each section represents the odds of a particular possibility. Since you want 2 tails and 1 head, you choose the one that includes pq^2.
      3(1/2)(1/2)^2 = .375, which is equal to 3/8, same as before

      Now that I've demonstrated that the equation works, you can substitute any probability in for p and q, as long as they add up to 1. You want p=1/3 and q=2/3, which gives us
      3pq^2 = 3(1/3)(2/3)^2 = .4444 or 4/9. So the chances of getting 2 tails and 1 heads in three flips is 4/9, or about 44%.
      (12 votes)
  • blobby green style avatar for user walkhammt
    This was not worded well. I should have said what is the probability that out of the 2 coins the fair coin was flipped. It said what is the probability he picked the fair coin
    (8 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Ben Fong
    At , he changes the amount of leaves for each of the three coins to six leaves each. Why is this necessary? I thought you can find the probability from the original probabilities (1/2 and 2/3, in this case)? Thanks
    (6 votes)
    Default Khan Academy avatar avatar for user
  • mr pants teal style avatar for user Pete
    How come we cut the "tails" branch? Why not leave it and use it to calculate the probability?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • leafers ultimate style avatar for user Jorge Alexander Medina
      Another guess (similar to Sky's):
      You can cut the "tails" branches because the outcome of the toss has already been decided, and you know in advance tails is not possible. This tells you that you should not consider "tails" in your list of possible outcomes when you're calculating the probability (probability being the ratio of all favorable outcomes to all possible outcomes). In 'regular' probability, you don't know any of the outcomes in advance, so all outcomes are need to be counted as possible when you calculate your ratio.
      (4 votes)
  • leafers seedling style avatar for user Rishikesh
    Why must the tree 'leaves' be always balanced?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • leaf blue style avatar for user jwinder47
      This is part of the tree method: rather than assigning specific probabilities to each leaf (or branch), we construct the tree so that all leaves under the same node all have the same probability. That's why, in the video at around , the third branch must have 3 leaves, since the two outcomes are not equally probable: since heads is 2 times more likely than tales, in this branch, it must have 2 times as many leaves as tales. But this means that this third branch has more leaves than the other two, which distorts the original (given) probability (namely: all three branches must be equally probable). Since branch three needs 3 leaves, we must modify our counts so that all three branches have the same number of leaves. So, strictly speaking, it's the branches that must be balanced. This balancing takes care of itself in simple problems, like the toss of two fair coins, because each branch will have the same number of leaves. But if only one of those two coins is not fair, then we will have to balance the branches so that we can use the final row of the tree to count the probability of the event we're interested in.
      (3 votes)
  • blobby green style avatar for user adityapuranik97
    P(biased|head) = P(head|biased)P(biased)/P(head) = (2/3)*(1/3)/(1/2) = 4/9. But the tree calculates it to be 4/10. Where did I go wrong ?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • male robot hal style avatar for user mreischer
    This video is identical to the previous one.
    (4 votes)
    Default Khan Academy avatar avatar for user

Video transcript