Probability for Robotics · Theory · M1
M1-T2 — Events, Sample Spaces and the Rules of Probability
Three rules. Everything else in probability, from Bayes’ rule to the Kalman filter, is derived from them.
Before a robot can reason about uncertainty it has to say what could happen, and attach numbers to those possibilities in a way that never contradicts itself. This lesson builds that foundation: outcomes, events, and three axioms. From the axioms we derive the handful of rules you will use daily, and we see why “the probabilities must add up to one” is the statement “the robot is somewhere”.
Learning objectives
After this lesson, you should be able to:
- Describe an uncertain situation with a sample space of mutually exclusive, exhaustive outcomes.
- Express a question about a robot as an event, a set of outcomes.
- State the three axioms of probability and say what each means physically.
- Derive and use the complement rule, the addition rule for overlapping events and the union bound.
The intuition
Think of probability as one unit of belief that has to be shared out among everything that could happen. Nothing can receive a negative share, and the shares must use up exactly the whole unit, because something happens.
Take Rover's drive to the dock from the previous lesson. Watching 200 runs, the team sorted each one into exactly one of five bins:
Three ideas are already in this picture.
- The five bins are the outcomes. They do not overlap (a run cannot be both “left” and “short” if we define the bins carefully), and together they cover every run. One and only one of them happens.
- A question with a yes or no answer is an event: a set of outcomes. “Missed sideways” is the set {left, right}. “Did not dock” is {left, right, short, long}.
- The probability of an event is the total share of its outcomes. That is all “adding probabilities” means, and it is safe exactly when the pieces being added do not overlap.
Most mistakes with probability are mistakes about overlap: adding the probabilities of events that can happen together, or forgetting an outcome so that the shares no longer use up the whole unit.
Definitions
- Experiment
- Any process whose result is not known in advance: one drive to the dock, one range reading, switching the robot on at an unknown place.
- Outcome
- One complete result of the experiment, at the level of detail you chose to record.
- Sample space
- The set of all outcomes. Its members must be mutually exclusive (no two happen together) and exhaustive (one of them always happens).
- Event
- A subset of . The event “happens” when the outcome is one of its members.
- (complement)
- Everything in that is not in : “ does not happen”.
- (union)
- Outcomes in or in or in both: “at least one happens”.
- (intersection)
- Outcomes in both: “both happen”. If the events are disjoint (mutually exclusive).
- Partition
- A collection of events that are pairwise disjoint and whose union is . The outcomes themselves are the finest partition.
A probability assigns a number to every event and satisfies three axioms (due to Kolmogorov, 1933):
What each one says about a robot:
| Axiom | In words | Physical meaning |
|---|---|---|
| 1. Non-negativity | No event has a negative probability. | A share of belief cannot be less than nothing. Code that produces a negative probability has a bug, usually a subtraction that went wrong. |
| 2. Normalization | The whole sample space has probability 1. | Something in the list of outcomes happens: the robot is somewhere, the door is open or closed. This holds only if the list is complete. |
| 3. Additivity | Probabilities of events that cannot happen together add. | Shares of separate outcomes are separate. It is the only rule for combining probabilities that the axioms give, and it applies only without overlap. |
Notice what the axioms do not say: they do not tell you what the numbers are. Whether the probability of docking is 0.62 comes from data (a frequency) or from a model (a belief). The axioms only guarantee that whatever numbers you use are consistent with each other.
Derivation: the rules that follow from the axioms
Four rules are used constantly. None needs to be memorized as a separate fact: each follows from the axioms in a few steps.
The complement rule
By definition the complement holds exactly the outcomes that does not. Together they are everything, and they share nothing.
Axiom 3, because the two events are disjoint.
Their union is the sample space, and axiom 2 gives its probability.
Rearranged. It is often much easier to compute the probability that something does not happen.
Two quick consequences: taking gives , and since every probability satisfies .
A larger event is at least as probable
Split into the part inside and the part outside. The two parts are disjoint.
Axiom 3, then axiom 1 for the second term. This property is called monotonicity.
The addition rule for events that may overlap
The union is all of plus the part of that lies outside . These are disjoint.
Axiom 3, because the two parts are disjoint.
Split the same way and apply axiom 3 again.
Substitute. When the events are disjoint the last term is zero and the rule reduces to axiom 3.
The union bound
Since , dropping it can only make the right-hand side larger. Repeating the argument for more events gives:
Add probabilities only for events that cannot happen together. For events that can, subtract the overlap, or use the sum as a safe upper bound.
A worked example
Part 1: questions about a run. Use the outcome probabilities of the figure: docked 0.62, left 0.14, right 0.16, short 0.05, long 0.03. They are non-negative and sum to 1.00, so they form a valid probability.
- Missed sideways. . The outcomes are disjoint, so .
- Did not dock. The direct way adds four outcomes. The complement rule is shorter: .
- Stopped at the wrong distance. . Check: sideways 0.30 plus wrong distance 0.08 is 0.38, the same as “did not dock”, because those two events partition it.
Part 2: two sensors that can fire together. On a test course, in any one minute, Rover's bumper fires with probability 0.08 and its cliff sensor with probability 0.05. When Rover reaches a ledge with a raised lip, both fire: that happens with probability 0.02. The safety logic stops the robot if either fires. How often does it stop?
- Wrong. . This adds events that are not disjoint and counts the “both” minutes twice.
- Right. .
- No stop. By the complement rule, .
- If the overlap were unknown. The union bound still says the stop probability is at most 0.13, and monotonicity says it is at least 0.08 (the larger single event). The true 0.11 lies between.
from robotprob import Discrete
# Discrete checks the axioms: no negative share, total exactly 1.
runs = Discrete({'docked': 0.62, 'left': 0.14, 'right': 0.16, 'short': 0.05, 'long': 0.03})
print('P(missed sideways) =', round(runs.prob({'left', 'right'}), 2))
print('P(did not dock) =', round(1 - runs.p('docked'), 2))
print('P(wrong distance) =', round(runs.prob({'short', 'long'}), 2))
print('P(not long) =', round(runs.prob(lambda o: o != 'long'), 2))
p_bumper, p_cliff, p_both = 0.08, 0.05, 0.02
p_either = p_bumper + p_cliff - p_both # addition rule
print('P(bumper or cliff) =', round(p_either, 2))
print('P(neither) =', round(1 - p_either, 2))
print('union bound =', round(p_bumper + p_cliff, 2))P(missed sideways) = 0.3 P(did not dock) = 0.38 P(wrong distance) = 0.08 P(not long) = 0.97 P(bumper or cliff) = 0.11 P(neither) = 0.89 union bound = 0.13
prob as a set of outcomes or as a function that answers yes or no for each outcome.In robotics
A localization grid is a sample space
Divide a corridor into 100 cells of 10 cm. “Rover is in cell ” for are mutually exclusive and exhaustive outcomes, provided Rover is in the corridor. A belief is a list of 100 non-negative numbers that sum to 1. Axiom 2 is the reason every filter in this course ends its update with a normalization step: after new evidence is multiplied in, the numbers are rescaled so that they again sum to 1. M6-T2: Histogram Filters and Grid Localization builds this filter.
The same example shows the weak point of axiom 2. If someone carries Rover out of the corridor, the true outcome is not in the sample space, and the filter will still report a confident belief over 100 cells that sums to 1. This is the kidnapped robot problem. The cure is to make the sample space honest, for example by reserving some probability for “somewhere I have no model for” (M9-T4: Monte Carlo Localization in Practice).
Occupancy is a two-outcome sample space
A cell of an occupancy grid map is either occupied or free. By the complement rule only one number has to be stored: . M10-T1: Occupancy Grids and the Binary Bayes Filter builds the whole map from that one number per cell.
Safety budgets use the union bound
A hazard analysis lists the ways a system can fail dangerously: the estimator diverges, a sensor freezes, the brake command is late. The failures are not disjoint and their overlaps are rarely known. The union bound gives a guaranteed ceiling: if the three failure modes have probabilities of at most , and per hour, the probability of at least one is at most per hour. The UAV course applies this in fault tree analysis.
Defining the event is engineering work
“The grasp succeeded”, “the robot is localized”, “the landing was safe” are events only once someone has said precisely which outcomes they contain. Two teams that report a 95% success rate with different definitions of success have measured different events. Write the definition down before you count.
Common misconceptions
“The probability of A or B is P(A) + P(B).”
Only when A and B cannot happen together. In general the overlap P(A and B) must be subtracted. Adding the probabilities of overlapping events is how totals above 1 appear.
“The outcomes are equally likely.”
Nothing in the axioms says so. Dividing 1 by the number of outcomes is a model, appropriate for a fair die or for a robot that truly knows nothing about its starting cell, and wrong for the five outcomes of the docking run.
“The sample space is given by the problem.”
It is a modelling choice, and a different choice gives a different, equally valid description. Five bins, a 10 cm grid and a continuous position are all sample spaces for where Rover stopped. Choose the coarsest one that can still express the events you care about.
“My probabilities sum to 1, so my model is right.”
Summing to 1 shows only that the bookkeeping is consistent. If a real outcome is missing from the sample space, the model will still sum to 1 and still be wrong, confidently.
Key takeaways
- A sample space is a list of outcomes that are mutually exclusive and exhaustive. An event is a set of outcomes; a yes-or-no question about the robot is an event.
- The three axioms: probabilities are non-negative, the whole sample space has probability 1, and probabilities of disjoint events add.
- Complement rule: P(not A) = 1 − P(A). Use it whenever the opposite event is easier to compute.
- Addition rule: P(A or B) = P(A) + P(B) − P(A and B). The sum alone is an upper bound (the union bound).
- Normalization means “one of the listed outcomes is true”. A filter that normalizes over an incomplete list of outcomes is confidently wrong.
References and further reading
Each source is marked free or paid. Free to read does not mean free to reuse: the course resources page lists every source with its licence.
- J. Tsitsiklis and P. Jaillet, MIT RES.6-012 Introduction to Probability , lecture 1 (probability models and axioms). Free videos and notes, licence CC BY-NC-SA 4.0.
- J. Blitzstein and J. Hwang, Introduction to Probability, 2nd edition, CRC Press, 2019 , chapter 1. Free to read online; the book is copyrighted.
- S. Thrun, W. Burgard and D. Fox, Probabilistic Robotics, MIT Press, 2005, section 2.2 (Basic Concepts in Probability). Paid book.
- A. N. Kolmogorov, Foundations of the Theory of Probability, 1933 (English translation, Chelsea, 1950). The original statement of the axioms. Paid book.
- C. Piech, Probability for Computer Scientists (Stanford CS109 course reader) , part 1. Free to read online.
Knowledge check
Three questions. Write an answer, then reveal the explanation. Your answers stay in your browser.
Question 1
A lidar reports, for one beam, one of: a valid range, “no return” or “error”. Over a long log the frequencies are 0.93, 0.05 and 0.04. Can these three numbers be the probabilities of the three outcomes? What are the possible explanations?
Explanation
No: they sum to 1.02, which violates axiom 2 (with axiom 3, since the outcomes are supposed to be disjoint). Either the bins overlap (some beams were logged as both “no return” and “error”, so 0.02 was counted twice) or the frequencies were computed over different numbers of beams, or they were rounded badly. The fix is to define the outcomes so that every beam falls in exactly one bin and recount.
Question 2
A drone’s vision system loses tracking with probability 0.10 on a flight and its GPS drops out with probability 0.04. A report says the probability of losing at least one is 0.14. Under what condition is that exactly right, what can you say without that condition, and what is the probability of losing neither?
Explanation
The 0.14 is exact only if the two losses never occur on the same flight (disjoint events). In general P(either) = 0.10 + 0.04 − P(both). Without knowing the overlap, the union bound gives P(either) ≤ 0.14 and monotonicity gives P(either) ≥ 0.10. So the probability of losing neither is between 0.86 and 0.90. (Both failing together is plausible, for example indoors near windows, so the overlap should be measured.)
Question 3
A grid localizer over a warehouse map reports a belief that sums to 1 and has a sharp peak, yet the robot is in fact in a loading bay that is not on the map. Which axiom is “satisfied but misleading” here, and why?
Explanation
Axiom 2, normalization. It states that one of the outcomes in the sample space is true; the localizer enforces it by rescaling the belief to sum to 1. But the sample space (cells of the map) does not contain the true outcome, so the premise is false. The mathematics is consistent and the result is wrong. Only a sample space that includes “not on the map”, or an external check such as the measurement likelihood being very low everywhere, can reveal it.
What’s next
The axioms say how probabilities must fit together, not how to find them when no formula is at hand. The next lesson finds them by experiment: simulate the robot many times and count.
Related content
Nothing below is required to finish this lesson.
- BeforeM1-T1: Why Robots Need Probability
Name the sources of uncertainty in a robot and explain why a single best guess is not enough to act safely.
Other courses on this site treat neighbouring topics from their own angle:
Get notified when the next lesson and new labs are released.
One email per new lesson or lab.