Conditional probability §
Conditional probability quantifies how beliefs about events change when partial information is observed. It is the central operation in Bayesian updating, independence modeling, and the construction of conditional measures on refined information. It is relevant whenever a probability must be refined given a condition: medical diagnosis, spam filtering, reliability engineering, and probabilistic graphical models.
Authoritative sources
Definition §
For events and with :
The intuition: restrict the sample space to the outcomes in (the condition is known to hold), then renormalize so that the total probability on is 1. The event is now measured relative to the smaller world where has occurred.
Details
Step 1: The restriction idea.
Suppose you draw a card from a standard 52-card deck. Let = “the card is a King” and = “the card is a heart”. Without any information, . Now you are told the card is a heart. The sample space shrinks to the 13 hearts. Among those, exactly one is a King, so .
Formally: (the King of hearts), , and indeed .
Step 2: Renormalization.
The division by is a renormalization. Before conditioning, the 13 hearts carry total mass . After conditioning, they must carry total mass 1, so every probability inside is scaled up by .
Step 3: When .
The formula breaks down when (e.g. “the temperature is exactly 23.456 °C”). The remedy is the regular conditional probability, developed in the last section of this page. There, one replaces the quotient by a limit or by a measure-theoretic construction (Radon–Nikodým derivative).
Example problem.
Problem
A bag contains 3 red and 2 blue balls. You draw two balls without replacement. Let = “the second ball is red” and = “the first ball is red”. Compute .
Solution
After drawing a red ball first, the bag has 2 red and 2 blue. So .
Check with the formula: , , so . ✓
Independence §
Events and are independent iff .
Random variables and are independent iff their joint distribution factors: for all measurable sets .
Mutual independence of requires the joint to factor for every subset: .
Details
Step 1: Independence as a structural property.
Independence is a statement about the joint measure, not about moments. Two variables can have zero covariance yet be strongly dependent.
Worked example. Let and . Then:
- , .
- (by symmetry: the integrand is odd about ).
- So .
Yet is a deterministic function of , so knowing determines exactly. The variables are maximally dependent despite zero covariance.
Step 2: Conditional independence.
means almost surely. This is the key relation in Bayesian networks and hidden Markov models (see Stochastic processes).
Step 3: Mutual vs. pairwise independence.
Pairwise independence (every pair is independent) does not imply mutual independence. Classic counterexample: let be independent Rademacher (±1 with equal probability) and set . Then every pair is independent, but always, so the triple is not mutually independent.
Example problem.
Problem
Two fair coins are flipped. Let = “at least one head”, = “the first coin is heads”. Are and independent?
Solution
, , (since if the first is H, A is automatically satisfied).
Check: . Not independent. ✓
Bayes’ theorem §
For events and with , the law of total probability states that for any partition of the sample space:
Substituting this into the definition gives Bayes’ theorem:
This is a pure algebraic identity: it inverts the direction of conditioning. In the continuous case, densities replace probabilities:
The full Bayesian framework—priors, likelihoods, posteriors, conjugate families, MCMC—is developed in Bayesian inference.
Details
Step 1: The algebraic inversion.
Bayes’ theorem converts (how the data looks given a hypothesis) into (how plausible the hypothesis is given the data). The numerator is the joint , and the theorem simply solves for .
Step 2: The base-rate fallacy.
A common error is to ignore the prior and treat the likelihood as the posterior. When the prior is very small, the posterior can be far smaller than the likelihood suggests. The interactive simulation above makes this tangible: set the prior to 0.001 and the sensitivity to 0.99, and watch the posterior stay near 2% even with a 99% sensitive test.
Step 3: The law of total probability as a partition identity.
The denominator is not a separate theorem; it is the definition of expanded over a partition. For a binary partition : .
Worked example (disease screening).
A disease affects 1 in 10 000 people. A test has sensitivity 99% and specificity 99.5%. A patient tests positive. What is the probability the patient actually has the disease?
Let = has disease, = tests positive.
- Prior:
- Sensitivity:
- False-positive rate:
Despite a positive test, the probability of disease is only about 2%. The low prior (base rate) dominates.
Example problem.
Problem
A factory has two machines: Machine A produces 60% of widgets and has a 2% defect rate. Machine B produces 40% of widgets and has a 5% defect rate. A widget is found to be defective. What is the probability it came from Machine A?
Solution
Let = from Machine A, = defective.
, , .
So there is a 37.5% chance the defective widget came from Machine A, despite Machine A producing most of the output. Machine B’s higher defect rate pulls the posterior toward B.
Chain rule §
For a sequence of random variables :
This factorization is the basis of autoregressive models, language models, and sequential Monte Carlo (see Stochastic processes).
Details
Step 1: Derivation from the definition.
The chain rule follows by repeated application of . For three variables:
Each step peels off one variable by conditioning on all previous ones.
Step 2: The continuous case.
For joint densities: . This is the form used in autoregressive models and in the sequential factorization of language models.
Step 3: Ordering matters for compactness.
The ordering is arbitrary; different orderings give different factorizations of the same joint. Choosing an ordering that matches the causal or temporal structure of the problem yields the most compact model. For example, in a Markov chain, the temporal ordering gives , a product of one-step transitions rather than full-history conditionals.
Example problem.
Problem
A three-letter word is generated by: first letter uniform over {A, B}, second letter is A with probability 0.8 if the first is A, else B with probability 0.7. Third letter is always the same as the second. Write the joint probability of the word “ABA” using the chain rule.
Solution
- (third letter equals second, which is B, so it cannot be A)
So . The word is impossible under this model.
Regular conditional probability §
Given a sigma-algebra , the conditional probability is the unique (a.s.) -measurable random variable satisfying
This is the “integral version” of the elementary definition: just as is the unique number on whose average (weighted by ) reproduces , the random variable is the unique -measurable function whose integral over every reproduces . The same construction, with replaced by the integral of a random variable , gives the conditional expectation (see Random variables and expectation).
Details
Step 1: The discrete case.
When is generated by a discrete random variable with values , the regular conditional probability reduces to the familiar formula:
The random variable simply takes the value on the set .
Step 2: The continuous case.
In the continuous case, a regular conditional probability exists as a probability kernel under mild conditions (standard Borel spaces). This is the object that makes Bayesian updating rigorous when the observation is continuous. The construction uses the Radon–Nikodým theorem: the measure is absolutely continuous with respect to on , and the RN derivative is .
Step 3: Connection to conditional expectation.
The conditional expectation is defined identically, with replaced by . It is the “integral version” of conditional probability: where answers “what is the probability of given the information in ?”, answers “what is the best -measurable guess of ?”. See Random variables and expectation for the full development.
Example problem.
Problem
Let and let . Compute .
Solution
has two atoms: and .
- On : (impossible).
- On : .
So .
Quizz §
Quizz
A disease affects 1 in 10 000 people. A test has sensitivity 99% and specificity 99.5%. A patient tests positive. What is the probability the patient actually has the disease?
Solution
Let = has disease, = tests positive.
- Prior:
- Sensitivity:
- False-positive rate:
By Bayes’ theorem:
Despite a positive test, the probability of disease is only about 2%. The low prior (base rate) dominates. This is the base-rate fallacy in action.