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.

# 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.

## 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.