What Is Probability?
local graph
When going about our lives, we almost always think in binary terms. A statement is either true or false. An outcome has either occurred or not.
In practice, we rarely have the comfort of certainty. We have to operate with incomplete information. When a scientist observes the outcome of an experiment, can they verify their hypothesis with 100% certainty? No. Because they do not have complete control over all the variables (such as the weather or the alignment of stars), the observed effect might be unintentional. Each result will either strengthen or weaken our belief in the hypothesis, but none will provide ultimate proof.
In machine learning, our job is not simply to provide a prediction about some class label but to formulate a mathematical model that summarizes our knowledge about the data in a way that conveys information about the degree of our certainty in the prediction.
So, fitting a parametric function f : ℝn →ℝm to model the relation between the data and the variable to be predicted is not enough. We will need an entirely new vocabulary to formulate such models. We need to think in terms of probabilities.
Bookmark
18.1 The language of thinking
Section titled “18.1 The language of thinking”First, let’s talk about how we think. On the most basic level, our knowledge about the world is stored in propositions. In a mathematical sense, a proposition is a declaration that is either true or false. (In binary terms, true is denoted by 1 and false is denoted by 0.)
“The sky is blue.”
“There are infinitely many prime numbers.”
“1 + 1 = 3.”
“I got the flu.”
Propositions are often abbreviated as variables such as A = ”it’s raining outside”.
Determining the truth value of a given proposition using evidence and reasoning is called inference. To be able to formulate valid arguments and understand how inference works, we’ll take a quick visit to the world of mathematical logic.
18.1.1 Thinking in absolutes
Section titled “18.1.1 Thinking in absolutes”So, we have propositions such as A = ”it’s raining outside” or B = ”the sidewalk is wet”. We need more expressive power: propositions are building blocks, and we want to combine them, yielding more complex propositions. (We’ll review the fundamentals of mathematical logic here, but check out Appendix A for more.)
We can formulate complex propositions from simpler ones with logical connectives. Consider the proposition “if it is raining outside, then the sidewalk is wet”. This is the combination of A and B, strung together by the implication connective.
There are four essential connectives:
- NOT (¬), also known as negation,
- AND ( ∧), also known as conjunction,
- OR (∨), also known as disjunction,
- THEN (→), also known as implication.
Connectives are defined by the truth values of the resulting propositions. For instance, if A is true, then ¬A is false; if A is false, then ¬A is true. Denoting true by 1 and false by 0, we can describe connectives with truth tables. Here is the one for negation:

AND (∧) and OR (∨) connect two propositions. A ∧B is true if both A and B are true, while A ∨B is true if either one is.

The implication connective THEN (→) formalizes the deduction of a conclusion B from a premise A. By definition, A →B is true if B is true or both A and B are false. An example: IF “it’s raining outside”, THEN “the sidewalk is wet”.

Note that A →B does not imply B →A. This common logical fallacy is called affirming the consequent, and we’ve all fallen victim to it at some point in our lives. To see a concrete example: if “it’s raining outside”, then “the sidewalk is wet”, but not the other way around. The sidewalk can be wet for other reasons, such as someone spilling a barrel of water.
Connectives correspond to set operations. Why? Let’s take a look at the formal definition of set operations.
Definition 75. (The (reasonably) formal definition of set operations and relations)
Let A and B be two sets.
(a) The union of A and B is defined by

that is, A ∪B contains all elements that are in A or B.
(b) The intersection of A and B is defined by

that is, A ∩B contains all elements that are in A and B.
(c) We say that A is a subset of B, that is, A ⊆B if

is true for all x ∈A.
(d) The complement of A with respect to an Ω ⊃A is defined by

that is, Ω ∖A contains all elements that are in Ω, but not in A.
If you carefully read through the definitions, you can see how connectives and set operations relate. ∧ is intersection, ∨ is union, ¬ is the complement, and → is the subset relation. This is illustrated by Figure 18.1. (I’ve slightly abused the notation here, as statements such as A ∧B ⟺ A ∩B are mathematically incorrect. A and B cannot be a proposition and a set at the same time, thus the equivalence is not precise. )

Figure 18.1: Connectives and set operations
Why is this important? Because probability operates on sets, and sets play the role of propositions. We’ll see this later, but first, let’s dive deep into how mathematical logic formalizes scientific thinking.
Let’s refine the inference process of mathematical logic. A proposition is either true or false, fair and square. How can we determine that in practice? For example, how do we find the truth value of the proposition “there are infinitely many prime numbers“?
By using evidence and deduction. Like Sherlock Holmes solving a crime by connecting facts, we rely on knowledge of the form “if A, then B“. Our knowledge about the world is stored in true implications. For example:
- “If it is raining, then the sidewalk is wet.“
- “If is a right triangle, then A2 + B2 = C2.“
- “If a system is closed, then its entropy cannot decrease.“
As we have seen, the implication can be translated into the language of set theory (as all the other connectives). While ∧ corresponds to intersection and ∨ to union, the implication is the subset relation. Keep this in mind, as it’s going to be important.
During inference, we use implications in the following way:
- If A, then B.
- A.
- Therefore, B.
This is called the modus ponens. If it sounds abstract, here is a concrete example:
- If it is raining, the sidewalk is wet.
- It is raining.
- Therefore, the sidewalk is wet.
Thus, we can infer the state of the sidewalk without looking at it. This is bigger than it sounds: modus ponens is a cornerstone of scientific thinking. We would still be living in caves without it. Modus ponens enables us to build robust skyscrapers of knowledge.
However, it’s not all perfect. Classical deductive logic might help to prove the infinity of prime numbers, but it fails spectacularly when confronted with inference problems outside the realms of mathematics and philosophy.
Classical logic has a fatal flaw: it is unable to deal with uncertainty. Think about the simple proposition “it is raining outside”. If we are unable to actually observe the weather but have some indirect evidence (such as the fact that the sidewalk is wet, or the sky is cloudy, or it’s autumn out there), “it is raining outside” is probable but not certain.
We need a tool to measure the truth value on a 0 − 1 scale. This is where probabilities come in.
18.1.2 Thinking in probabilities
Section titled “18.1.2 Thinking in probabilities”In a mathematical sense, probability is a function that assigns a numerical value between zero and one to various sets that represent events. (You can think of events as propositions.) Events are subsets of the event space, often denoted with the capital Greek letter omega (Ω). This is illustrated in Figure 18.2.

Figure 18.2: Events and the event space
This sounds quite abstract, so let’s see a simple example: rolling a fair six-sided dice. We can encode all possible outcomes with the event space Ω = {1,2,3,4,5,6}. Events such as A = ”the outcome is even” or B = ”the outcome is larger than 3” are represented by the sets

As the dice is fair, the probability of each outcome is the same:

There are two properties that make such a function P a proper measure of probability:
- the probability of the event space is one,
- and the probability of the union of disjoint events is the sum of probabilities.
In our dice-rolling example, this is translated to, for instance,

We’ll talk about these properties extensively in the next section. As logical connectives can be represented in the language of set theory, set operations translate the semantics of logic into probabilities. Intersection is joint occurrence of events. Union is the occurrence of either one.

Figure 18.3: The probabilities of intersection and union
In this way, we are able to build models involving uncertainty and develop a calculus to work with said models. In the Tower of Babel that is mathematics, statistics deals with the modeling part, and probability theory deals with the calculus part.
Even technically well-trained engineers conflate modeling and working with models. For instance, when we talk about flipping fair coins, the probability of heads and tails are both 1∕2. Even when we are absolutely sure about the model but have ten heads in a row, most would immediately jump to the conclusion that our coin is biased.
To make sure we are not making this mistake, first, we are going to learn what probability is.
Bookmark
18.2 The axioms of probability
Section titled “18.2 The axioms of probability”In the previous section, we have talked about probability as an extension of mathematical logic. Just like formal logic, probability has its axioms, which we need to understand to work with probability models. Now, we are going to seek the answer to a fundamental question: what is the mathematical model of probability and how do we work with it?
Probabilities are defined in the context of experiments and outcomes. To talk about probabilities, we need to define what we assign probabilities to. Formally speaking, we denote the probability of the event A by P(A). First, we’ll talk about what events are.
18.2.1 Event spaces and σ-algebras
Section titled “18.2.1 Event spaces and σ-algebras”Let’s revisit the six-sided example from the previous section. There are six different mutually exclusive outcomes (that is, events that cannot occur at the same time), and together they form the event space, denoted by Ω:

In general, the event space is the collection of all mutually exclusive outcomes. It can be any set.
What kind of events can we assign probabilities to? Obviously, the individual outcomes come to mind. However, we can think of events such as “the result is an odd number”, “the result is 2 or 6”, or “the result is not 1”. Following this logic, our expectations are that for any two events A and B,
- “A or B”,
- “A and B”,
- and “not A”
are events as well. These can be translated to the language of set theory and are formalized by the notion of σ-algebras.
Definition 76.
(σ-algebras)
Let Ω be an event space. A collection of its subsets Σ ⊆ 2Ω is called an σ-algebra over Ω if the following properties hold:
(a) Ω ∈ Σ. (That is, the set of all outcomes is an event.)
(b) For all A ∈ Σ, the set Ω∖A is also an element of Σ. (That is, σ-algebras are closed to complements.)
(c) For all A1,A2,⋅⋅⋅∈ Σ, the set ∪n=1∞An is also an element of Σ. (That is, σ-algebras are closed to unions.)
Since events are modeled by sets, logical concepts such as “and”, “or”, and “not” can be translated into set operations:
- the joint occurrence of events A and B is equivalent to A ∩B,
- “A or B” is equivalent to A ∪B,
- and “not A” is equivalent to Ω ∖A.
An immediate consequence of the definition is that, for any events A1,A2,⋅⋅⋅∈ Σ, their intersection ∩n=1∞An is also a member of Σ. Indeed, as De Morgan’s laws (Theorem 153) suggest,

Since Ω ∖ (Ω ∖A) = A, we have

Thus, the defining properties of σ-algebras guarantee that ∩n=1∞An is indeed an element of Σ. Another immediate consequence of the definition is that since Ω ∈ Σ, the empty set ∅ is also a member of Σ.
At first glance, σ-algebras seem a bit abstract. As usual, a bit of abstraction now will pay us huge dividends later in our studies. To bring this concept closer, here is a summary of σ-algebras in English:
- The set of all possible outcomes is an event.
- For any event, it not occurring is an event as well.
- For any events, their joint occurrence is an event as well.
- For any events, at least one of them occurring is an event as well.
Now that we have the formal definition under our belt, let’s see the first example.
Example 1. Rolling a six-sided dice. There, the σ-algebra is simply the power set of the event space:

(Recall that the power set of A is the set 2A containing all subsets of A, as defined in Definition 108.) Even though this is one of the simplest examples, it will serve as a prototype and a building block for constructing more complicated event spaces.
Example 2. Tossing a coin n times. A single toss has two possible outcomes: heads or tails. For simplicity, we are going to encode heads with 0 and tails with 1. Since we are tossing the coin n times, the result of an experiment will be an n-long sequence of ones and zeros, like this: (0,1,1,1,…,0,1). Thus, the complete event space is Ω = {0,1}n.
(We are not talking about probabilities just yet, but feel free to spend some time figuring out how to assign them to these events. Don’t worry if this is not clear; we will go through it in detail.)
As in the previous example, the σ-algebra 2Ω is a good choice. This covers all events that we need, for instance, “the number of tails is k”.
In practice, σ-algebras are rarely given explicitly. Sure, for simple cases such as the above, it is possible.
What about cases where the event spaces are not countable? For instance, suppose that we are picking a random number between 0 and 1. Then, Ω = [0,1], but selecting Σ = 2[0,1] is extremely problematic. Recall that we want to assign a probability to every event in Σ. The power set 2[0,1] is so large that very strange things can occur. In certain scenarios, we can cut up sets into a finite number of pieces and reassemble two identical copies of the set from its pieces. (If you are interested in more, check out the Banach-Tarski paradox.)
To avoid weird things like the above-mentioned, we need another way to describe σ-algebras.
18.2.2 Describing σ-algebras
Section titled “18.2.2 Describing σ-algebras”Let’s start with a simple yet fundamental property of σ-algebras that we’ll soon use to give a friendly description of σ-algebras.
Theorem 109. (Intersection of event algebras.)
Let Ω be a sample space, and let Σ1 and Σ2 be two σ-algebras over it. Then Σ1 ∩ Σ2 is also a σ-algebra.
Proof. As we saw in the definition of σ-algebras (Definition 76), there are three properties we need to verify to show that Σ1 ∩ Σ2 is indeed a σ-algebra. This is very simple to check, so I suggest taking a shot by yourself first before reading my explanation.
(a) As both Σ1 and Σ2 are σ-algebras, Ω ∈ Σ1 and Ω ∈ Σ2 both hold. Thus, by definition of the intersection, Ω ∈ Σ1 ∩ Σ2.
(b) Let A ∈ Σ1 ∩ Σ2. As both of them are σ-algebras, Ω ∖A ∈ Σ1 and Ω ∖A ∈ Σ2. Thus, Ω ∖A is an element of the intersection as well.
(c) Let A1,A2,⋅⋅⋅ ∈ Σ1 ∩ Σ2 be arbitrary events. We can use the exact same argument as before: since both Σ1 and Σ2 are σ-algebras, we have

So, the union is also a member of the intersection, i.e.,

With all that, we are ready to describe σ-algebras with a generating set.
Theorem 110. (Generated σ-algebras)
Let Ω be an event space and S ⊆ 2Ω be an arbitrary collection of its sets. Then there is an unique smallest σ-algebra σ(S) that contains S.
(By smallest, we mean that if Σ is an σ-algebra containing S, then σ(S) ⊆ Σ.)
Proof. Our previous result shows that the intersection of σ-algebras is also an σ-algebra. So, let’s take all σ-algebras that contain S and take their intersection. Formally, we define

By definition, σ(S) is clearly the smallest, and it also contains S.
It’s also clear that the generated σ-algebra is unique as, if there would be another σ̂(S) satisfying the conditions, then due to the construction, σ̂ (S) ⊆σ(S) and σ(S) ⊆σ̂(S), hence σ̂(S) = σ(S).
Right away, we can use this to precisely construct the σ-algebra for an extremely common task: picking a number between 0 and 1.
Example 3. Selecting a random number between 0 and 1. It is clear that the event space is Ω = [0,1]. What about the events? In this situation, we want to ask questions such as the probability of a random number X falling between some a,b ∈ [0,1]. That is, events such as (a,b),(a,b],[a,b),[a,b] (whether or not we want strict inequality regarding a and b).
So, a proper σ-algebra can be given by the algebra generated by events of the form (a,b]. That is,
![Σ = σ({(a,b] : 0 ≤ a <b ≤ 1}). ](https://static.packt-cdn.com/products/9781837027873/graphics/media/file1634.png)
This Σ has a rich structure. For instance, it contains simple events such as {x}, where x ∈ [0,1], but also more complex ones such as “X is a rational number” or “X is an irrational number”. Give yourself a few minutes to see why this is true. Don’t worry if you don’t see the solution—we’ll work this out in the problems section. (If you think this through, you’ll also see why we chose intervals of the form (a,b] instead of others such as (a,b) or [a,b].)
18.2.3 σ-algebras over real numbers
Section titled “18.2.3 σ-algebras over real numbers”From all the examples we have seen so far, it is clear that most commonly, we define probability spaces on ℕ or on ℝ. When Ω ⊆ℕ, the choice of σ-algebra is clear, as Σ = 2Ω will always work.
However, as suggested in Example 3 above, selecting Σ = 2Ω when Ω ⊆ℝ can lead to some weird stuff. Because we are interested in the probability of events such as [a,b], our standard choice is going to be the generated σ-algebra
ℬ(ℝ) = σ({ (a,b) : a,b ∈ ℝ }), (18.1)
called the Borel algebra, named after the famous French mathematician Émile Borel. Due to its construction, ℬ contains all events that are important to us, such as intervals and unions of intervals. Elements of ℬ are called Borel sets.
Because σ-algebras are closed to unions, you can see that all types of intervals can be found in ℬ(ℝ). This is summarized by the following theorem.
Theorem 111.
For all a,b ∈ℝ, the sets [a,b], (a,b], [a,b), (−∞,a], (−∞,a), (a,∞), and [a,∞) are elements of ℬ(ℝ).
As an exercise, try to come up with the proof by yourself. One trick to get the ideas flowing is to start drawing some figures. If you can visualize what happens, you’ll discover a proof quickly.
Proof. In general, for a given set S, we can show that it belongs to ℬ(ℝ) by writing it as the union/intersection/difference of known Borel sets. First, we have

so (a,∞) ∈ ℬ(ℝ). With a similar argument, we see that (−∞,a) ∈ ℬ(ℝ).
Next,
![(− ∞, a] = ℝ ∖ (a,∞ ), a,∞ ) = ℝ ∖ (− ∞, a),
so (−∞,a],[a,∞) ∈ ℬ(ℝ) for all a. From these, the sets [a,b],(a,b],[a,b) can be produced by intersections.
Now that we understand what events and σ-algebras are, we can take our first detailed look at probability. In the next section, we will introduce its precise mathematical definition.
18.2.4 Probability measures
Section titled “18.2.4 Probability measures”Let’s recap what we have learned so far! In the language of mathematics, experiments with intrinsic uncertainty are described using outcomes, event spaces, and events.
The collection of all possible mutually exclusive outcomes of an experiment is called the event space, denoted by Ω. Certain subsets of Ω are called events, to which we want to assign probabilities.
These events form what is known as a σ-algebra, denoted by Σ. We denote the probability of an event A by P(A).
Intuitively speaking, we have three reasonable expectations about probability:
- P(Ω) = 1, that is, the probability that at least one outcome occurs is 1. In other words, our event space is a complete description of the experiment.
- P(∅) = 0, that is, the probability that none of the outcomes occur is 0. Again, this means that our event space is complete.
- The probability that either of two events occurs for two mutually exclusive events is the sum of the individual probabilities.
These are formalized by the following definition.
Definition 77. (Probability measures and spaces) Let Ω be an event space and Σ be an σ-algebra over Ω. We say that the function P : Σ → [0,1] is a probability measure on Σ if the following properties hold:
(a) P(Ω) = 1.
(b) If A1,A2,… are mutually disjoint events (that is, Ai∩Aj = ∅ for all i≠j), then P(∪n=1∞An) = ∑ n=1∞P(An). This property is called the σ-additivity of probability measures.
Along with the probability measure P, the structure (Ω,Σ,P) is said to form a probability space.
As usual, let’s see some concrete examples first! We are going to continue with the ones we worked out when discussing σ-algebras.
Example 1, continued. Rolling a six-sided dice. Recall that the event space and algebra were defined by

If we don’t have any extra knowledge about our dice, it is reasonable to assume that each outcome is equally probable. That is, since there are six possible outcomes, we have

Notice that, in this case, knowing the probabilities for the individual outcomes is enough to determine the probability of any event. This is due to the (σ-)additivity of the probability. For instance, the event “the outcome of the dice roll is an odd number” is described by

In English, the probability of any event can be written down with the following formula:

You might remember this from your elementary and high school studies (depending on the curriculum in your country). This is a useful formula, but there is a caveat: it only works if we assume that each outcome has an equal probability.
In the case when our dice is not uniformly weighted, the occurrences of individual outcomes are not equal. (Just think of a lead dice, where one side is significantly heavier than the others.) For now, we are not going to be concerned with this case. Later, this generalization will be discussed in detail.
Example 2, continued. Tossing a coin n times. Here, our event space and algebra was Ω = {0,1}n and Σ = 2Ω. For simplicity, let’s assume that n = 5.
What is the probability of a particular result, say HHTTT? Going step by step, the probability that the first toss will be heads is 1∕2. That is,

Since the first toss is independent of the second,

as well. To combine this and calculate the probability that the first two tosses are both heads, we can think in the following way. Among the outcomes where the first toss is heads, exactly half of them will have the second toss heads as well. So, we are looking for the half of the half. That is,

Going further with the same logic, we obtain

If we look a bit deeper, we will notice that this follows the previously seen “favorable/all” formula. Indeed, as we can see with a bit of combinatorics, there are 25 total possibilities, all of them having equal probability.
Considering this, what is the probability that out of our five tosses, exactly two of them are heads? In the language of sets, we can encode each five-toss experiment as a subset of {1,2,3,4,5}, the elements signifying the toss that resulted in heads. (So, for example, {1,4,5} would encode the outcome HTTHH.) With this, the experiments when there are two heads are exactly the two-element subsets of {1,2,3,4,5}.
From our combinatorics studies, we know that the number of subsets with given elements is

where n is the size of our set and k is the desired size of the subsets. So, in total, there are
number of occurrences with exactly two heads. Thus, following the “favorable/all” formula, we have

One more example, and we are ready to move forward.
Example 3, continued. Selecting a random number between 0 and 1. Here, our event space was Ω = [0,1], and our σ-algebra was the generated algebra
![ ( ) Σ = σ {(a,b] : 0 ≤ a <b ≤ 1} . ](https://static.packt-cdn.com/products/9781837027873/graphics/media/file1650.png)
Without any further information, it is reasonable to assume that every number can be selected with an equal probability. What does this even mean for an infinite event space such as Ω = [0,1]? We can’t divide 1 into infinitely many equal parts.
So, instead of thinking about individual outcomes, we should start thinking about events. Let’s denote our randomly selected number with X. If all numbers are “equally likely”, what is P(X ∈ (0,1∕2])? Intuitively, given our equally likely hypothesis, this probability should be proportional to the size of [0,1∕2]. Thus,

where I is some interval and jIj is its length. For instance,

By giving the probabilities on the generating set of the σ-algebra, the probabilities for all other events can be deduced. For instance,

Thus, the probability of picking a given number is zero. There is an important lesson here: events with zero probability can happen. This sounds counterintuitive at first, but based on the above example, you can see that it is true.
18.2.5 Fundamental properties of probability
Section titled “18.2.5 Fundamental properties of probability”Now that we are familiar with the mathematical model of probability, we can start working with them. Manipulating expressions of probabilities gives us the ability to deal with complex scenarios.
If you recall, probability measures had three simple defining properties (see Definition 77):
(a) P(Ω) = 1,
(b) P(∅) = 0, and
(c) P
= ∑ n=1∞P(An), if the events An are mutually disjoint.
From these properties, many others can be deduced. For simplicity, here is a theorem summarizing the most important ones.
Theorem 112.
Let (Ω,Σ,P) be a probability space and let A,B ∈ Σ be two arbitrary events.
(a) P(A ∪B) = P(A) + P(B) −P(A ∩B).
(b) P(A) = P(A ∩B) + P(A ∖B). Specifically, P(Ω ∖A) + P(A) = 1.
(c) If A ⊆B, then P(A) ≤P(B).
The proof of this is so simple that it is left to you as an exercise. All of these follow from the additivity of probability measures with respect to disjoint events. (If you don’t see the solution, sketch some Venn diagrams!)
Another fundamental tool is the law of total probability, which is used all the time when dealing with more complex events.
Theorem 113. (Law of total probability)
Let (Ω,Σ,P) be a probability space and let A ∈ Σ be an arbitrary event. If A1,A2,⋅⋅⋅∈ Σ are mutually disjoint events (that is, Ai ∩Aj = ∅if i≠j) for which ∪n=1∞An = Ω, then
P(A) = ∑n=1∞ P(A ∩ An). (18.2)
We call mutually disjoint events whose union is the entire event space partitions.
Proof. This simply follows from the σ-additivity of probability measures. Feel free to give the proof a shot by yourself to test your understanding.
If you can’t see this, no worries. Here is a brief explanation. Since A1,A2,… are mutually disjoint, A ∩A1,A ∩A2,… are mutually disjoint as well. Moreover, since ∪n=1∞An = Ω, we also have

Thus, the σ-additivity of probability measures implies that

which is what we had to show.
Let’s see an example right away! Suppose that we toss two dice. What is the probability that the sum of the results is 7?
First, we should properly describe the probability space. For notational simplicity, let’s denote the result of the throws with X and Y . What we are looking for is P(X + Y = 7). Modeling the toss with two dice is the simplest if we impose order among them. With this in mind, the event space Ω is described by the Cartesian product

and the outcomes are tuples of the form (i,j). (That is, the tuple (i,j) encodes the elementary event {X = i,Y = j}.) Since the tosses are independent of each other,

(When it is clear, we omit the brackets of the event {X = i,Y = j}.)
Since the first throw falls between 1 and 6, we can partition the event space by forming

Thus, the law of total probability gives

However, if we know that X + Y = 7 and X = n, we know that Y = 7 −n must hold as well. So, continuing the calculation above,

So, the law of total probability helps us deal with complex events by decomposing them into simpler ones. We have seen this pattern dozens of times now, and once again, it proves to be essential.
As yet another consequence of σ-additivity, we can calculate the probability of an increasing sequence of events by taking the limit.
Theorem 114. (Lower continuity of probability measures)
Let (Ω,Σ,P) be a probability space and let A1 ⊆A2 ⊆⋅⋅⋅∈ Σ be an increasing sequence of events. Then,
P(∪n=1∞ An) = limn→∞ P(An) (18.3)
holds. This property is called the lower continuity of probability measures.
Proof. Since the events are increasing, that is, An−1 ⊆ An, we can write An as

where An−1 and An ∖An−1 are disjoint.
Thus,

which gives
![∑∞ P (∪∞n=1An ) = P(An ∖ An− 1) n=1 N∑ = lim P (An ∖ An− 1) N → ∞n=1 N = lim ∑ [P(A )− P (A )] N → ∞ n n−1 n=1 = lim P (AN ), N → ∞](https://static.packt-cdn.com/products/9781837027873/graphics/media/file1666.png)
where we used that P(∅) = 0.
We can state an analogue of the above theorem for a decreasing sequence of events.
Theorem 115. (Upper continuity of probability measures)
Let (Ω,Σ,P) be a probability space and let A1 ⊇A2 ⊇⋅⋅⋅∈ Σ be a decreasing sequence of events. Then,
P(∩n=1∞ An) = limn→∞ P(An) (18.4)
holds. This property is called the upper continuity of probability measures.
Proof. For simplicity, let’s denote the infinite intersection by A := ∩n=1∞An.
By defining Bn := A1 ∖An, we have ∪n=1∞Bn = A1 ∖A. Since An is decreasing, Bn is increasing, so we can apply Theorem 114 to obtain

Since P(A1 ∖A) = P(A1) −P(A), we obtain P(A) = limn→∞P(An).
Now that we have a mathematical definition of a probabilistic model, it is time to take a step toward the space where machine learning is done: ℝn.
18.2.6 Probability spaces on ℝn
Section titled “18.2.6 Probability spaces on ℝn”In machine learning, every data point is an elementary outcome, located somewhere in the Euclidean space ℝn. Because of this, we are interested in modeling experiments there.
How can we define a probability space on ℝn? As we did with the real line in Section 18.2.1, we describe a convenient σ-algebra by generating. There, we can use the higher dimensional counterpart of the (a,b) intervals: n-dimensional spheres. For this, we define the set

where x is the center of the sphere, r>0 is its radius, and ∥⋅∥ denotes the usual Euclidean norm. (The B denotes the word ball. In mathematics, n-dimensional spheres are often called balls.) Similar to the real line, the Borel algebra is defined by
ℬ(ℝn) := σ({B(x, r) : x ∈ ℝn, r > 0}) (18.5)
As we saw on the real line (see Section 18.2.3), the structure of ℬ(ℝn) is richer than what the definition suggests at first glance. Here, the analogue of interval is a rectangle, defined by

where A×B is the Cartesian product. (See Definition 110.) Similarly, we can define [a,b],(a,b],[a,b), and others.
Theorem 116.
For any a,b ∈ ℝn, the sets [a,b],[a,b),(a,b],(a,∞),[a,∞),(−∞,a),(−∞,b] are elements of ℬ(ℝn).
Proof. The proof goes along the same line as the counterpart for ℬ(ℝ). As such, it is left as an exercise to you.
As a hint, first, we can show that (a,b) can be written as a countable union of balls. We can also show that this holds true for sets such as

as well. From these two, we can write the others as unions/intersections/differences.
As an example, let’s throw a few darts at a rectangular wall. Suppose that we are terrible darts players and hitting any point on the wall is equally likely.
We can model this event space with Ω = [0,1] × [0,1] ⊆ℝ2, representing our wall. What are the possible events? For instance, there is a circular darts board hanging on the wall, and we want to find the probability of hitting it. In this scenario, we can restrict the Borel sets defined by (22.2.6) to

Now that the event space and algebra is clear, we need to think about assigning probabilities. Our assumption is that hitting any point is equally likely. So, by generalizing the
formula we have seen in the discrete case, we define the probability measure by

(In two dimensions, we have the area instead of volume.) This is illustrated by Figure 18.4.

Figure 18.4: Probability space of throwing darts at a wall. Source: https://unsplash.com/photos/black-and-white-round-logo-i3WlrO7oAHA
As we shall see later, this is a special case of uniform distributions, one of the most prevalent distributions in probability theory. However, there is a lot to talk about until then. Before we conclude our discussion of the fundamentals of probability, let’s discuss how can we interpret them.
18.2.7 How to interpret probability
Section titled “18.2.7 How to interpret probability”Now that we know how to work with probabilities, it is time to study how can we assign probabilities to real-life events.
First, we are going to take a look at the frequentist interpretation, explaining probabilities with relative frequencies. (If you are one of those people who are religious about this question, calm down. We’ll discuss the Bayesian interpretation in detail, but it is not time yet.)
Let’s go back to the beginning and consider the coin-tossing experiment. If I toss a fair coin 1000 times, how many of them will be heads? Most people immediately answer 500, but this is not correct. There is no right answer, as any number of heads between 0 and 1000 can happen. Of course, most probably it will be around 500, but with a very small probability, there can be zero heads as well.
In general, the probability of an event describes its relative frequency among infinitely many attempts. That is,

When the number of attempts goes toward infinity, the relative frequency of occurrences converges to the true underlying probability. In other words, if Xi quantitatively describes our i-th attempt by

then

We can illustrate this by doing a quick simulation using the coin-tossing example. Don’t worry if you don’t understand the code; we’ll talk about it in detail in the next chapters.
import numpy as npfrom scipy.stats import randint
n_tosses = 1000# coin tosses: 0 for tails and 1 for headscoin_tosses = [randint.rvs(low=0, high=2) for _ in range(n_tosses)]averages = [np.mean(coin_tosses[:k+1]) for k in range(n_tosses)]Let’s plot the results for some insight:
import matplotlib.pyplot as plt
with plt.style.context("seaborn-v0_8"): plt.figure(figsize=(16, 8)) plt.title("Relative frequency of the coin tosses") plt.xlabel("Number of tosses") plt.ylabel("Relative frequency")
# plotting the averages plt.plot(range(n_tosses), averages, linewidth=3) # the averages
# plotting the true expected value plt.plot([-100, n_tosses+100], [0.5, 0.5], c="k") plt.xlim(-10, n_tosses+10) plt.ylim(0, 1) plt.show()
Figure 18.5: The relative frequency of coin tosses
The relative frequency quite nicely stabilizes around 1∕2, which is the true probability of our fair coin landing on its heads. Is this an accident? No.
We will make all of this mathematically precise when talking about the law of large numbers in Section 20.5, but first, we’ll introduce the Bayesian viewpoint, a probabilistic framework for updating our models given new observations.
Bookmark
18.3 Conditional probability
Section titled “18.3 Conditional probability”In the previous sections, we learned the foundations of probability. Now we can speak in terms of outcomes, events, and chances. However, in real-life applications, these basic tools are not enough to build useful predictive models.
To illustrate this, let’s build a probabilistic spam filter! For every email we receive, we want to estimate the probability P(email is spam). The closer this is to 1, the more likely that we are looking at a spam email.
Based on our inbox, we might calculate the relative frequency of spam emails and obtain that

However, this doesn’t help us at all. Based on this, we can randomly discard every email with probability P(email is spam), but that would be a horrible spam filter.
To improve, we need to dig a bit deeper. When analyzing spam emails, we start to notice patterns. For instance, the phrase “act now” can be found almost exclusively in spam. After a quick count, we get that

This looks much more useful for our spam filtering efforts. By checking for the presence of the phrase “act now”, we can confidently classify an email as spam.
Of course, there is much more to spam filtering, but this example demonstrates the importance of probabilities conditional on other events. To put this into mathematical form, we introduce the following definition.
Definition 78. (Conditional probability)
Let (Ω,Σ,P) be a probability space, let A,B ∈ Σ be two events, and suppose that P(A)>0. The conditional probability of B given A is defined by

You can think about P(B∣A) as restricting the event space to A, as illustrated by Figure 18.6.

Figure 18.6: A visual representation of conditional probability
When there are more conditions, say A1 and A2, the definition takes the form

and so on for even more events.
To bring this concept closer, let’s revisit the dice-rolling experiment. Suppose that your friend rolls a six-sided dice and tells you that the outcome is an odd number. Given this information, what is the probability that the result is 3? For simplicity, let’s denote the outcome of the roll with X. Mathematically speaking, this can be calculated by

This is the number that we expected.
Although this simple example doesn’t demonstrate the usefulness of conditional probability, this is a cornerstone in machine learning. In essence, learning from data can be formulated as estimating P(label∣data). We are going to expand on this idea later in this chapter.
18.3.1 Independence
Section titled “18.3.1 Independence”The idea behind conditional probability is that observing certain events changes the probability of others. Is this always the case, though?
In probabilistic modeling, recognizing when observing an event doesn’t influence another is equally important. This motivates the concept of independence.
Definition 79. (Independence of events)
Let (Ω,Σ,P) be a probability space and let A,B ∈ Σ be two events. We say that A and B are independent if

holds.
Equivalently, this can be formulated in terms of conditional probabilities. By the definition, if A and B are independent, we have

To see an example, let’s go back to coin tossing and suppose that we toss a coin two times. Let the result of the first and second toss be denoted by X1 and X2, respectively. What is the probability that both of these tosses are heads? As we saw when discussing this example in Section 18.2.4, we can see that

That is, the two events are independent of each other.
Regarding probability, there are many common misconceptions. One is about the interpretation of independence. Suppose that I toss a fair coin ten times, all of them resulting in heads. What is the probability that my next toss will be heads?
Most would immediately conclude that this must be very small since having eleven heads in a row is highly unlikely. However, once we have the ten results available, we no longer talk about the probability of eleven coin tosses, just the last one! Since the coin tosses are independent of each other, the chance of heads for the eleventh toss (given the results of the previous ten) is still 50%.
This phenomenon is called the gambler’s fallacy, and I am pretty sure that at some point in your life, you fell victim to it. (I sure did.)
In practical scenarios, working with conditional probabilities might be easier. (For instance, sometimes we can estimate them directly, while the standard probabilities are difficult to gauge.) Because of this, we need tools to work with them.
18.3.2 The law of total probability revisited
Section titled “18.3.2 The law of total probability revisited”Remember the law of total probability from Theorem 113? We can use conditional probabilities to put it into a slightly different form.
Theorem 117. (Law of total probability, conditional version)
Let (Ω,Σ,P) be a probability space and let A ∈ Σ be an arbitrary event. If A1,A2,⋅⋅⋅∈ Σ are mutually disjoint events (that is, Ai ∩Aj = ∅if i≠j) for which ∪n=1∞An = Ω, then
P(A) = ∑k=1∞ P(A | Ak) P(Ak) (18.6)
Proof. The proof is the trivial application of the law of total probability (Theorem 113) and the definition of conditional probabilities: as P(A ∩Ak) = P(A∣Ak)P(Ak),
P(A) = ∑k=1∞ P(A ∩ Ak) = ∑k=1∞ P(A | Ak) P(Ak)
holds, which is what we had to show.
Why is this useful for us? Let’s demonstrate this with an example. Suppose that we have three urns containing light and dark colored balls.
The first one contains 4 dark, the second one contains 2 light and 2 dark, while the last one contains 1 light and 3 dark balls.

Figure 18.7: Urns with colored balls
We randomly pick an urn; however, picking the first one is twice as likely as picking the other two. (That is, we pick the first urn 50% of the time, while the second and the third 25%–25% of the time.) From that urn, we also randomly pick a ball. What is the probability that we select a light ball? Without using the law of total probability, this is difficult to compute.
Let’s denote the color of the selected ball by X and suppose that the event An describes picking the n-th urn. Then, we have

Without using conditional probabilities, calculating P({X = light}∩Ak) is difficult (since we are not picking each urn with equal probability). However, we can simply calculate the conditionals by counting the number of light balls in each urn. That is, we have

Since P(A1) = 1∕2,P(A2) = 1∕4, and P(A3) = 1∕4, the probability we are looking for is

Note that because the urns are not selected with equal probability,

as one would naively guess.
Another useful property of the conditional probability is that, due to its definition, we can use it to express the joint probability of events:

Even though this sounds trivial, there are cases when we can estimate/compute the conditional probability but not the joint probability. In fact, this simple identity can be generalized for an arbitrary number of conditions. This is called the chain rule. (Despite its name, it has nothing to do with the chain rule for differentiation.)
Theorem 118. (The chain rule)
Let (Ω,Σ,P) be a probability space and A1,A2,⋅⋅⋅∈ Σ be arbitrary events. Then,
P(A) = ∑k=1∞ P(A | Ak) P(Ak) (18.7)
holds.
Proof. First, we notice that P(A1 ∩⋅⋅⋅∩An) can be written as

because the terms cancel out each other.
Since

the chain rule (18.7) follows.
18.3.3 The Bayes theorem
Section titled “18.3.3 The Bayes theorem”In essence, machine learning is about turning observations into predictive models. Probability theory gives us a language to express our models. For instance, going back to our spam filter example, we can notice that 5% of our emails are spam. However, this is not enough information to filter out spam emails. Upon inspection, we have observed that 95% of emails that contain the phrase “act now” are spam (but only 1% of all the emails contain “act now”). In the language of conditional probabilities, we have concluded that

With this, we can start looking for emails containing the phrase “act now” and discard them with 95% confidence. Is this spam filter effective? Not really, since there can be other frequent keywords in spam mails that we don’t check. How can we check this?
For one, we can take a look at the conditional probability P(contains ”act now”∣spam), describing the frequency of the “act now” keyword among all the spam emails. A low frequency means that we are missing out on other keywords that we can use for filtering.
Generally speaking, we often want to compute/estimate the quantity P(A∣B), but our observations only allow us to infer P(B∣A). So, we need a way to reverse the condition and the event. With a bit of algebra, we can do this easily.
Theorem 119. (The Bayes formula)
Let (Ω,Σ,P) be a probability space, A,B be two arbitrary events, and suppose that P(A),P(B)>0. Then,
.png)
(18.8)
holds.
Proof. By the definition of conditional probability, we have

which is what we had to show.
To see how it works in action, let’s put it to the test in our spam filtering example. Given the information we know, we have

So, according to the Bayes formula,

Thus, by filtering only for the phrase “act now”, we are missing a lot of spam.
We can take the Bayes formula one step further by combining it with the law of total probability in Theorem 117. (See the equation (18.6).)
Theorem 120. (The Bayes theorem)
Let (Ω,Σ,P) be a probability space and let A,B ∈ Σ be arbitrary events. Moreover, let A1,A2,⋅⋅⋅∈ Σ be a partition of the event space Ω. (That is, the An-s are pairwise disjoint and their union is the entire event space.) Then,

holds.
Proof. The proof immediately follows from the Bayes formula (Theorem 119) and the law of total probability (Theorem 117.)
18.3.4 The Bayesian interpretation of probability
Section titled “18.3.4 The Bayesian interpretation of probability”Historically, probability was introduced as the relative frequency of observed events in Section 18.2.7. However, the invention of conditional probabilities and the Bayes formula enabled another interpretation that slowly became prevalent in statistics and machine learning.
In pure English, the Bayes formula can be thought of as updating our probabilistic models using new observations. Suppose that we are interested in the event B. Without observing anything, we can formulate a probabilistic model by assigning a probability to B, that is, estimating P(B). This is what we call the prior. However, observing another event A might change our probabilistic model.
Thus, we would like to estimate the posterior probability P(B∣A). We can’t do this directly, but thanks to our prior model, we can tell P(A∣B). The quantity P(A∣B) is called the likelihood. Combining these with the Bayes formula, we can see that the posterior is proportional to the likelihood and the prior.

Figure 18.8: The Bayes formula, as the product of the likelihood and prior
Let’s see a concrete example that will make the idea clear. Suppose that we are creating a diagnostic test for an exotic disease. How likely is the disease present in a random person?
Without knowing any specifics about the situation, we can only use statistics to formulate the probability model. Let’s say that only 2% of the population is affected. So, our probabilistic model is

However, once someone produces a positive test, things change. The goal is to estimate the posterior probability P(infected∣positive), a more accurate model.
Since no medical test is perfect, false positives and false negatives can happen. From the manufacturer, we know that it gives true positives 99% of the time, but the chance of a false positive is 5%. In probabilistic terms, we have

With these, the Bayes theorem gives us

So, the chance of being infected upon producing a positive test is surprisingly 29% (given these specific true and false positive rates).
These probabilistic thinking principles are also valid for machine learning. If we abstract away the process of learning from data, we are essentially 1) making observations, 2) updating our models given the new observations, and 3) starting the process all over again. The Bayes theorem gives a concrete tool for the job.
18.3.5 The probabilistic inference process
Section titled “18.3.5 The probabilistic inference process”As we have seen before, probability theory is the extension of mathematical logic. So far, we have discussed how logical connectives correspond to set operations and how probability generalizes the truth value by adding the component of uncertainty. What about the probabilistic inference process? Can we generalize classical inference and use probabilistic reasoning to construct arguments? Yes.
To illustrate, let’s start with a story. It’s 6:00 AM. The alarm clock is blasting but you are having a hard time getting out of bed. You don’t feel well. Your muscles are weak, and your head is exploding. After a brief struggle, you manage to call a doctor and list all the symptoms. Your sore throat makes speaking painful.
“It’s probably just the flu,“ they say.
Interactions like this are everyday occurrences. Yet, we hardly think about the reasoning process behind them. After all, you could have been hungover. Similarly, if the police find a murder weapon at your house, they’ll suspect that you are the killer. The two are related but not the same. For instance, the murder weapon could have been planted.
The bulk of humanity’s knowledge is obtained in this manner: we collect evidence, then build hypotheses. How do we infer the underlying cause from observing the effect? Most importantly, how can we avoid fooling ourselves into false conclusions?
Let’s focus on “muscle fatigue, headache, sore throat →flu“. This is certainly not true in an absolute sense, as these symptoms resemble how you would feel after shouting and drinking excessively during a metal concert, which is far from the flu. Yet, a positive diagnosis of flu is plausible. Given the evidence at hand, our belief is increased in the hypothesis.
Unfortunately, classical logic cannot deal with plausible, only with the absolute. Probability theory solves this problem by measuring plausibility on a 0 − 1 scale, instead of being stuck at the extremes. Zero is impossible. One is certain. All the values in between represent degrees of uncertainty.
Let’s put this into mathematical terms!
How can we establish a probabilistic link between cause and effect? In classical logic, events are interesting in the context of other events. Before, implication and modus ponens provided the context. Translated to the language of probability, the question is the following: What is the probability of B, given that A is observed? The answer: conditional probabilities.
Why does conditional probability generalize the concept of implication? It’s easier to draw a picture, so consider the two extreme cases in Figure 18.9. (Recall that implication corresponds to the subset relation, as we saw earlier.)

Figure 18.9: Conditional probability as logical implication
Essentially, P(B∣A) = 1 means that A →B is true, while P(B∣A) = 0 means that it is not. We can take this analogy further: a small P(B∣A) means that A →B is likely to be false, and a large P(B∣A) means that it is likely to be true.
This is illustrated by Figure 18.10.

Figure 18.10: Conditional probability as the extension of logical implication
Thus, the “probabilistic modus ponens” goes like this:
- P(B∣A) ≈ 1.
- A.
- Therefore, B is probable.
This is quite a relief, as now we have a solid theoretical justification for most of our decisions. Thus, the diagnostic process that kicked up our investigation makes a lot more sense now:
- P(flu∣headache, muscle fatigue, sore throat) ≈ 1.
- “Headache and muscle fatigue”.
- Therefore, “flu” is probable.
However, one burning question remains. How do we know that P(B∣A) ≈ 1 holds?
Let’s focus on the probabilistic version of “headache, sore throat, muscle fatigue →flu“. We know that this is not certain, only plausible. Yet, the reverse implication “flu →headache, sore throat, muscle fatigue“ is almost certain.
When naively arguing that the evidence implies the hypothesis, we have the opposite in mind. Instead of applying the modus ponens, we use the faulty argument
- A →B.
- B.
- Therefore, A.
We have talked about this before: this logical fallacy is called affirming the consequent, and it’s completely wrong from a purely logical standpoint. However, the Bayes theorem provides a probabilistic twist.
The proposition A →B translates to P(B∣A) = 1, which implies that when A is observed, B occurs as well. Why? Because then we have

This is good news, as reversing the implication is not totally wrong. Instead, we have the probabilistic affirming the consequent:
- A →B.
- B.
- Therefore, A is more probable.
With this, the probabilistic reasoning process makes perfect sense. To recall, the issue with arguments such as “if you have muscle fatigue, sore throat, and a headache, then you have the flu“ is that the symptoms can be caused by other conditions, and in rare cases, the flu does not carry all of these symptoms.
Yet, this kind of thinking can be surprisingly effective in real-life decision-making. Probability and conditional probability extend our reasoning toolkit with inductive methods in three steps:
- Generalizes the binary 0 − 1 truth values to allow the representation of uncertainty.
- Defines the analogue of “if A, then B“-type implications using conditional probability.
- Provides a method to infer the cause from observing the effect.
These three ideas are seriously powerful, and their inception has enabled science to perform unbelievable feats. (If you are interested in learning more about the relation of probability theory and logic, I recommend you the great book Probability Theory: The Logic of Science by E. T. Jaynes.)
There’s one more thing I would like to show you. Let’s go back to the mid-twentieth century and look at how a TV show shaped probabilistic thinking.
18.3.6 The Monty Hall paradox
Section titled “18.3.6 The Monty Hall paradox”Before we finish with conditional probability, we’ll touch on an important problem. Regarding probability, we often have seemingly contradictory phenomena, going against our intuitive expectations. These are called paradoxes. To master probabilistic thinking, we need to resolve them and eliminate common fallacies from our thinking processes. So far, we have already seen the gambler’s fallacy when talking about the concept of independence in Section 18.3.1. Now, we’ll discuss the famous Monty Hall paradox.
In the ’60s, there was a TV show in the United States called Let’s Make a Deal ( https://en.wikipedia.org/wiki/Let\%27s_Make_a_Deal). As a contestant, you faced three closed doors, one having a car behind it (that you could take home), while the others had nothing. You had the opportunity to open one.

Figure 18.11: Three closed doors, one of which contains a reward behind it
Suppose that after selecting door no. 1, Monty Hall — the show host — opens the third door, showing that it was not the winning one. Now, you have the opportunity to change your mind and open door no. 2 instead of the first one. Do you take it?

Figure 18.12: Monty opened the third door for you. Do you switch?
At first glance, your chances are 50%/50%, so you might not be better off by switching. However, this is not true!
To set things straight, let’s do a careful probabilistic analysis. Let Ai denote the event that the prize is behind the i-th door, while Bi is the event of Monty opening the i-th door. Before Monty opens the third one, our model is

and we want to calculate P(A1∣B3) and P(A2∣B3).
By thinking from the perspective of the show host, which door would you open? If you know that the prize is behind the 1st door, you open the 2nd and 3rd one with equal probability. However, if the prize is actually behind the 2nd door (and the contestant selected the 1st one), you always open the 3rd one. That is,

Thus, by applying the Bayes formula, we have

and

In conclusion, P(A2∣B3) is twice as large as P(A1∣B3), from which we deduce

So, you should always switch doors. Surprising, isn’t it? Here, the paradox is that contrary to what we might expect, changing our minds is the better option. With clear probabilistic thinking, we can easily resolve this.
Bookmark
18.4 Summary
Section titled “18.4 Summary”Phew! We are at the end of an intimidatingly long, albeit extremely essential chapter. Although we’ve talked about the mathematical details of probability for a couple of dozen pages, the most important takeaway can be summarized in a sentence: probability theory extends our reasoning toolkit by handling uncertainty. Instead of measuring the truthiness of a proposition on a true-or-false binary scale, it opens up a spectrum between 0 and 1, where 0 represents (almost) impossible, and 1 represents (almost) certain.
Mathematically speaking, probabilistic models are defined by probability measures and spaces, that is, structures of the form (Ω,Σ,P), where Ω is the set of possible elementary outcomes, Σ is the collection of events, and P is a probability measure, satisfying
- P(Ω) = 1
- and P(∪n=1∞−An) = ∑ n=1∞P(An) for all mutually disjoint An ∈ Σ,
which are called the Kolmogorov axioms. Thinking in probabilities enables us to reason under uncertainty: if P(A) is the probabilistic version of the truth value of a statement, then the conditional probability

is the probabilistic version of the implication A →B.
However, all the tools we learned are just the tips of a massive iceberg. To build truly beefy and useful models, we need to once more turn qualitative into quantitative, as we did for many advances in science and mathematics. Can you recall the dice rolling experiment, where we used a mysterious variable X to represent the outcome of the roll? Thus, we could talk about events such as “X = k”, turning a probability space into a sequence of numbers.
It’s not a coincidence; it’s a method. X is an instance of a random variable, the premier object of probability theory and statistics. Random variables translate between abstract probability spaces to numbers and vectors, our old friends. Let’s make them a permanent tool in our belt.
Bookmark
18.5 Problems
Section titled “18.5 Problems”Problem 1. Let’s roll two six-sided dice! Describe the event space, σ-algebra, and the corresponding probabilities for this experiment.
Problem 2. Let Ω = [0,1], and the corresponding σ-algebra be the generated algebra
![ ( ) Σ = σ {(a,b] : 0 ≤ a <b ≤ 1} . ](https://static.packt-cdn.com/products/9781837027873/graphics/media/file1725.png)
Show that the following events are members of Σ:
(a) S1 = {x} for all x ∈ [0,1].
(b) S2 = ∪i=1n(ai,bi). (Show that this is also true when the intervals […] are replaced with open and half-open versions (…),(…],[…).)
(c) S3 = [0,1] ∩ℚ. (That is, the set of rational numbers in [0,1].)
(d) S4 = [0,1] ∩(ℝ ∖ℚ). (That is, the set of irrational numbers in [0,1].)
Problem 3. Let’s roll two six-sided dice. What is the probability that
(a) Both rolls are odd numbers?
(b) At least one of them is an odd number?
(c) None of them are odd numbers?
Problem 4. Let Ω = ℝ2 be the event space, where we define the open disks
= 
and the open rectangles by

Show that the σ-algebras generated by these sets are the same, that is,

Problem 5. Let’s consider a variant of the Monty Hall problem. Suppose there are a hundred doors instead of three; only one contains a reward. Upon picking a door, Monty opens ninety-eight other doors, all of which are empty. Should you switch now?