Main content

### Course: Class 12 math (India) > Unit 15

Lesson 1: Conditional probability and independence- Calculating conditional probability
- Conditional probability explained visually
- Conditional probability using two-way tables
- Calculate conditional probability
- Conditional probability tree diagram example
- Tree diagrams and conditional probability
- Conditional probability and independence
- Conditional probability and independence
- Analyzing event probability for independence
- Dependent and independent events
- Multiplication rule of probability

© 2024 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Calculating conditional probability

Conditional probabilities are written like P(A|B), which can be read to mean, "the probability that A happens GIVEN b has happened." If we know probabilities like P(A), P(B), and P(A|B), we can solve for other probabilties like P(B|A). Created by Sal Khan.

## Want to join the conversation?

- Why P(A and B) != P(A)*P(B). Because those events dependent?(60 votes)
- When A and B are independent, P(A and B) = P(A) * P(B); but when A and B are dependent, things get a little complicated, and the formula (also known as Bayes Rule) is P(A and B) = P(A | B) * P(B). The intuition here is that the probability of B being True times probability of A being True given B is True (since A depends on B) is the probability of both A and B are True.(108 votes)

- I'm a bit confused by this video. Basically, the video says that P(A) [Eating a bagel] is dependent

on P(B) [Eating a pizza for lunch]. But what I don't understand is why is P(B) dependent on P(A)? Nothing in the question indicates that having a bagel for breakfast affects having a pizza for lunch. Why, therefore, is P(B) dependent on P(A)?(39 votes)- There does not have to be a causative relationship between A and B, just a correlation.

Suppose I have 4 friends:

Amy is on the basketball team and has red hair.

Bill is a cheerleader for the basketball team and has black hair.

Chad is also on the basketball team and has blond hair.

Diego hates basketball and has brown hair.

Only 25% of my friends have red hair (Amy).

But if I tell you that I'm going to watch one of my friends play basketball, it has to be Amy (red hair) or Chad (blond hair), so there is a 50% chance that I am referring to a friend with red hair. Amy's red hair did not make her more likely to play basketball, it is just an accident of the situation.(55 votes)

- Can you explain how to work out Pr(A'|B')?(7 votes)
- When we say S ∩ Q , we mean that both S and Q should happen isn't it.

So we can express that in 2 ways.

Why 2 ways?, Because S ∩ Q = Q ∩ S (Commutative law is satisfied) (Eg. Bagel and Pizza <=> Pizza and Bagel)

1) Event S happening and Event Q happening given that S has already happened

(or)

2)Event Q happening and Event S happening given that Q has already happened

We can express 1) as: P(S ∩ Q) = P(S) * P(Q | S)---------------(alpha)

and we can express 2) as: P(Q ∩ S) = P(Q) * P(S | Q)--------------(beta)

Since intersection is commutative , (alpha) and (beta) both are same.

so using the values you mentioned, you can substitute them and solve it.

:)(2 votes)

- Is it possible that a dependency is valid only in one-direction? In other words, is it possible that B affects A, but A does not affect B. I believe there are real life examples of one-way dependencies.

If that is the case, then

P(A & B) = P(A given B) . P(B) = P(B given A) . P(A) could be rewritten as follows:

P(A & B) = P(A given B) . P(B) = P(B) . P(A) and if that is true, then

P(A given B) must be equal to P(A) which indicates that A & B are independent? I appreciate your feedback. Thank you.(5 votes) - I don't get it, HOW can the likelihood of what you have for breakfast be influenced what you have for lunch! I can't even begin to try to draw this out via a tree diagram.(8 votes)
- Don't infer cause from dependence. If we look at the likelihood of what you eat for breakfast, there will be a frequency of each choice. The dependence merely observes that the frequency of choosing a bagel happens to be higher than usual on the days you also choose to eat pizza for lunch. There is no consideration of how, or even a claim that there is such a how. We simply notice the likelihood is higher and treat as dependent.(7 votes)

- I know this sounds really basic, but how would you go about answering an example like this?

A survey of college students finds that 20% like country music, 15% like gospel music and 10% like both country and gospel music.

The conditional probability that a student likes country music given that they like gospel music is.. ??(1 vote)- Conditional probability P(A | B) = P(AnB) / P(B)

So you're looking for the probability of both, divided by the probability of the thing that is the given that. 10 / 15. 66.7%(10 votes)

- I'm confused with this. Wouldn't P(A and B) be equal to A * B, or 0.6 * 0.5? To find P(A and B), Sal is multiplying P(A | B) by P(B), or 0.7 * 0.5, which gives another answer. Can anyone explain which method is correct?(3 votes)
- Multiplying P(A) and P(B) only works when A and B are independent. When they are not independent, then you need to use the conditional probability.(5 votes)

- When i draw this out on a tree i see that there are two possible ways to make A & B happend. Either A then B or B then A. Then why is not P(A&B) = the sum of P(A)*P(A|B)+P(B)*P(AB)?(5 votes)
- I was wondering the same thing! Anybody have an answer?(1 vote)

- I'm not sure if this is just because maths questions are set out funny or becuase I'm misunderstanding the question...

but, why is he eating a bagel for breakfast GIVEN he's eating a pizza for lunch. Wouldn't he eat lunch after breakfast?(4 votes) - At6:26, we get the same answer by treating the question as ratios. That is, 0.6:0.7 as 0.5:x. Is the reasoning sound?(3 votes)
- Yup, because ratios are just fractions, so in the end everything will work out; your reasoning is sound.(1 vote)

## Video transcript

Voiceover:Rahul's two favorite foods are bagels and pizza. Let A represent the event that he eats a bagel for breakfast and let B represent the event that he eats pizza for lunch. Fair enough. On a randomly selected
day, the probability that Rahul will eat a bagel for breakfast, probability of A, is .6. Let me write that down. So the probability that he eats a bagel for breakfast is 0.6. The probability that he
will eat a pizza for lunch, probability of event B ... So the probability of ... Let me do that in that red color. The probability of event B, that he eats a pizza for lunch, is 0.5. And the conditional
probability, that he eats a bagel for breakfast given that he eats a pizza for lunch, so
probability of event A happening, that he eats
a bagel for breakfast, given that he's had a pizza for lunch is equal to 0.7, which is interesting. So let me write this down. The probability of A given,
given that B is true. Given B, is not 0.6, it's equal to 0.7. And because these two
things are not the same, because the probability of A by itself is different than the probability of A given that B is true, this tells us that these two events are not independent. That we're dealing with
dependent probability. This shows us. The fact that B being true has changed the probability of A
being true, this tells us that A and B are dependent. Dependent. And so when we start thinking ... Well actually let's just, before I start going on my little soapbox
about dependent events, let's just think about what they actually want us to figure out. So the probability, the probability of A given B is equal to 0.7, that's what we wrote right over here. Based on this information,
what is the probability of B given A? So they want us to figure
out the probability of B given ... Probability of B given A. That's what they want us to figure out. The conditional probability that Rahul eats pizza for lunch, given that he eats a bagel for breakfast, rounded to the nearest hundredth. So how would we think about this? And I encourage you to
pause this video before I work through it. So I'm assuming you've given a go at it. So the best way to tackle this is to just think about, well, what's
the probability that both A and B are going to happen? Well, the probably of
A and B happening ... And let me do this in a new color. The probability of A and B happening. A and B. I want to stay true to the colors. Is equal to ... There's a couple of ways
you could write this out. This is equivalent to,
this is equivalent to the probability, probability of A given B. Given B, times the probability of B. And hopefully that makes sense. The probability that B happens and that given that B had happened, the probability that A happens. And that would also be equal to ... So obviously this is A and B is happening, or you could do it the other way around. You could view it as
the probability that B, the probability that B given A happens. Given A happens, times
the probability of A. Times the probability of A. This also makes sense. What's the probability that A happened? And that, given A happened, what's the probability of B? You multiply those together, you get the probability that both happened. So why is this helpful for us? Well, we know a lot of this information. We know the probability
of A given B is 0.7. So let me write that, I'll
scroll down a little bit. This is 0.7. We know that the probability of B is 0.5. So this is 0.5. So we know that the probability of A and B is the product of these two things. That's going to be 0.35. Seven times five is 35
or, I guess you could say, half of .7 is 0.35. .5 of .7. And that is going to be
equal to what we need to figure out. Probability of B given A
times probability of A. But we know probability of A. We know that that is 0.6. We know that this is 0.6. So just like that, we've
set up a situation, an equation, where we can
solve for the probability of B given A. The probability of B given A. Notice, let me just
rewrite it right over here. Actually, I'll write this part first. 0.6, 0.6 times the
probability of B given A. Times that, right over there. And I'll just copy and paste it so I don't have to keep changing colors. That, over there, is equal to 0.35. Is equal to 0.35. And so to solve for the probability of B given A, we can just
divide both sides by 0.6. 0.6, 0.6 and we get the probability of B given A is equal to ... Let me get our calculator out. So 0.35 divided by, divided by 0.6 and we deserve a little
bit of a drum roll here, is .5833 ... It keeps going. They tell us to round to
the nearest hundredth. So it's 0.58. Is approximately, is approximately 0.58. So notice, this is equal to 0 ... or I'll say approximately equal to 0.58. Once again, verifying
that these are dependent. The probability that B
happens given A is true, is higher than just the probability that B by itself, or without
knowing anything else. Just the probability of B is lower than the probability of
B given that you know, given that you know A has happened, or event A is true. And we're done.