# Probability Space

The axiom foundation of probability theory is laid by Kolmogorov, one of the greatest mathematician of the 20th century, who advanced various very different fields of mathematics.

 Definition (Probability Space) A probability space is a triple ${\displaystyle (\Omega ,\Sigma ,\Pr )}$. ${\displaystyle \Omega }$ is a set, called the sample space. ${\displaystyle \Sigma \subseteq 2^{\Omega }}$ is the set of all events, satisfying: (K1). ${\displaystyle \Omega \in \Sigma }$ and ${\displaystyle \emptyset \in \Sigma }$. (The certain event and the impossible event.) (K2). If ${\displaystyle A,B\in \Sigma }$, then ${\displaystyle A\cap B,A\cup B,A-B\in \Sigma }$. (Intersection, union, and diference of two events are events). A probability measure ${\displaystyle \Pr :\Sigma \rightarrow \mathbb {R} }$ is a function that maps each event to a nonnegative real number, satisfying (K3). ${\displaystyle \Pr(\Omega )=1}$. (K4). If ${\displaystyle A\cap B=\emptyset }$ (such events are call disjoint events), then ${\displaystyle \Pr(A\cup B)=\Pr(A)+\Pr(B)}$. (K5*). For a decreasing sequence of events ${\displaystyle A_{1}\supset A_{2}\supset \cdots \supset A_{n}\supset \cdots }$ of events with ${\displaystyle \bigcap _{n}A_{n}=\emptyset }$, it holds that ${\displaystyle \lim _{n\rightarrow \infty }\Pr(A_{n})=0}$.
Remark
• In general, the set ${\displaystyle \Omega }$ may be continuous, but we only consider discrete probability in this lecture, thus we assume that ${\displaystyle \Omega }$ is either finite or countably infinite.
• Sometimes it is convenient to assume ${\displaystyle \Sigma =2^{\Omega }}$, i.e. the events enumerates all subsets of ${\displaystyle \Omega }$. But in general, a probability space is well-defined by any ${\displaystyle \Sigma }$ satisfying (K1) and (K2). Such ${\displaystyle \Sigma }$ is called a ${\displaystyle \sigma }$-algebra defined on ${\displaystyle \Omega }$.
• The last axiom (K5*) is redundant if ${\displaystyle \Sigma }$ is finite, thus it is only essential when there are infinitely many events. The role of axiom (K5*) in probability theory is like Zorn's Lemma (or equivalently the Axiom of Choice) in axiomatic set theory.

Useful laws for probability can be deduced from the axioms (K1)-(K5).

 Proposition Let ${\displaystyle {\bar {A}}=\Omega \setminus A}$. It holds that ${\displaystyle \Pr({\bar {A}})=1-\Pr(A)}$. If ${\displaystyle A\subseteq B}$ then ${\displaystyle \Pr(A)\leq \Pr(B)}$.
Proof.
 The events ${\displaystyle {\bar {A}}}$ and ${\displaystyle A}$ are disjoint and ${\displaystyle {\bar {A}}\cup A=\Omega }$. Due to Axiom (K4) and (K3), ${\displaystyle \Pr({\bar {A}})+\Pr(A)=\Pr(\Omega )=1}$. The events ${\displaystyle A}$ and ${\displaystyle B\setminus A}$ are disjoint and ${\displaystyle A\cup (B\setminus A)=B}$ since ${\displaystyle A\subseteq B}$. Due to Axiom (K4), ${\displaystyle \Pr(A)+\Pr(B\setminus A)=\Pr(B)}$, thus ${\displaystyle \Pr(A)\leq \Pr(B)}$.
${\displaystyle \square }$
Notation

An event ${\displaystyle A\subseteq \Omega }$ can be represented as ${\displaystyle A=\{a\in \Omega \mid {\mathcal {E}}(a)\}}$ with a predicate ${\displaystyle {\mathcal {E}}}$.

The predicate notation of probability is

${\displaystyle \Pr[{\mathcal {E}}]=\Pr(\{a\in \Omega \mid {\mathcal {E}}(a)\})}$.

We will mostly use the predicate notation instead of subset notation.

# Conditional Probability

In probability theory, the word "condition" is a verb. "Conditioning on the event ..." means that it is assumed that the event occurs.

 Definition (conditional probability) The conditional probability that event ${\displaystyle A}$ occurs given that event ${\displaystyle B}$ occurs is ${\displaystyle \Pr[A\mid B]={\frac {\Pr[A\wedge B]}{\Pr[B]}}.}$

The conditional probability is well-defined only if ${\displaystyle \Pr[B]\neq 0}$.

For independent events ${\displaystyle A}$ and ${\displaystyle B}$, it holds that

${\displaystyle \Pr[A\mid B]=\Pr[A].}$

It supports our intuition that for two independent events, whether one of them occurs will not affect the chance of the other.

## Law of total probability

The following fact is known as the law of total probability. It computes the probability by averaging over all possible cases.

 Theorem (law of total probability) Let ${\displaystyle B_{1},B_{2},\ldots ,B_{n}}$ be mutually disjoint events, and ${\displaystyle \bigcup _{i=1}^{n}B_{i}=\Omega }$ is the sample space. Then for any event ${\displaystyle A}$, ${\displaystyle \Pr[A]=\sum _{i=1}^{n}\Pr[A\wedge B_{i}]=\sum _{i=1}^{n}\Pr[A\mid B_{i}]\cdot \Pr[B_{i}].}$
Proof.
 Since ${\displaystyle B_{1},B_{2},\ldots ,B_{n}}$ are mutually disjoint and ${\displaystyle \bigvee _{i=1}^{n}B_{i}=\Omega }$, events ${\displaystyle A\wedge B_{1},A\wedge B_{2},\ldots ,A\wedge B_{n}}$ are also mutually disjoint, and ${\displaystyle A=\bigcup _{i=1}^{n}\left(A\cap B_{i}\right)}$. Then the additivity of disjoint events, we have ${\displaystyle \Pr[A]=\sum _{i=1}^{n}\Pr[A\wedge B_{i}]=\sum _{i=1}^{n}\Pr[A\mid B_{i}]\cdot \Pr[B_{i}].}$
${\displaystyle \square }$

The law of total probability provides us a standard tool for breaking a probability into sub-cases. Sometimes this will help the analysis.

## "The Chain Rule"

By the definition of conditional probability, ${\displaystyle \Pr[A\mid B]={\frac {\Pr[A\wedge B]}{\Pr[B]}}}$. Thus, ${\displaystyle \Pr[A\wedge B]=\Pr[B]\cdot \Pr[A\mid B]}$. This hints us that we can compute the probability of the AND of events by conditional probabilities. Formally, we have the following theorem:

 Theorem Let ${\displaystyle A_{1},A_{2},\ldots ,A_{n}}$ be any ${\displaystyle n}$ events. Then {\displaystyle {\begin{aligned}\Pr \left[\bigwedge _{i=1}^{n}A_{i}\right]&=\prod _{k=1}^{n}\Pr \left[A_{k}\mid \bigwedge _{i
Proof.
 It holds that ${\displaystyle \Pr[A\wedge B]=\Pr[B]\cdot \Pr[A\mid B]}$. Thus, let ${\displaystyle A=A_{n}}$ and ${\displaystyle B=A_{1}\wedge A_{2}\wedge \cdots \wedge A_{n-1}}$, then {\displaystyle {\begin{aligned}\Pr[A_{1}\wedge A_{2}\wedge \cdots \wedge A_{n}]&=\Pr[A_{1}\wedge A_{2}\wedge \cdots \wedge A_{n-1}]\cdot \Pr \left[A_{n}\mid \bigwedge _{i Recursively applying this equation to ${\displaystyle \Pr[A_{1}\wedge A_{2}\wedge \cdots \wedge A_{n-1}]}$ until there is only ${\displaystyle A_{1}}$ left, the theorem is proved.
${\displaystyle \square }$

# Random Variable

 Definition (random variable) A random variable ${\displaystyle X}$ on a sample space ${\displaystyle \Omega }$ is a real-valued function ${\displaystyle X:\Omega \rightarrow \mathbb {R} }$. A random variable X is called a discrete random variable if its range is finite or countably infinite.

For a random variable ${\displaystyle X}$ and a real value ${\displaystyle x\in \mathbb {R} }$, we write "${\displaystyle X=x}$" for the event ${\displaystyle \{a\in \Omega \mid X(a)=x\}}$, and denote the probability of the event by

${\displaystyle \Pr[X=x]=\Pr(\{a\in \Omega \mid X(a)=x\})}$.

The independence can also be defined for variables:

 Definition (Independent variables) Two random variables ${\displaystyle X}$ and ${\displaystyle Y}$ are independent if and only if ${\displaystyle \Pr[(X=x)\wedge (Y=y)]=\Pr[X=x]\cdot \Pr[Y=y]}$ for all values ${\displaystyle x}$ and ${\displaystyle y}$. Random variables ${\displaystyle X_{1},X_{2},\ldots ,X_{n}}$ are mutually independent if and only if, for any subset ${\displaystyle I\subseteq \{1,2,\ldots ,n\}}$ and any values ${\displaystyle x_{i}}$, where ${\displaystyle i\in I}$, {\displaystyle {\begin{aligned}\Pr \left[\bigwedge _{i\in I}(X_{i}=x_{i})\right]&=\prod _{i\in I}\Pr[X_{i}=x_{i}].\end{aligned}}}

Note that in probability theory, the "mutual independence" is not equivalent with "pair-wise independence", which we will learn in the future.

# Linearity of Expectation

Let ${\displaystyle X}$ be a discrete random variable. The expectation of ${\displaystyle X}$ is defined as follows.

 Definition (Expectation) The expectation of a discrete random variable ${\displaystyle X}$, denoted by ${\displaystyle \mathbf {E} [X]}$, is given by {\displaystyle {\begin{aligned}\mathbf {E} [X]&=\sum _{x}x\Pr[X=x],\end{aligned}}} where the summation is over all values ${\displaystyle x}$ in the range of ${\displaystyle X}$.

Perhaps the most useful property of expectation is its linearity.

 Theorem (Linearity of Expectations) For any discrete random variables ${\displaystyle X_{1},X_{2},\ldots ,X_{n}}$, and any real constants ${\displaystyle a_{1},a_{2},\ldots ,a_{n}}$, {\displaystyle {\begin{aligned}\mathbf {E} \left[\sum _{i=1}^{n}a_{i}X_{i}\right]&=\sum _{i=1}^{n}a_{i}\cdot \mathbf {E} [X_{i}].\end{aligned}}}
Proof.
 By the definition of the expectations, it is easy to verify that (try to prove by yourself): for any discrete random variables ${\displaystyle X}$ and ${\displaystyle Y}$, and any real constant ${\displaystyle c}$, ${\displaystyle \mathbf {E} [X+Y]=\mathbf {E} [X]+\mathbf {E} [Y]}$; ${\displaystyle \mathbf {E} [cX]=c\mathbf {E} [X]}$. The theorem follows by induction.
${\displaystyle \square }$

The linearity of expectation gives an easy way to compute the expectation of a random variable if the variable can be written as a sum.

Example
Supposed that we have a biased coin that the probability of HEADs is ${\displaystyle p}$. Flipping the coin for n times, what is the expectation of number of HEADs?
It looks straightforward that it must be np, but how can we prove it? Surely we can apply the definition of expectation to compute the expectation with brute force. A more convenient way is by the linearity of expectations: Let ${\displaystyle X_{i}}$ indicate whether the ${\displaystyle i}$-th flip is HEADs. Then ${\displaystyle \mathbf {E} [X_{i}]=1\cdot p+0\cdot (1-p)=p}$, and the total number of HEADs after n flips is ${\displaystyle X=\sum _{i=1}^{n}X_{i}}$. Applying the linearity of expectation, the expected number of HEADs is:
${\displaystyle \mathbf {E} [X]=\mathbf {E} \left[\sum _{i=1}^{n}X_{i}\right]=\sum _{i=1}^{n}\mathbf {E} [X_{i}]=np}$.

The real power of the linearity of expectations is that it does not require the random variables to be independent, thus can be applied to any set of random variables. For example:

${\displaystyle \mathbf {E} \left[\alpha X+\beta X^{2}+\gamma X^{3}\right]=\alpha \cdot \mathbf {E} [X]+\beta \cdot \mathbf {E} \left[X^{2}\right]+\gamma \cdot \mathbf {E} \left[X^{3}\right].}$

However, do not exaggerate this power!

• For an arbitrary function ${\displaystyle f}$ (not necessarily linear), the equation ${\displaystyle \mathbf {E} [f(X)]=f(\mathbf {E} [X])}$ does not hold generally.
• For variances, the equation ${\displaystyle var(X+Y)=var(X)+var(Y)}$ does not hold without further assumption of the independence of ${\displaystyle X}$ and ${\displaystyle Y}$.

## Conditional Expectation

Conditional expectation can be accordingly defined:

 Definition (conditional expectation) For random variables ${\displaystyle X}$ and ${\displaystyle Y}$, ${\displaystyle \mathbf {E} [X\mid Y=y]=\sum _{x}x\Pr[X=x\mid Y=y],}$ where the summation is taken over the range of ${\displaystyle X}$.

There is also a law of total expectation.

 Theorem (law of total expectation) Let ${\displaystyle X}$ and ${\displaystyle Y}$ be two random variables. Then ${\displaystyle \mathbf {E} [X]=\sum _{y}\mathbf {E} [X\mid Y=y]\cdot \Pr[Y=y].}$

# ${\displaystyle k}$-wise independence

Recall the definition of independence between events:

 Definition (Independent events) Events ${\displaystyle {\mathcal {E}}_{1},{\mathcal {E}}_{2},\ldots ,{\mathcal {E}}_{n}}$ are mutually independent if, for any subset ${\displaystyle I\subseteq \{1,2,\ldots ,n\}}$, {\displaystyle {\begin{aligned}\Pr \left[\bigwedge _{i\in I}{\mathcal {E}}_{i}\right]&=\prod _{i\in I}\Pr[{\mathcal {E}}_{i}].\end{aligned}}}

Similarly, we can define independence between random variables:

 Definition (Independent variables) Random variables ${\displaystyle X_{1},X_{2},\ldots ,X_{n}}$ are mutually independent if, for any subset ${\displaystyle I\subseteq \{1,2,\ldots ,n\}}$ and any values ${\displaystyle x_{i}}$, where ${\displaystyle i\in I}$, {\displaystyle {\begin{aligned}\Pr \left[\bigwedge _{i\in I}(X_{i}=x_{i})\right]&=\prod _{i\in I}\Pr[X_{i}=x_{i}].\end{aligned}}}

Mutual independence is an ideal condition of independence. The limited notion of independence is usually defined by the k-wise independence.

 Definition (k-wise Independenc) 1. Events ${\displaystyle {\mathcal {E}}_{1},{\mathcal {E}}_{2},\ldots ,{\mathcal {E}}_{n}}$ are k-wise independent if, for any subset ${\displaystyle I\subseteq \{1,2,\ldots ,n\}}$ with ${\displaystyle |I|\leq k}$ {\displaystyle {\begin{aligned}\Pr \left[\bigwedge _{i\in I}{\mathcal {E}}_{i}\right]&=\prod _{i\in I}\Pr[{\mathcal {E}}_{i}].\end{aligned}}} 2. Random variables ${\displaystyle X_{1},X_{2},\ldots ,X_{n}}$ are k-wise independent if, for any subset ${\displaystyle I\subseteq \{1,2,\ldots ,n\}}$ with ${\displaystyle |I|\leq k}$ and any values ${\displaystyle x_{i}}$, where ${\displaystyle i\in I}$, {\displaystyle {\begin{aligned}\Pr \left[\bigwedge _{i\in I}(X_{i}=x_{i})\right]&=\prod _{i\in I}\Pr[X_{i}=x_{i}].\end{aligned}}}

A very common case is pairwise independence, i.e. the 2-wise independence.

 Definition (pairwise Independent random variables) Random variables ${\displaystyle X_{1},X_{2},\ldots ,X_{n}}$ are pairwise independent if, for any ${\displaystyle X_{i},X_{j}}$ where ${\displaystyle i\neq j}$ and any values ${\displaystyle a,b}$ {\displaystyle {\begin{aligned}\Pr \left[X_{i}=a\wedge X_{j}=b\right]&=\Pr[X_{i}=a]\cdot \Pr[X_{j}=b].\end{aligned}}}

Note that the definition of k-wise independence is hereditary:

• If ${\displaystyle X_{1},X_{2},\ldots ,X_{n}}$ are k-wise independent, then they are also ${\displaystyle \ell }$-wise independent for any ${\displaystyle \ell .
• If ${\displaystyle X_{1},X_{2},\ldots ,X_{n}}$ are NOT k-wise independent, then they cannot be ${\displaystyle \ell }$-wise independent for any ${\displaystyle \ell >k}$.

## Pairwise Independent Bits

Suppose we have ${\displaystyle m}$ mutually independent and uniform random bits ${\displaystyle X_{1},\ldots ,X_{m}}$. We are going to extract ${\displaystyle n=2^{m}-1}$ pairwise independent bits from these ${\displaystyle m}$ mutually independent bits.

Enumerate all the nonempty subsets of ${\displaystyle \{1,2,\ldots ,m\}}$ in some order. Let ${\displaystyle S_{j}}$ be the ${\displaystyle j}$th subset. Let

${\displaystyle Y_{j}=\bigoplus _{i\in S_{j}}X_{i},}$

where ${\displaystyle \oplus }$ is the exclusive-or, whose truth table is as follows.

 ${\displaystyle a}$ ${\displaystyle b}$ ${\displaystyle a}$${\displaystyle \oplus }$${\displaystyle b}$ 0 0 0 0 1 1 1 0 1 1 1 0

There are ${\displaystyle n=2^{m}-1}$ such ${\displaystyle Y_{j}}$, because there are ${\displaystyle 2^{m}-1}$ nonempty subsets of ${\displaystyle \{1,2,\ldots ,m\}}$. An equivalent definition of ${\displaystyle Y_{j}}$ is

${\displaystyle Y_{j}=\left(\sum _{i\in S_{j}}X_{i}\right){\bmod {2}}}$.

Sometimes, ${\displaystyle Y_{j}}$ is called the parity of the bits in ${\displaystyle S_{j}}$.

We claim that ${\displaystyle Y_{j}}$ are pairwise independent and uniform.

 Theorem For any ${\displaystyle Y_{j}}$ and any ${\displaystyle b\in \{0,1\}}$, {\displaystyle {\begin{aligned}\Pr \left[Y_{j}=b\right]&={\frac {1}{2}}.\end{aligned}}} For any ${\displaystyle Y_{j},Y_{\ell }}$ that ${\displaystyle j\neq \ell }$ and any ${\displaystyle a,b\in \{0,1\}}$, {\displaystyle {\begin{aligned}\Pr \left[Y_{j}=a\wedge Y_{\ell }=b\right]&={\frac {1}{4}}.\end{aligned}}}

The proof is left for your exercise.

Therefore, we extract exponentially many pairwise independent uniform random bits from a sequence of mutually independent uniform random bits.

Note that ${\displaystyle Y_{j}}$ are not 3-wise independent. For example, consider the subsets ${\displaystyle S_{1}=\{1\},S_{2}=\{2\},S_{3}=\{1,2\}}$ and the corresponding random bits ${\displaystyle Y_{1},Y_{2},Y_{3}}$. Any two of ${\displaystyle Y_{1},Y_{2},Y_{3}}$ would decide the value of the third one.