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 explained visually

Want to join the conversation?

  • spunky sam blue style avatar for user Nasrullah Sami
    Why do we need to balance our probability tree?
    (16 votes)
    Default Khan Academy avatar avatar for user
    • duskpin sapling style avatar for user Abbie Panda
      It is because when we do "balancing" it is making it so when you convert it to fractions they have a common denominator for example, if there are two possible outcomes and one happens 1/4 of the time and one happens 1/2 of the time and I "balance" the branches by making them both have 4 different outcomes I'm actually making 1/2 into 2/4 which makes it easier to calculate, I hope that makes sense! :D
      (13 votes)
  • blobby green style avatar for user emcgurty2
    I see no flaw.

    I think that this video should have gone a step further in the building of the leaves. Essential to understand that the leaves do not become "probabilities", rather counts of events.

    In initially building a tree diagram, we use information given, the scenario and factors that may influence probabilities. In the case of the first scenario we are asked: P(Fair| Heads):
    Fair coin, P(Tails) = 1/2, P(Heads) = 1/2,
    Biased coin: P(T) = 0, P(Heads) = 1 = 1/1.
    The LCM of these probability ratios is 2. So re-write:

    Fair coin, P(Tails) = 1/2, P(Heads) = 1/2,
    Biased coin: P(T) = 0, P(Heads) = 2/2.
    The numerator becomes our count of leaves. So P(Fair|Heads) = Count of Fair Heads/Count of Heads = 1/(1 +2) = 1/3.

    Weighed Bias Scenario:
    Two Fair, One Coins Biased.
    Fair1 coin, P(Tails) = 1/2, P(Heads) = 1/2,
    Fair2 coin, P(Tails) = 1/2, P(Heads) = 1/2,
    Biased coin, P(Tails) = 1/3, P(Heads) = 2/3 - Sum of bias probabilies = 1

    LCM of 2 and 3 is six. So re-write:

    Fair1 coin, P(Tails) = 3/6, P(Heads) = 3/6,
    Fair2 coin, P(Tails) = 3/6, P(Heads) = 3/6,
    Biased coin, P(Tails) = 2/6, P(Heads) = 4/6

    Numerator is your count of leaves:

    P(Biased | Heads) = Count of Biased Head/Counts of all heads: 4/(3 + 3+ 4) = 4/10. (Again we disregarded Tails branches and leaves)

    This principle can be applied to all sorts of scenarios:
    Three coins, all biased
    Coin1: P(tails) = 1/6, P(H) = 5/6
    Coin2: P(tails) = 2/5, P(H) = 3/5
    Coin3: P(tails) = 2/3, P(H) = 1/3

    What's the LCM of 6, 5, 3? 30. It's the smallest number that is divible by 3,5,6.

    Now re-write your fractions. Get your counts... Try P(Coin3 | Tails)? Share your result.
    (17 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user ptyogrady
    This video was very helpful. Is there another video that works through the same problems using Bayes theorem?
    (14 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user kevconstserv
      Can you reverse the question as an answer computing my answer first to compute the question would be the outcomes be similiar or the same?
      Or how far off are these numbers in the question to answer =answer to question
      Saying the coin flip is heads or tails would the answer agree..
      (2 votes)
  • leaf green style avatar for user rlama1990
    Instead of doing what is done at (making more branches by taking lcm)

    I simply go ahead and,

    Add all favorable outcomes as 2/3 H+ H+H= 8/3 H

    Then I find biased outcomes, which is 2/3 H

    Then I divide biased outcome by total favorable outcomes.

    Which is,

    2/3 divided by 8/3

    then I get the probability as 1/4 or 25%

    Can someone please tell me what is flawed with this process of solving the question?

    Thanks!
    (6 votes)
    Default Khan Academy avatar avatar for user
    • piceratops tree style avatar for user Kyle Young
      If you think about what he's doing at he's adjusting by LCM to keep the proportions easy to divide up later, once you cut the branches related to tails.

      You don't have to do this, but you've slipped up in the calculation- you're right it's 2/3 on top, but once you cut the tails (.5, .5 and 1/3) you're left with 5/3- if you divide 2/3 by 5/3 you get the same answer as the method in the video. However, it's clearly easier to make a mistake doing it this way!
      (6 votes)
  • blobby green style avatar for user followyourheartiwilldomore
    At seconds, why the biased coin leads to three equally likely possibility?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Chenali
    I think the video has potential, but I just can't get the same answer using the formula. It is imperative to explain how the formula is relevant here otherwise the video is more confusing than helpful. which is a shame as most of the videos are really good. Can somebody please post the answer with the formula?
    (4 votes)
    Default Khan Academy avatar avatar for user
  • stelly orange style avatar for user armyscientist
    In this example , I'm thinking this way-
    P(biased|head) = #biased coins with head/#total heads = 2/4=0.5.
    Please guide me why is this wrong?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Cameron
      Because each of the outcomes in the unbiased branches are worth 1/2 each while the outcomes in the biased branch are worth 1/3 each. (This is why the video talks about "balancing" them out, which makes all the outcomes worth 1/6 each.)

      It might become more obvious what is happening if you try to add the probabilities of all the outcomes up (which should total to 1 or 100%).
      1/3 (fair) * (1/2 (H) + 1/2 (T)) +
      1/3 (fair) * (1/2 (H) + 1/2 (T)) +
      1/3 (biased) * (1/3 (H) + 1/3 (H) + 1/3 (T)) = 1

      So the chances of getting heads is:
      P(H) =
      1/3 (fair) * (1/2 (H)) +
      1/3 (fair) * (1/2 (H)) +
      1/3 (biased) * (1/3 (H) + 1/3 (H))
      = 1/6 + 1/6 + 2 /9
      = 3/18 + 3/18 + 4/18
      = 10/18

      The chances of getting the biased coin and heads is:
      P(H&B) =1/3 (biased) * (1/3 (H) + 1/3 (H))
      = 2 /9
      = 4/18

      So, the probability that we got the biased coin given that we got heads is:
      P(B|H) = P(H&B) / P(H)
      P(B|H) = (4/18) / (10/18 ) = 4/10

      Hope this makes sense
      (2 votes)
  • blobby green style avatar for user Ahmed Nasret
    What is the relation with (conditional_probability) it is all about dependency . Getting HH the_second_event dependent on whatever you picked the_first_event and it is also related to the idea of equally_likely_or_not_equally_likely_outcomes , what is the point of conditional_probability here?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user vedprofess
    Instead of doing what is done at (making more branches by taking lcm)

    I simply go ahead and

    all favorable outcome is 2H of biased coins
    total number of outcomes is 4H

    then by this way
    P(B|H) = 2/4 =50%

    Can someone explain why is that.
    (3 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Fardeen Ashraf
    If the two coins in Scenario 1 have an equal chance of getting picked, shouldn't the probability that the fair coin was picked be 1/2? Why would the fact that a heads came up subsequently change the probability of a fair coin being picked/Isn't the act of picking a coin in the first step independent of whether a heads or tails showed up in the second step?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • primosaur seed style avatar for user Ian Pulizzotto
      These events are dependent. If the fair coin is not picked (that is, the two-headed coin is picked), the probability of heads is 1, but if the fair coin is picked, the probability of heads is only 1/2. So knowing whether or not the fair coin was picked affects the probability of heads; heads is less likely to come up on the fair coin than on the two-headed coin. This also implies that getting heads would reduce the probability of having picked the fair coin; think of getting heads as evidence in favor of the selected coin being the two-headed coin instead of the fair coin.
      (2 votes)

Video transcript

- [Instructor] Consider the following story. Bob is in a room and he has two coins. One fair coin and one double sided coin. He picks one at random, flips it, and shouts the result. - [Bob] Heads. - [Instructor] Now what is the probability that he flipped the fair coin? To answer this question, we need only rewind and grow a tree. The first event, he picks one of two coins, so our tree grows two branches, leading to equally likely outcomes, fair or unfair. The next event, he flips the coin. We grow again, if he had the fair coin, we know this flip can result in two equally likely outcomes, heads and tails, while the unfair coin results in two outcomes, both heads. Our tree is finished, and we see it has four leaves, representing four equally likely outcomes. The final step, new evidence, he says. - [Bob] Heads. - [Instructor] Whenever we gain evidence, we must trim our tree. We cut any branch leading to tails because we know tails did not occur, and that is it, so the probability that he chose the fair coin is the one fair outcome leading to heads divided by the three possible outcomes leading to heads, or one third. What happens if he flips again and reports? - [Bob] Heads. - [Instructor] Remember, after each event, our tree grows. The fair coin leaves result in two equally likely outcomes, heads and tails, the unfair coin leaves result in two equally likely outcomes, heads and heads. After we hear the second. - [Bob] Heads. - [Instructor] We cut any branches leading to tails. Therefore the probability the coin is fair after two heads in a row, is the one fair outcome leading to heads divided by all possible outcome leading to heads, or one fifth. Notice our confidence in the fair coin is dropping as more heads occur, though realize that we'll never reach zero. No matter how many flips occur, we can never be 100% certain the coin is unfair. In fact, all conditional probability questions can be solved by growing trees. Let's do one more to be sure. Bob has three coins, two are fair, one is biased, which is weighted to land heads two thirds of the time and tails one third. He chooses a coin at random and flips it. - [Bob] Heads. - [Instructor] Now what is the probability he chose the biased coin? Let's rewind and build a tree. The first event, choosing the coin, can lead to three equally likely outcomes, fair coin, fair coin, and unfair coin. The next event, the coin is flipped. Each fair coin leads to two equally likely leaves, heads and tails. The biased coin leads to three equally likely leaves, two representing heads, and one representing tails. Now the trick is to always make sure our tree is balanced, meaning an equal amount of leaves growing out of each branch. To do this, we simply scale up the number of branches to the least common multiple. For two and three, this is six. And finally, we label our leaves. The fair coin now splits into six equally likely leaves, three heads and three tails. For the biased coin, we now have two tail leaves and four head leaves, and that is it. When Bob shouts the result. - [Bob] Heads. - [Instructor] This new evidence allows us to trim all branches leading to tails since tails did not occur, so the probability that he chose the biased coin given heads occurred, well four leaves can come from the biased coin divided by all possible leaves. Four divided by 10, or 40%. When it doubt, it's always possible to answer conditional probability questions by Bayes Theorem, it tells us the probability of event A given some new evidence B, though if you forgot it, no worries. You need only how to grow stories with trimmed trees.