Often, when we think about probability, we're calculating the chance of an event happening out of all possibilities. But what happens if we already have some information? What if we know something else has occurred? This brings us to the idea of conditional probability.
Conditional probability measures the likelihood of an event A occurring, given that another event B has already happened. Think of it as updating our probability estimate based on new information. We write this as P(A∣B), which reads "the probability of A given B".
The "given B" part is important. When we know that event B has occurred, the original sample space (the set of all possible outcomes) is no longer entirely relevant. We can effectively ignore any outcomes where B did not happen. Our focus shifts to a new, reduced sample space consisting only of the outcomes where B occurred. Conditional probability then asks: within this new, smaller world where B is true, what is the chance that A also happens?
The formal definition and formula for conditional probability is:
P(A∣B)=P(B)P(A∩B)Let's break this down:
Essentially, the formula calculates the proportion of outcomes where A occurs out of the outcomes where B occurs.
Let's use a standard six-sided die. The sample space S={1,2,3,4,5,6}.
Define two events:
First, let's find the probabilities we need:
Now, let's find the conditional probability P(A∣B): "What is the probability of rolling a 4, given that we know the roll was an even number?"
Using the formula:
P(A∣B)=P(B)P(A∩B)=1/21/6=61×12=62=31Does this match our intuition? If we know the roll was even, our reduced sample space is just {2,4,6}. Within this set of 3 equally likely outcomes, only one outcome is a 4. So, the probability is indeed 1/3. The conditional probability P(A∣B)=1/3 is higher than the original probability P(A)=1/6, because knowing the number was even increased the chances of it being a 4.
Imagine a small survey of 100 people about pet ownership and housing type. The results are summarized in the table below:
Has Cat | No Cat | Total | |
---|---|---|---|
Apartment | 15 | 35 | 50 |
House | 25 | 25 | 50 |
Total | 40 | 60 | 100 |
Let's define events:
We want to calculate P(A∣B): "What is the probability that a person has a cat, given that they live in an apartment?"
First, find the necessary probabilities from the table (assuming we select one person uniformly at random from the 100):
Now, apply the conditional probability formula:
P(A∣B)=P(B)P(A∩B)=50/10015/100=0.500.15=5015=0.3So, the probability that someone has a cat, given they live in an apartment, is 0.3 or 30%.
Again, let's check the intuition. If we know the person lives in an apartment, we only care about the first row of the table. In that row, there are 50 people total, and 15 of them have cats. The proportion is 15/50=0.3. The formula gives us the same result.
Conditional probability is a foundational concept in many areas of machine learning. For instance:
Understanding how the probability of one event changes based on the occurrence of another is essential for interpreting data and building models that learn from it. It allows us to quantify how different pieces of information relate to each other.
© 2025 ApX Machine Learning