Law of Total Probability (Discrete, From First Principles)
Short walkthrough of the law of total probability in the discrete setting, using notation common in TCS: a finite domain , distributions on , and events as subsets of .
1. Discrete distributions on a finite domain
Let be a finite domain of size , .
A discrete distribution on is a function
such that
For an event , define
Two basic rules:
-
Additivity for disjoint events
If are pairwise disjoint, then -
Conditional probability (with ):
Rewriting:
2. Partitions and the law of total probability
A family of events is a partition of if
- for all (disjoint),
- (they cover the domain).
Exactly one holds for each .
Take any event . Because the cover ,
and the sets are disjoint.
By additivity,
Using , we get
This is the law of total probability in this notation:
3. Coin example in this notation
We define the randomness of the process as a distribution over a finite domain .
Setup
There are two coins:
- Coin (fair):
- Coin (biased):
Step 1: pick a coin.
Step 2: flip the chosen coin once.
Define the domain
The distribution on is:
Check:
We care about the event
Then
Now let’s express the same calculation using the law of total probability.
Using a partition
Define events in :
- : “coin is ”
- : “coin is ”
is a partition of .
We have:
Apply the law:
Same result, but now written as a sum of conditional probabilities over a partition.
4. Randomized algorithms: how to use this
View the randomness of an algorithm as a distribution over a finite domain (all possible random choices, random bits, etc.).
Let:
- be a partition encoding cases:
e.g. “pivot is good”, “pivot is bad”, or “hash function is ”. - be the event that the algorithm succeeds (or runs in time , etc.).
Then
Decompose larger probability into smaller conditional pieces:
- Partition into cases :
e.g. “Case 1: pivot is good”, “Case 2: pivot is bad”. - For each case , compute or bound .
- Compute or bound .
- Plug into
This is exactly the law of total probability applied to the distribution induced by the algorithm’s randomness.
5. Summary
- Fix a finite domain and a distribution on it.
- Choose a partition of .
- For any event , write with disjoint.
- Use additivity:
- Use conditional probability:
- Combine: