Skip to main content

Introduction

1 Probability Space

The Formal Definition is found at Probability Space

1.1 Definition

A probability space is a triplet P=(Ω,F,μ)\mathfrak{P}=\left(\Omega,\mathcal{F},\mu\right) with:

  • Ω\Omega is the universe.
  • FP(Ω)\mathcal{F}\subseteq \mathscr{P}(\Omega) is the set of all events.
  • μ:F[0,1]\mu:\mathcal{F}\rightarrow [0,1] is a probability function that assigns a probability to each event.

We define the probability of an event AFA\in\mathcal{F} as follow:

P(A)=μ(A)\mathcal{P}(A)=\mu(A)

1.2 Example: Dice Game

You are playing a dice game with your friend, at each turn are throwing two dices; one at a time.

We will assume that both dices are fair, you want to calculate the probability that you get ii on the first dice and jj on the second dice for each i,j{1,2,3,4,5,6}i,j\in\{1,2,3,4,5,6\}

Solution

We will first create a mathematical model for this problem.

  • Let Ω={1,2,3,4,5,6}×{1,2,3,4,5,6}\Omega=\{1,2,3,4,5,6\}\times \{1,2,3,4,5,6\}.

  • Let F=P(Ω)={A/AΩ}\mathcal{F}=\mathscr{P}(\Omega)=\{A / \quad A \subseteq \Omega\}.

  • Let μ:F[0,1]\mu:\mathcal{F}\rightarrow [0,1] defined simply by μ(A)=AΩ.\mu(A)=\frac{\lvert A \rvert}{\lvert \Omega \rvert }. The choice of such μ\mu is justified as both dices are fair.

  • Let AiA_i be the event: The first dice has the value i\texttt{The first dice has the value i}.

  • Let BjB_j the event: The second dice has the value j\texttt{The second dice has the value j}.

  • Let Ci,jC_{i,j} be the event: The first dice has the value i, and the second dice has the value j\texttt{The first dice has the value i, and the second dice has the value j}.

Mathematically, Ci,j=AiBj={(i,j)},C_{i,j}=A_i\cap B_j=\{(i,j)\}, its probability is:

P(Ci,j)=Ci,jΩ=136\mathcal{P}(C_{i,j})=\frac{\lvert C_{i,j}\rvert}{\lvert \Omega \rvert}=\frac{1}{36}

2. Random Variable

The Formal Definition is found at Random Variable

2.1 Definition

A random variable is a function X:ΩSX:\Omega\rightarrow S.

In some sense, the probability that XAX\in A from some ASA\subseteq S is defined as:

μ(X1(A))\mu(X^{-1}\left(A\right))

2.2 Example: Dice Game 2

After throwing both dices, one of the following will happen:

  • If the sum of the two dices is a prime number pp, you will go forward by pp

  • Else, it is a composite number n,n, you will go backward by pp where pp is the biggest prime divisor of nn

Let XX be the random variable denoting the signed value of the steps that will be taken.

We will generate a table of values of possible sums each with its corresponding step:

112233445566
11Sum is 22, Step is 22Sum is 33, Step is 33Sum is 44, Step is 2-2Sum is 55, Step is 55Sum is 66, Step is 3-3Sum is 77, Step is 77
22Sum is 33, Step is 33Sum is 44, Step is 2-2Sum is 55, Step is 55Sum is 66, Step is 3-3Sum is 77, Step is 77Sum is 88, Step is 2-2
33Sum is 44, Step is 2-2Sum is 55, Step is 55Sum is 66, Step is 3-3Sum is 77, Step is 77Sum is 88, Step is 2-2Sum is 99, Step is 3-3
44Sum is 55, Step is 55Sum is 66, Step is 3-3Sum is 77, Step is 77Sum is 88, Step is 2-2Sum is 99, Step is 3-3Sum is 1010, Step is 5-5
55Sum is 66, Step is 3-3Sum is 77, Step is 77Sum is 88, Step is 2-2Sum is 99, Step is 3-3Sum is 1010, Step is 5-5Sum is 1111, Step is 1111
66Sum is 77, Step is 77Sum is 88, Step is 2-2Sum is 99, Step is 3-3Sum is 1010, Step is 5-5Sum is 1111, Step is 1111Sum is 1212, Step is 3-3

We have:

  • X1(2)={(1,1)}X^{-1}(2)=\{(1,1)\}
  • X1(3)={(1,2),(2,1)}X^{-1}(3)=\{(1,2),(2,1)\}
  • X1(5)={(1,4),(2,3),(3,2),(4,1)}X^{-1}(5)=\{(1,4),(2,3),(3,2),(4,1)\}
  • X1(7)={(1,6),(2,5),(3,4),(4,3),(5,2),(6,1)}X^{-1}(7)=\{(1,6),(2,5),(3,4),(4,3),(5,2),(6,1)\}
  • X1(11)={(5,6),(6,5)}X^{-1}(11)=\{(5,6),(6,5)\}
  • X1(2)={(1,3),(2,2),(3,1),(2,6),(3,5),(4,4),(5,3),(6,2)}X^{-1}(-2)=\{(1,3),(2,2),(3,1),(2,6),(3,5),(4,4),(5,3),(6,2)\}
  • X1(3)={(1,5),(2,4),(3,3),(4,2),(5,1),(3,6),(4,5),(5,4),(6,3),(6,6)}X^{-1}(-3)=\{(1,5),(2,4),(3,3),(4,2),(5,1),(3,6),(4,5),(5,4),(6,3),(6,6)\}
  • X1(5)={(4,6),(5,5),(6,4)}X^{-1}(-5)=\{(4,6),(5,5),(6,4)\}

Now we will build the table of probabilities of XX

ValueProbability
5-5336\frac{3}{36}
3-31036=518\frac{10}{36}=\frac{5}{18}
2-2836=29\frac{8}{36}=\frac{2}{9}
22136\frac{1}{36}
33236=118\frac{2}{36}=\frac{1}{18}
55436=19\frac{4}{36}=\frac{1}{9}
77636=16\frac{6}{36}=\frac{1}{6}
1111236=118\frac{2}{36}=\frac{1}{18}

2. Expected Value

Let XX be a random variable following some distribution D.\mathcal{D}.

The expected value of XX, denoted E[X]\mathbb{E}[X], if it exists, defines in some sense what value at average we expect from XX

2.1 Discrete Case

If D\mathcal{D} is a discrete distribution, then:

E[X]=kSkP(X=k)\mathbb{E}[X]=\sum_{k\in S}k\mathcal{P}(X=k)

With SS defined as the support of XX

2.2 Continuous Case

If D\mathcal{D} is a continuous distribution, then:

E[X]=Sxf(x) dx\mathbb{E}[X]=\int_{S}xf(x)\space \text{dx}

2.3 Linearity

2.3.1 Simple Case

  • Let a,bRa,b\in\mathbb{R}
  • Let X,YX,Y two random variables

The expected value is linear:

E[aX+bY]=aE[X]+bE[Y]\mathbb{E}[aX+bY]=a\mathbb{E}[X]+b\mathbb{E}[Y]

2.3.2 Generalisation

  • Let nNn\in\mathbb{N}
  • Let a1,,anRa_1,\dots,a_n\in\mathbb{R}
  • Let X1,,XnX_1,\dots,X_n be nn random variables
  • Let Y=k=1nakXkY=\sum_{k=1}^n a_kX_k

We have:

E[Y]=E[k=1nakXk]=k=1nakE[Xk]\mathbb{E}[Y]=\mathbb{E}\left[\sum_{k=1}^na_kX_k\right]=\sum_{k=1}^na_k\mathbb{E}[X_k]

2.4 Example: Dice Game 3

We want to calculate the expected number of steps taken on each step:

E[X]=kX(Ω)kP(X=k)=5331028+21+32+54+76+11236=31360.861\begin{align*} \mathbb{E}[X]&=\sum_{k\in X(\Omega)}k\mathcal{P}(X=k) \\ &=\frac{-5\cdot 3-3\cdot 10 -2\cdot 8 +2 \cdot 1+3 \cdot 2+ 5\cdot 4+7\cdot 6+11\cdot 2}{36}\\ &=\frac{31}{36}\approx0.861 \end{align*}

3. Variance

3.1 Definition

Let XX be a random variable following some distribution D.\mathcal{D}.

The variance of XX, denoted V[X]\mathbb{V}[X], if it exists, defines in some sense how far is XX from its expected value, on average.

It is defined as follow:

V[X]=E[(XE[X])2]=E[X2]E[X]2\mathbb{V}[X]=\mathbb{E}\left[\left(X-\mathbb{E}[X]\right)^2\right]=\mathbb{E}[X^2]-\mathbb{E}[X]^2

3.1 Discrete Case

If D\mathcal{D} is a discrete distribution, then:

V[X]=kS(kE[X])2P(X=k)\mathbb{V}[X]=\sum_{k\in S}(k-\mathbb{E}[X])^2\mathcal{P}(X=k)

With SS defined as the support of XX

3.2 Continuous Case

If D\mathcal{D} is a continuous distribution, then:

E[X]=S(xE[X])2f(x) dx\mathbb{E}[X]=\int_{S}(x-\mathbb{E}[X])^2f(x)\space \text{dx}

3.3 Variance of sum of independent random variables

3.3.1 Simple Case

  • Let a,bRa,b\in\mathbb{R}.
  • Let X,YX,Y two independent random variables.

The expected value is linear:

V[aX+bY]=a2V[X]+b2V[Y]\mathbb{V}[aX+bY]=a^2\mathbb{V}[X]+b^2\mathbb{V}[Y]

3.3.2 Generalisation

  • Let nNn\in\mathbb{N}
  • Let a1,,anRa_1,\dots,a_n\in\mathbb{R}
  • Let X1,,XnX_1,\dots,X_n be nn independent random variables
  • Let Y=k=1nakXkY=\sum_{k=1}^n a_kX_k

We have:

V[Y]=V[k=1nakXk]=k=1nak2V[Xk]\mathbb{V}[Y]=\mathbb{V}\left[\sum_{k=1}^na_kX_k\right]=\sum_{k=1}^na_k^2\mathbb{V}[X_k]

3.4 Example: Dice Game 4

E[X2]=kX(Ω)k2P(X=k)=253+910+48+41+92+254+496+121236=85536=954    V[X]=E[X2]E[X]2=954312362=29819129623.008\begin{align*} \mathbb{E}[X^2]&=\sum_{k\in X(\Omega)} k^2\mathcal{P}(X=k)\\ &=\frac{25\cdot 3 + 9 \cdot 10 + 4 \cdot 8+4\cdot 1 + 9 \cdot 2 + 25 \cdot 4 + 49 \cdot 6 + 121 \cdot 2}{36}\\ &=\frac{855}{36}\\ &=\frac{95}{4}\\ \implies \mathbb{V}[X]&=\mathbb{E}[X^2]-\mathbb{E}[X]^2\\ &=\frac{95}{4}-\frac{31^2}{36^2}\\ &=\frac{29819}{1296}\approx 23.008 \end{align*}

4. Co-variance

4.1 Definition

Let X,YX,Y be two random variables.

The co-variance of XX and YY, denoted Cov[X,Y]\text{Cov}[X,Y], if it exists, defines in some sense how XX and YY varies together.

It is defined as follow:

Cov[X,Y]=E[(XE[X])(YE[Y])]=E[XY]E[X]E[Y]\text{Cov}[X,Y]=\mathbb{E}\left[\left(X-\mathbb{E}[X]\right)\cdot \left(Y-\mathbb{E}[Y]\right)\right]=\mathbb{E}[XY]-\mathbb{E}[X]\mathbb{E}[Y]

4.1 Discrete Case

If D\mathcal{D} is a discrete distribution, then:

Cov[X,Y]=uS1vS2(uE[X])(vE[Y])P(X=uY=v)\text{Cov}[X,Y]=\sum_{u\in S_1}\sum_{v\in S_2}(u-\mathbb{E}[X])(v-\mathbb{E}[Y])\mathcal{P}(X=u\wedge Y=v)

With SS defined as the support of XX

4.2 Continuous Case

If D\mathcal{D} is a continuous distribution, then:

Cov[X,Y]=S1×S2(xE[X])(yE[Y])f(x,y) dydx\text{Cov}[X,Y]=\iint_{S_1\times S_2}(x-\mathbb{E}[X])(y-\mathbb{E}[Y])f(x,y)\space \text{dydx}

4.3 Bi-linearity

4.3.1 Simple Case

  • Let a,bRa,b\in\mathbb{R}
  • Let X,Y,ZX,Y,Z three random variables

The co-variance is left-linear:

Cov[aX+bY,Z]=aCov[X,Z]+bCov[Y,Z]\text{Cov}[aX+bY,Z]=a\text{Cov}[X,Z]+b\text{Cov}[Y,Z]

The co-variance is right-linear:

Cov[X,aY+bZ]=aCov[X,Y]+bCov[X,Z]\text{Cov}[X,aY+bZ]=a\text{Cov}[X,Y]+b\text{Cov}[X,Z]

4.3.2 Generalisation

  • Let n,mNn,m\in\mathbb{N}
  • Let a1,,an,b1,,bmRa_1,\dots,a_n,b_1,\dots,b_m\in\mathbb{R}
  • Let X1,,Xn,Y1,,YmX_1,\dots,X_n,Y_1,\dots,Y_m be n+mn+m random variables

We have:

Cov[i=1naiXi,j=1mbjYj]=i=1nj=1maibjCov[Xi,Yj]\text{Cov}\left[\sum_{i=1}^na_iX_i,\sum_{j=1}^mb_jY_j\right]=\sum_{i=1}^n\sum_{j=1}^ma_ib_j\text{Cov}\left[X_i,Y_j\right]

4.3.4 Symmetry

In fact, Cov\text{Cov} is also symmetric as:

Cov[X,Y]=Cov[Y,X]\text{Cov}[X,Y]=\text{Cov}[Y,X]

4.3.5 Positive semi-definite

More than that, Cov\text{Cov} is positive semi-definite as:

Cov[X,X]=V[X]0\text{Cov}[X,X]=\mathbb{V}[X]\ge 0

4.3.6 Orthogonality between independent random variables

Let X,YX,Y two independent random variables. We have:

Cov[X,Y]=0\text{Cov}[X,Y]=0

The converse does not generally hold

4.4 Relation to Variance

4.4.1 Variance as a Co-variance

Let XX a random variable.

The variance of XX is in fact equal to:

V[X]=Cov[X,X]\mathbb{V}[X]=\text{Cov}[X,X]

4.4.2 Variance of a sum of random variables

  • Let nNn\in\mathbb{N}
  • Let a1,,anRa_1,\dots,a_n\in\mathbb{R}
  • Let X1,,XnX_1,\dots,X_n be nn random variables (not necessarily independent)
  • Let Y=k=1nakXkY=\sum_{k=1}^n a_kX_k

The variance of YY is:

V[Y]=Cov[i=1naiXi,j=1najXj]=i=1nj=1naiajCov[Xi,Xj]=i=1nai2Cov[Xi,Xi]+1ijnaiajCov[Xi,Xj]=i=1nai2V[Xi]+21i<jnaiajCov[Xi,Xj]\begin{align*} \mathbb{V}[Y]&=\text{Cov}\left[\sum_{i=1}^na_iX_i,\sum_{j=1}^na_jX_j\right]\\ &=\sum_{i=1}^n\sum_{j=1}^na_ia_j\text{Cov}\left[X_i,X_j\right] \\ &=\sum_{i=1}^na_i^2\text{Cov}[X_i,X_i]+\sum_{1\le i\ne j\le n}a_ia_j\text{Cov}[X_i,X_j]\\ &=\sum_{i=1}^na_i^2\mathbb{V}[X_i]+2\sum_{1\le i < j \le n}a_ia_j\text{Cov}[X_i,X_j] \end{align*}