Conditional Probability, Independence, and Bayes' Formula
Conditional probability, reduced sample spaces, and P(.|A) as a probability measure; the multiplication (chain) rule and the exactly-k- matches identity; independence of two, three, and n events, physical vs probabilistic independence, and why pairwise independence does not imply mutual independence; independent trials, binomial probabilities, parallel systems, and the probabilistic method; independent discrete random variables and pmf factorization; the law of total probability, first-step analysis (5 before 7, the problem of the points, gambler's ruin, drug testing, runs), Bayes' formula, odds form and likelihood ratios, the base-rate fallacy, the three-card and two-child puzzles, DNA evidence, conditional independence, and Laplace's rule of succession; conditional expectation and the law of total expectation (red-faced dice, die-then-coins, smoking and lung cancer, socks, two boxes, two-coin mixtures).
Motivation: updating on partial information
A second limitation of the event-level view of probability-foundations motivates this note: information arrives partially. Once we learn the first die shows 3, probabilities should change. Sometimes, though, conditioning on a cleverly chosen event makes a hard unconditional probability easy — and sometimes we want to run this backwards, updating a hypothesis’s probability given evidence rather than an event’s probability given a cause.
IntuitionThe central questions
How should probabilities change when we learn that some event occurred, when do they not change, and how do we reverse a conditional probability to reason from evidence back to causes?
| Tool | Packages | Summary statistics / rules |
|---|---|---|
| conditional probability | an update given | chain rule; is itself a probability |
| independence | ”the update changes nothing” | product rules for events and pmfs |
| total probability + Bayes | reasoning by cases; inverting conditionals | odds × likelihood ratio |
NoteRandom variables and their distributions live in a companion note
This note assumes only the sample-space/event machinery of probability-foundations. Random variables, pmfs, expectation, and the named discrete distributions (Bernoulli, binomial, geometric, …) are covered in discrete-random-variables-and-distributions; the “independent random variables” section below borrows that note’s pmf notation.
Conditional probabilities
DefinitionConditional probability
IntuitionReduced sample space
Knowing occurred means . Whether holds now depends only on , renormalized so that itself has probability 1. When outcomes are equally likely, conditioning on makes the outcomes of equally likely, so you can just count inside .
WarningUndefined means undefined
Hajek: a routine computing from and should raise an error (“conditioning on an event of probability zero”), not return 0. The error helps catch bugs upstream.
ExampleConditioning can lower, raise, or leave unchanged (Hajek)
Two dice. = “sum is 6” , so .
| Event | Effect | ||
|---|---|---|---|
| numbers differ | lowered | ||
| numbers equal | raised |
With = “first die even” and = “sum is 7”: . Unchanged.
ExampleClassic warm-ups (Ross)
- Key in a pocket: 80% sure it’s in one of two pockets, 40% each. The left pocket is empty, so .
- First die is 3, sum is 8: in the reduced space , the probability is .
- Bridge: North–South hold 8 spades, so East–West share 26 cards with 5 spades. .
Warning“At least one” is not “the first”
Two coin flips: , but . “At least one head” leaves three equally likely outcomes (HH, HT, TH), not two equally likely cases (“both” vs “one”).
Theorem is a probability measure (Ross Prop. 5.1)
For fixed with :
- ;
- ;
- for disjoint : .
So every theorem about probabilities holds for conditional probabilities: complements, inclusion–exclusion, the total-probability rule below. In particular, when .
ProofCheck the axioms
(1) since . (2) . (3) , a disjoint union, so countable additivity of passes through the division by .
∎
IntuitionA new view of the experiment
Learning replaces the probability measure with , a genuine probability measure on the same space.
NoteFrequency interpretation
In repetitions, occurs about times and about times. Among the runs where occurs, the fraction with is about . So the definition matches long-run frequencies.
The multiplication (chain) rule
FormulaChain rule
ProofTelescoping
Apply the definition to each factor: . All the intermediate terms cancel.
∎
IntuitionBuild the event one stage at a time
The chain rule is the probabilistic counting principle: multiply the chance of each stage, given everything before it.
ExampleChain-rule computations (Ross)
- Celine takes chemistry with probability and then gets an A with probability : .
- Two reds from 8 red + 4 white: . If balls are drawn with probability proportional to weight ( for red, for white), the answer is .
- Each of 4 piles of 13 gets an ace: place the aces one by one. The ace of hearts avoids the ace of spades’ pile with probability , the next ace with , the last with :
- No two of the 4 strong teams meet among 8 random quarterfinalists: .
ExampleExactly matches in the hat problem (Ross)
Let be the no-match probability (probability-foundations). For a specified set of people, by the chain rule, . Given that, the rest form an -person problem. So
Mutually independent events
Motivation. If , learning tells us nothing about . That is equivalent to . What about ? Then . Learning “not ” changes nothing, so should count as independent of .
DefinitionIndependence of two events
and are (mutually) independent if This definition is symmetric and works even when . Independence is a property of a pair of events; a single event isn’t “independent” by itself.
ImportantPhysical vs probabilistic independence
Physically separate parts of an experiment (two dice, a coin and a die) are modeled as independent. But independence is just one equation, and it can hold without physical separation. On one die, and have , so they are independent.
ExampleIndependent or not? (Ross)
| Experiment | Events | Independent? |
|---|---|---|
| one card | ace, spade | yes: |
| two coins | first heads, second tails | yes: |
| two dice | sum 6, first die 4 | no: |
| two dice | sum 7, first die 4 | yes: |
IntuitionWhy “sum 7” is special
Whatever the first die shows, exactly one face of the second die completes a 7. So the first die gives no information. For “sum 6,” a first die of 6 kills the chance entirely.
PropositionComplements preserve independence
If and are independent, so are and , and , and and . All four conditions are equivalent.
ProofSubtract off the intersection
. Apply the same argument again for the other two.
∎
Three or more events
DefinitionPairwise independence
are pairwise independent if each pair satisfies the product rule.
WarningPairwise does not imply independent
Two coins (Hajek): = first heads, = second heads, = both coins match. Each has probability .5, and each pairwise intersection has probability .25, so they are pairwise independent. But .
Two dice (Ross): = sum 7, = first die 4, = second die 3. Again pairwise independent, but .
DefinitionIndependence of events
are independent if for every subcollection with , For three events this is four equations: three pairs plus the triple. An infinite family is independent if every finite subfamily is.
TheoremGrouping
If are independent, then events built by Boolean operations from disjoint blocks of them are again independent. For example, is independent of and of .
Proof independent of
∎
Independent trials
DefinitionIndependent subexperiments and trials
Subexperiments are independent if events , each determined only by the -th subexperiment, are always independent. When every subexperiment has the same outcome set, they are called trials.
FormulaSuccess probabilities in independent trials
With success probability per trial:
- ;
- (the binomial probability);
- if , by probability-foundations.
DerivationThe binomial probability
Any particular sequence with successes and failures has probability by independence. There are such sequences, and they are disjoint.
ExampleParallel system (Ross)
The system works if any of independent components works (probabilities ):
ExampleThe probabilistic method (Ross)
Color each edge of the complete graph red or blue independently with probability . A fixed -set of vertices is monochromatic with probability . By Boole’s inequality, Then a coloring with no monochromatic -set exists. The argument proves existence without constructing one. (The same method gives the lower bound in cost-sharing.)
Independent random variables (of discrete type)
DefinitionIndependence of random variables (Hajek Def. 2.4.8)
and are independent if every event is independent of every event . More generally, are mutually independent if are always independent events.
TheoremFactorization of the joint pmf
Discrete are independent iff
ProofPoint masses suffice
(⇒) Take and .
(⇐) For any :
The key step: a double sum of products factors into a product of sums.
∎
ExampleCoin and die (Hajek)
A flip and a roll , with all 12 outcomes equally likely: . Every pair factors, so any event about is independent of any event about .
RemarkWhy for dice
The factorization is what let split into in the product example. The general statement ( for independent ) comes later in Hajek, Section 4.4.
The law of total probability, and Bayes’ formula
Total probability
TheoremLaw of total probability
For any event with : More generally, for a partition of :
ProofSplit along the partition
with the pieces disjoint, so by the chain rule.
∎
IntuitionReason by cases
is a weighted average of the conditional probabilities, each weighted by the probability of its case. Choose the cases so that each conditional is easy.
ExampleReasoning by cases (Ross)
- Accident-prone policyholders: 30% are accident prone (accident rate .4), the rest have rate .2. So .
- Flashlights of 3 types: 20%, 30%, 50% of stock with lifetime probabilities .7, .4, .3: .
- Twins: identical twins are always the same sex, fraternal twins are the same sex with probability . So . Observing gives . This estimates something unobservable (DNA identity) from something cheap (sex).
- Card after the first ace: condition on the ordering of the other 51 cards. Given , the specified card is equally likely to be in any of 52 slots, and exactly one follows the first ace. So , matching the counting argument.
ExampleEvery strategy wins with probability (Ross)
Cards are turned over one at a time, and you may once predict “the next card is the ace of spades.” If you never guess, you win if the ace is last. Claim: for an -card deck, every strategy wins with probability .
Induction: let be the probability your strategy guesses on card 1. Guessing wins with probability . Not guessing requires the first card not to be the ace, , and then you face an -card deck, . So
Conditional expectation and total expectation
DefinitionConditional mean given an event (Hajek §2.10)
For an event with ,
This is the ordinary mean computed with the conditional pmf. Conditional LOTUS holds because is a probability measure.
TheoremLaw of total expectation
For a partition of with each ,
ProofTotal probability inside the mean
Substitute into and swap the order of summation.
∎
NoteAlready in use
First-step analysis of the geometric mean and variance (discrete-random-variables-and-distributions) is exactly this rule, with the partition {first trial succeeds, fails}.
ExampleDice with red faces (Hajek)
A bag holds three dice with 1, 2 and 3 red faces. One is drawn at random and rolled repeatedly. Let = the die with red faces, and = red on roll .
- .
- , so .
- and , so .
The rolls are conditionally independent given the die, but not independent: red makes the redder die, and hence more red, likelier.
ExampleA die, then that many coins (Hajek)
Roll a die (), then flip fair coins, and let = the number of heads. By total probability,
and .
ExampleSmoking and lung cancer (Hajek, CDC figures)
Women who smoke are about 13 times likelier to develop lung cancer, and about 15% of women smoke. If nonsmokers’ rate is ,
The unknown baseline cancels. Also, if 18% of adults and 15% of women smoke, and half of adults are women, then 21% of men smoke, and the fraction of smokers who are women is .
ExampleSocks and boxes (Hajek)
- Socks: 4 black, 6 red and 8 yellow, draw 2. and .
- Two boxes: box 1 has 3 black and 2 white balls, box 2 has 2 and 2. Move a random ball from box 1 to box 2 ( = it was white), then draw from box 2 ( = black). and . Transferring a white ball makes a black draw less likely, so seeing black makes less likely.
ExampleA mixture of two coins (Hajek)
Pick one of two coins with heads probabilities and (), each with probability , then flip it times. Let be the number of heads.
Using for each coin,
ImportantUncertainty about the model does not average out
A single binomial has . The mixture has , because not knowing which coin is being flipped is a fixed uncertainty that more flips of the same coin cannot remove.
First-step analysis
Condition on the first trial. If the process restarts afresh afterward, you get an equation for the unknown probability.
ExampleA sum of 5 before a sum of 7 (Ross)
, , and neither with probability . Conditioning on the first roll:
In general, for mutually exclusive in repeated independent trials,
ExampleThe problem of the points (Pascal–Fermat, 1654)
Trials succeed with probability . What is the probability of successes before failures? This is the fair split of stakes in an interrupted game.
- Pascal (first step): , with and .
- Fermat (imagine playing on): successes precede failures iff the first trials contain at least successes:
IntuitionFermat’s trick: play past the end
Pretend the game always runs a fixed number of trials. Extra trials after the decision can’t change the outcome, and a fixed-length game has a binomial count. The same trick shows that “winner serves” and “alternating serve” give the same match-win probability in serve-and- rally games (Ross): with rallies played, the first server always serves of them.
ExampleGambler’s ruin (Ross)
starts with units and with . Each flip moves one unit to with probability (let ). Conditioning on the first flip gives , with and . Therefore
DerivationSolving the recurrence
Step 1: Increments are geometric. From we get
Step 2: Sum the increments. , a geometric series (or if ).
Step 3: Use to find .
Step 4: Nobody plays forever. ’s win probability comes from the same formula with and . Algebra shows . So the third possibility, the game never ending, has probability 0.
ExampleNumbers and applications
- Starting at 5 of 15 total units: wins with probability at , but about at . A small edge compounds.
- Huygens’ dice duel (12 coins each; 11 on three dice pays , 14 pays ) is gambler’s ruin with , , .
- Sequential drug trial: stop when one drug’s cumulative cures lead the other’s by . The probability of wrongly declaring the worse drug better is With and : .017 at and .0003 at .
ExampleEqual-fortune elimination (Ross)
Player holds units, . Random pairs play fair one-unit games until one player holds everything. . Split each player into one-unit “sub-players.” By symmetry each of the sub-players is equally likely to end up with everything, and team wins exactly when one of its sub-players does. This holds however the pairs are chosen.
ExampleRuns before runs (Ross)
What is the probability that a run of successes comes before a run of failures? Condition on the first trial, then on whether the next (or ) trials continue the run. A broken run resets the problem:
For a fair coin, 2 heads before 3 tails has probability , and 2 heads before 4 tails has probability . The two symmetric probabilities sum to 1, so one of the runs occurs eventually.
ExampleMatching problem by recursion (Ross)
Condition on whether person 1 takes their own hat. With the no-match probability, , i.e. . With and , this telescopes to , matching the inclusion–exclusion answer.
Bayes’ formula
TheoremBayes’ formula (Ross Prop. 3.1)
For a partition and an event with :
ProofDefinition over total probability
. Write the numerator with the chain rule and the denominator with total probability.
∎
IntuitionPriors, likelihoods, posteriors
Think of the as hypotheses, as priors, as likelihoods of the evidence, and as posteriors. Bayes’ formula says how evidence should revise belief: posterior ∝ likelihood × prior.
DefinitionOdds
Odds of are said ” to 1” in favour. For example, gives odds 2.
FormulaBayes in odds form
New odds = old odds × likelihood ratio.
ImportantWhat counts as evidence for a hypothesis
raises the probability of iff : the evidence must be more likely under than under its negation. “Consistent with ” is not enough.
Reese–Schapiro bridge hearing (1965): the prosecution argued that play consistent with cheating counts toward guilt. But the same play was equally consistent with their standard line, a likelihood ratio of about 1, so it was no evidence at all.
ExampleThe base-rate fallacy — a good test for a rare disease (Ross)
The test detects the disease 95% of the time, gives false positives 1% of the time, and prevalence is 0.5%.
Only about a third of positives are sick.
graph LR P["200 people tested"] -->|"prevalence 0.005"| D["1 has disease"] P -->|"0.995"| H["199 healthy"] D -->|"detects 0.95"| TP["0.95 true positive"] H -->|"false positive 0.01"| FP["1.99 false positives"]
IntuitionCount people, not probabilities
Per 200 people tested, about 0.95 true positives compete with about 1.99 false positives. The false positives win because the healthy group is about 200 times larger. A rare condition makes even a small false-positive rate dominate.
ExampleBelief updates (Ross)
| Situation | Prior | Likelihoods (under / not ) | Posterior |
|---|---|---|---|
| accident prone, given an accident | .3 | .4 / .2 | |
| knew the answer, given correct ( choices) | 1 / | ; at , | |
| disease, positive test, diabetic patient | .6 | 1 / .3 | (≥ .8, so operate) |
| guilty, suspect has the criminal’s trait (20% of population) | .6 | 1 / .2 | |
| type-A coin (two A’s, one B), heads | / | odds , probability | |
| flashlight type 1, 2, 3 given it lasted | .2, .3, .5 | .7, .4, .3 | |
| chimp father is male 1 (baby Aa; mother AA; males aa, Aa) | 1 / |
ExampleSearching for a lost plane (Ross)
The plane is equally likely to be in one of 3 regions. A search of region misses the plane there with overlook probability . After an unsuccessful search of region 1:
Region 1’s probability drops and the others’ rise. The drop is smaller when is large, since a miss is then more plausibly bad luck.
WarningThe three-card swindle (Ross)
The cards are red/red, black/black and red/black. A random card shows red on top. What is ? It is , not . Count sides, not cards: of the 3 equally likely red faces, only one belongs to the red/black card.
WarningThe two-child puzzle is underspecified (Ross)
A mother of two is seen with a daughter. What is ? It is which depends on how the child walking with her was chosen.
- The companion is the elder child with probability regardless of sex: answer .
- With mixed sexes, she walks with the girl with probability : answer . With this is , the “at least one girl” answer.
The sample space must include which child is seen, not just the children’s sexes.
ExampleDNA database match (Ross)
One culprit among 1,000,000 townspeople. Each of 10,000 ex-convicts has prior probability and everyone else , so . An innocent person matches with probability . A. J. Jones is the only match in the ex-convict database. Working it through,
| Prior ratio | |
|---|---|
| 100 | .9099 |
| 10 | .5025 |
| 1 | .0917 |
The prior drives the conclusion. The same DNA evidence yields anywhere from 9% to 91%.
Conditional independence and sequential updating
DefinitionConditional independence
and are conditionally independent given if
WarningConditionally independent ≠ independent
Accidents in successive years are conditionally independent given whether the policyholder is accident prone. Unconditionally, a first-year accident raises the posterior that the person is accident prone, which raises next year’s risk:
ExampleLaplace’s rule of succession (Ross)
The box holds coins , where coin lands heads with probability . One is picked at random and lands heads times in a row. Flips are conditionally independent given the coin, so
TheoremSequential Bayesian updating
If and are conditionally independent given each hypothesis , then the posterior after can serve as the prior for :
For example, tracking which of two coins is being flipped requires storing only the current posterior, not the whole history.
ProofFactor the joint likelihood
By conditional independence, . So
with . Summing over (the posteriors sum to 1) identifies .
∎
Quick reference
| Object | Statement | Note |
|---|---|---|
| Conditional probability | undefined if | |
| a probability measure | all rules carry over | |
| Chain rule | aces in piles | |
| Exactly matches | ||
| Independence | complements preserve it | |
| events | product rule for every subfamily | pairwise is not enough |
| Binomial | independent trials | |
| Parallel system | ||
| Independent RVs | joint pmf factorizes | ⇒ for dice |
| Total probability | reason by cases | |
| before | 5 before 7: | |
| Problem of points | play past the end | |
| Gambler’s ruin | or | ends with probability 1 |
| Bayes | ||
| Odds form | posterior odds = prior odds × likelihood ratio | evidence iff ratio > 1 |
| Base rates | for a 95%/1% test at 0.5% prevalence | |
| Three cards | count sides | |
| Conditional independence | not unconditional | |
| Rule of succession | ||
| Conditional mean | conditional LOTUS | |
| Total expectation | behind first-step analysis | |
| Coin mixture | , not |
Facts to keep to hand
- Conditioning replaces with a new probability measure. Every rule survives. Most apparent paradoxes (at least one head, three cards, two children) come from a misspecified reduced sample space. Fix them by returning to the definition and counting outcomes, sides, or which child was seen.
- Independence is algebra, not physics. Physical separation justifies assuming it, but it can hold by coincidence (even and multiple of 3 on one die). Pairwise independence does not imply mutual independence. And conditional independence given a hidden cause coexists with unconditional dependence (accident proneness).
- Total probability plus a restart gives an equation. 5 before 7, gambler’s ruin, runs, matching, points, and the ace-guessing game all condition on the first step and exploit the fact that the process begins afresh. Fermat’s alternative is to extend the game to a fixed length so a binomial count applies.
- Bayes is “posterior odds = prior odds × likelihood ratio.” Evidence supports only if it is likelier under than under not-. Rare hypotheses need very large likelihood ratios, which explains the base-rate fallacy, the DNA-database sensitivity to priors, and why “consistent with guilt” is not evidence of guilt.
- Total expectation is total probability for means. Condition on a partition and average the conditional means. It underlies first-step analysis, and it shows that model uncertainty (which coin?) adds spread that grows like rather than .
References
- Hajek, Probability with Engineering Applications (ECE 313 notes) — chapter 2, §§2.3–2.4.2, 2.10
- Ross, A First Course in Probability — chapter 3
Mentioned in
- Bayesian Bandits
- Classical Cryptography and Perfect Secrecy
- Continuous-Type Random Variables and Their Distributions
- Discrete Random Variables and Their Distributions
- Jointly Distributed Random Variables
- Kolmogorov Complexity
- Parameter Estimation and Binary Hypothesis Testing
- Stochastic Processes, Markov Chains, and Stochastic Bandits
- Universal Source Coding