Recommended resources
The freely available resources this lesson will direct you to.
Introduction
Welcome to our first lesson on probability theory. In the previous modules, we built a robust toolkit from linear algebra and multivariable calculus, culminating in the ability to find and classify the extrema of complex functions. This was a journey through a deterministic world where functions and their properties were precisely known. Now, we pivot to the realm of uncertainty.
Machine learning and artificial intelligence are fundamentally about building models that can reason and make predictions from incomplete or noisy data. To do this, we need a formal language to quantify uncertainty, update our beliefs, and define the very objectives our optimization algorithms, like gradient descent, will target. That language is probability theory.
This lesson lays the groundwork. We will start from the 'first principles' of probability—the axioms that govern the entire field—and build up to the essential concepts of conditional, joint, and marginal probability. These rules form the grammar for reasoning under uncertainty, a skill that is indispensable for everything that follows, from understanding loss functions to developing advanced generative models.
The Axiomatic Foundation of Probability
Just as geometry is built on axioms about points and lines, probability theory is built on a simple set of rules governing sets and numbers. These rules, known as the Kolmogorov Axioms, provide a rigorous foundation for everything we will do. The core idea is to define a probability space, which consists of three components:
- Sample Space (): The set of all possible outcomes of an experiment. For a single die roll, .
- Event Space (): A collection of subsets of , which we call "events". An event is a set of outcomes we might be interested in. For a die roll, the event "the result is even" corresponds to the set .
- Probability Measure (): A function that assigns a real number between 0 and 1 to every event in . is the "probability of event A".
The following video from Harvard's Statistics 110 course, taught by Prof. Joseph Blitzstein (whose book you are reading), introduces this formal definition and the two essential axioms that the probability measure must satisfy.
Lecture 2: Story Proofs, Axioms of Probability | Statistics 110
This video, "Lecture 2: Story Proofs, Axioms of Probability," introduces the formal, "non-naive" definition of probability.
First, watch the segment that sets up the concept of a probability space, moving beyond simple, equally-likely outcomes. Pay attention to the introduction of the sample space S and the probability function P from this section. Next, watch the crucial explanation of the two axioms of probability from this part. These are the fundamental rules from which all other properties of probability are derived.
To summarize and formalize what you just saw, the axioms are:
- Non-negativity: For any event , .
- Normalization: The probability of the entire sample space is 1, i.e., . This means some outcome must occur.
- Additivity: For any countable collection of pairwise disjoint events (meaning for ), the probability of their union is the sum of their individual probabilities:
For a more formal and textual reinforcement of these ideas, you can review the following resource.
These lecture notes from Durham University provide a concise, mathematical summary of the axioms.
Please read section 1.5, "The axioms of probability." Focus on the key definition of probability and the axioms (A1)-(A3). You can also look at the more technical version (A4) which corresponds to what was discussed in the video.
Now for your first challenge. Using only the three axioms above, can you prove that for any event , its probability cannot exceed 1 (i.e., )? Hint: Consider the event and its complement, . What is their relationship? What do you know about their union?
Joint, Conditional, and Marginal Probability
With the axioms in place, we can now define the key relationships between events that form the core of probabilistic reasoning.
Joint Probability
The joint probability of two events, or , is simply the probability that both events occur. In a Venn diagram, this is the area of their intersection.
Conditional Probability
This is perhaps the most important concept in all of statistics. The conditional probability of given , written , is the probability that event occurs, given that we know event has already occurred.
The definition is:
Intuitively, knowing that occurred restricts our sample space from the original to just the outcomes in . We then "renormalize" the probability of the part of that is also in (i.e., ) by the probability of this new, smaller universe, .
Prof. Blitzstein offers a fantastic philosophical motivation and two powerful intuitions for this definition.
Lecture 4: Conditional Probability | Statistics 110
In "Lecture 4: Conditional Probability," Prof. Blitzstein frames conditioning as the core of scientific reasoning and then provides the mathematical definition.
First, watch the segment from this part for the motivation. He describes conditioning as the process of updating beliefs with new evidence, calling it "the soul of statistics." Then, watch from this section for the formal definition and two intuitive explanations: the 'pebble world' analogy (restricting the sample space) and the 'frequentist' view (long-run frequencies).
Marginal Probability
The marginal probability is just the standard, "unconditional" probability of a single event, like . The term "marginal" comes from how it's calculated in a table of joint probabilities. To find the probability of one event, we sum over all possible outcomes of the other event. This is an application of the Law of Total Probability. If a set of events forms a partition of the sample space (they are disjoint and their union is ), then:
Using the definition of conditional probability, this becomes the more common form:
The image below provides a perfect visualization for these three concepts in a discrete setting. The numbers in the center of the table are the joint probabilities. The numbers in the margins are the marginal probabilities, obtained by summing the rows or columns. A conditional probability could be found by, for example, dividing a joint probability by a marginal probability (e.g., ).

For continuous variables, the same concepts apply, but summation is replaced by integration. The image below provides the continuous analog. The contours represent the joint probability density. Slicing the distribution vertically gives a conditional density (the bell curve labeled "conditional density of y, given x=x₀"). Projecting the distribution onto an axis gives a marginal density.

Independence
Two events and are independent if the occurrence of one does not affect the probability of the other. Formally, this means . Plugging this into the definition of conditional probability gives us the standard test for independence:
It is critical not to confuse independent events with disjoint events. Disjoint events have no outcomes in common (), so . If you know a disjoint event occurred (and ), you know with certainty that did not occur. This makes them highly dependent.
The following resource provides clear definitions and examples to solidify these concepts.
Let's return to the Durham lecture notes for the formal definitions of these rules.
First, read Section 3.1, "Conditional probability", which defines conditional probability and gives several examples. Next, read Section 3.3, "Independence of events". Pay close attention to the formal definition of independence and the author's explicit warning: "Never confuse disjoint with independent".
The Multiplication Rule and Bayes' Rule
Two simple but powerful theorems follow directly from the definition of conditional probability.
-
The Multiplication Rule: By rearranging the definition , we get a formula for the joint probability:
By symmetry, it's also true that . This rule is essential for calculating the probability of a sequence of events.
-
Bayes' Rule: Since both expressions for the multiplication rule equal , we can set them equal to each other:
Dividing by gives the famous Bayes' Rule:
This rule is the engine of Bayesian statistics. It tells us how to "invert" our conditional probabilities—how to update our belief in event () after observing event , using our prior belief in () and the likelihood of observing if were true ().
Prof. Blitzstein derives both of these rules very quickly in the final segment of the lecture.
Lecture 4: Conditional Probability | Statistics 110
This final clip from Lecture 4 derives these two fundamental rules.
Watch from this segment to see the effortless derivation of the multiplication rule and Bayes' rule directly from the definition of conditional probability.
Now for a classic problem that tests your understanding of these rules.
Imagine a test for a rare disease. Only 1 in 10,000 people have the disease. The test is very good, but not perfect.
- It correctly identifies 99% of people who have the disease (99% sensitivity).
- It correctly identifies 99% of people who do not have the disease (99% specificity). This means it has a 1% "false positive" rate.
A person is chosen at random and tests positive. Before you calculate, what is your intuition—is it almost certain they have the disease, a 50/50 chance, or something else? Now, use the rules we've learned to calculate the actual probability that this person has the disease, given they tested positive.
Conclusion
In this lesson, we established the formal language of probability. We started from the fundamental axioms and used them to define and explore the relationships between events. These concepts are not just abstract mathematical rules; they are the tools we use to model the world and update our knowledge in the face of new data.
Key Takeaways:
- Probability theory is built upon three simple axioms: non-negativity, normalization, and additivity for disjoint events.
- Joint Probability is the probability of and both occurring.
- Conditional Probability is the updated probability of given that is known to have occurred.
- Marginal Probability is the overall probability of an event, which can be found by summing or integrating joint probabilities over all other events (the Law of Total Probability).
- Two events are independent if , which implies .
- Bayes' Rule, , provides a mechanism for inverting conditional probabilities and forms the basis of Bayesian inference.
Preview of the Next Lesson:
We will move from abstract events to random variables. A random variable is a function that assigns a numerical value to each outcome in the sample space. This is the crucial step that allows us to connect probability theory to the numerical data used in machine learning. We will explore how to describe the behavior of discrete random variables with Probability Mass Functions (PMFs) and continuous random variables with Probability Density Functions (PDFs).