Complement rule
The complement rule states that the probability of an event’s complement is one minus the probability of the event.
Statistics Every Programmer Needs
The complement rule calculates the probability of an event by subtracting the probability of that event's complement from one.
- How it is used
- Calculates desired-event probabilities efficiently when their complementary outcomes are easier to enumerate.
- How deep it goes
- Defines the formula and works through dice examples, stopping short of formal proof or broader distribution theory.
- Examples
- Uses two dice for at-least-one-four and bounded-sum problems, with short Python calculations for the first example.
- What you can do after
- Apply the complement rule to shorten probability calculations and implement repeated complement probabilities in Python.
Read how Statistics Every Programmer Needs explains complement rule →
Grokking Machine Learning, Second Edition
The complement rule states that the probability of an event's opposite is one minus the probability of the event.
- How it is used
- Uses complements to supply missing probabilities while calculating whether an email containing “lottery” is spam.
- How deep it goes
- Defines the rule and works through unconditional and conditional email probabilities, then applies them within a larger calculation.
- Examples
- Uses spam and ham emails, the word “lottery,” probability fractions, and a tree of possible outcomes.
- What you can do after
- Evaluate missing event probabilities by subtracting the known probability from one.
Read how Grokking Machine Learning, Second Edition explains complement rule →
Timeless Algorithms, The Foundational Ideas
The complement rule states that the probability of an event not occurring is one minus the probability of that event occurring.
- How it is used
- Supports Bayesian inference as one of the probability rules used to quantify and combine uncertainty.
- How deep it goes
- Defines the rule and works through a dice example, using independence to calculate the complement; it does not develop broader applications.
- Examples
- Uses two fair six-sided dice to calculate the chance of rolling at least one 4.
- What you can do after
- Evaluate/understand how calculating an event's complement can simplify a probability calculation.
Read how Timeless Algorithms, The Foundational Ideas explains complement rule →
What to know first
- addition ruleThe addition rule determines the total count or probability of mutually exclusive alternatives by summing their individual counts or probabilities.
- mutually exclusive eventMutually exclusive events are events that cannot occur simultaneously and have no outcomes in common.
- probability theoryProbability theory is the mathematical framework for quantifying and reasoning about uncertainty in events, variables, and outcomes.
Related concepts
- complementuses · The complement of a set or event is the subset of a specified universe containing all elements or outcomes not in that set or event.
- probability theoryuses · Probability theory is the mathematical framework for quantifying and reasoning about uncertainty in events, variables, and outcomes.
- multiplication ruleuses · The multiplication rule determines a combined count or probability by multiplying the numbers of choices or the relevant probabilities at successive stages.
Questions about complement rule
What is complement rule?
The complement rule states that the probability of an event’s complement is one minus the probability of the event.
Which Manning books explain complement rule?
Statistics Every Programmer Needs, Grokking Machine Learning, Second Edition and Timeless Algorithms, The Foundational Ideas.
What should I know before learning complement rule?
Manning books that teach complement rule usually introduce addition rule, mutually exclusive event and probability theory first.
What is complement rule a kind of?
Complement rule is a kind of probability rule. A probability rule is a mathematical rule for calculating or relating probabilities of events.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


