Bayes’ theorem is a powerful tool in probability that deals with conditional probabilities
It helps to calculate the probability of an event (A) happening given that we already know another event (B) has occurred
Formula: P(A | B) = (P(B | A) * P(A)) / P(B)
Example:
In a bag there are some are red (A) and some are blue (not A) ball
There’s a certain probability of each color being in the box (prior probability).
Now, let’s randomly pick a ball and we have picked up a blue (event B)
Bayes’ theorem helps to calculate the revised probability of the picking next ball, considering the new information of previous picked ball is blue (B)
Formula: P(A | B) = (P(B | A) * P(A)) / P(B)
- P(A | B): Probability of event A happening given that event B has already occurred
- P(B | A): Probability of event B happening given that event A has already occurred
- P(A): This is the prior probability of event A happening before considering any new information
- P(B): This is the total probability of event B happening before considering any new information
Scenario 1: Probability of a red marble given you already picked a blue marble
Imagine we have a bag with 4 red marbles (A) and 6 blue marbles (B)
Bag | red marble | red marble | red marble | red marble | blue marble |
blue marble | blue marble | blue marble | blue marble | blue marble |
- P(red): The prior probability of picking a red marble is 4/10
- P(blue): The prior probability of picking a blue marble is 6/10
- Now I have randomly picked a marble and it turned out to be Blue, I’m curious about the probability of the remaining marble being red (A) given this new information
- P(red | blue) = ? Probability the remaining marble is red (A) given that I have already picked a blue marble (blue)
- P(blue | red) = Probability of picking a blue marble (B) assuming that I was going for a red marble (red). Since there are more blue marbles, let’s say this is more likely, at 60% so, P(blue | red) = 0.6
P(red | blue) = (P(blue |red) * P(red)) / P(blue)
P(red | blue) = (0.6 * 0.4) / (0.6) = 0.4
Even though there are fewer red marbles initially, the fact that I already picked a blue marble (B) doesn’t change the probability of the remaining marble being red (A). It remains 40% (0.4). This is because after taking out one marble, there are only two possibility left (red or blue), and one of them is guaranteed to be red
Scenario 2: Probability of picking a blue marble after picking a red marble (and putting it back)
I pick a marble, seen it’s red (A), then put it back in the bag and shuffle before picking again
Now, what’s the probability of picking a blue marble (blue)?
- P(blue | red): Not relevant, because we’re not concerned with the color of the first pick affecting the color of the second pick when the marble is returned
- P(red): Probability of picking a red marble (red) is still 4/10 (0.4).
- P(blue): Probability of picking a blue marble (blue) remains 6/10 (0.6) after putting the red marble back.
Since I put the red marble back and shuffled the bag, the probabilities return to their initial state
The first pick (red) doesn’t influence the second pick because the bag is shuffled
Therefore, the probability of picking a blue marble (blue) remains the same as the initial probability, which is 6/10 (0.6)