Conditional probability and Bayes
Conditional probability P(A|B) is the chance of A given that B has already happened. The law of total probability splits an event into several mutually exclusive "scenarios", and Bayes' rule allows re-estimating the probability of a scenario after the event happened: the prior probability is refined into a posterior one.
In plain words:
P(A|B) is the probability of A when we already know that B happened. Divide the probability that both events occurred by the probability of B: we count the "share of A" inside the set of outcomes B.
Example:
- B — "an even number came up", A — "greater than 2 came up"
- P(A⋅B) — even and greater than 2: the numbers 4 and 6, P=62
- P(A∣B)=3/62/6=32 — out of the even numbers (2,4,6) the ones 4 and 6 are suitable
Main rule:
"Knowing B, find the chance of A": divide the probability of the intersection by the probability of B — P(A∣B)=P(A⋅B)/P(B).
In plain words:
Rearranging the conditional-probability formula gives the multiplication rule: the probability of two events at once is the probability of B multiplied by the probability of A given B.
Example:
- Out of 12 parts, 3 are defective; we take two without replacement
- P (first defective) =123, P (second defective | first defective) =112
- P (both defective) =123⋅112=221
Main rule:
"And" events are counted step by step: P(A⋅B)=P(B)⋅P(A∣B). For independent B and A the formula simplifies to P(A)⋅P(B).
In plain words:
If an event can happen under one of the mutually exclusive scenarios B_1, B_2, ..., then the overall chance of A is the sum over each scenario: the chance of the scenario times the chance of A inside it.
Example:
- The first shop supplies 70% of the parts, the second — 30%
- Defect rate in the first shop — 2%, in the second — 5%
- P (defect) =0,7⋅0,02+0,3⋅0,05=0,014+0,015=0,029
Main rule:
"The event happened from different sources": weigh the chance of A by each scenario and add up.
In plain words:
Bayes' rule flips the question: knowing that A happened, we ask how likely it is that the cause was exactly scenario B_i. The numerator is the "contribution" of the scenario, the denominator P(A) is the total probability (the sum of all contributions).
Example:
- A priori P(B1)=0,7 — the share of parts from the first shop
- We found a defect: P(A)=0,029, the contribution of the first shop is 0,7⋅0,02=0,014
- P(B1∣A)=0,0290,014≈0,48 — the posterior probability
Main rule:
Bayes: the share of the "contribution" of the wanted scenario in the total P(A). Before the event — prior probability, after — posterior.