Random Variables and their Distributions

Definition 5

A random variable is a function X:ΩRX:\Omega\rightarrow\mathbb{R} with the property αR, {ωΩ: X(ω)α}F\forall \alpha\in\mathbb{R},\ \{\omega\in\Omega:\ X(\omega) \leq \alpha\} \in \mathcal{F}.

The condition in Definition 5 is necessary to compute P(Xα), αRP(X\leq \alpha),\ \forall \alpha\in\mathbb{R}. This requirement also let us compute P(XB)P(X\in B) for most sets by leveraging the fact that F\mathcal{F} is closed under complements, unions, and intersections. For example, we can also compute P(X>α)P(X > \alpha) and P(α<Xβ)P(\alpha < X \leq \beta). In this sense, the property binds the probability space to the random variable.

Definition 5 also implies that random variables satisfy particular algebraic properties. For example, if X,YX,Y are random variables, then so are X+Y,XY,Xp,limnXnX+Y, XY, X^p, \lim_{n\to\infty}X_n, etc.

Definition 6

A discrete random variable is a random variable whose codomain is countable.

Definition 7

A continuous random variable is a random variable whose codomain is the real numbers.

Although random variables are defined based on a probability space, it is often most natural to model problems without explicitly specifying the probability space. This works so long as we specify the random variables and their distribution in a “consistent” way. This is formalized by the so-called Kolmogorov Extension Theorem but can largely be ignored.

Distributions

Roughly speaking, the distribution of a random variable gives an idea of the likelihood that a random variable takes a particular value or set of values.

Definition 8

The probability mass function (or distribution) of a discrete random variable XX is the frequency with which XX takes on different values.

pX:X[0,1] where X=range(X),pX(x)=Pr{X=x}.p_X:\mathcal{X} \rightarrow [0, 1] \text{ where } \mathcal{X} = \text{range}(X),\qquad p_X(x) = \text{Pr}\left\{X=x\right\} .

Note that xXpX(x)=1\sum_{x\in\mathcal{X}}p_X(x) = 1 since xX{w:X(w)=x}=Ω\bigcap_{x\in\mathcal{X}}\{w: X(w) = x\} = \Omega.

Continuous random variables are largely similar to discrete random variables. One key difference is that instead of being described by a probability “mass”, they are instead described by a probability “density”.

Definition 9

The probability density function (distribution) of a continuous random variable describes the density by which a random variable takes a particular value.

fX:R[0,) where fX(x)dx=1 and Pr{XB}=BfX(x)dxf_X: \mathbb{R}\to [0, \infty) \text{ where } \int_{-\infty}^{\infty}f_X(x)dx = 1 \text{ and } \text{Pr}\left\{X\in B\right\} = \int_B f_X(x)dx

Observe that if a random variable XX is continuous, then the probability that it takes on a particular value is zero.

Pr{X=x}=limδ0Pr{xXx+δ}=limδ0xx+δfX(u)du=xxfX(u)du=0\text{Pr}\left\{X=x\right\} = \lim_{\delta\to0} \text{Pr}\left\{x \leq X \leq x +\delta\right\} = \lim_{\delta\to 0}\int_x^{x+\delta}f_X(u)du = \int_{x}^{x}f_X(u)du = 0

Definition 10

The cumulative distribution function (CDF) gives us the probability of a random variable XX being less than or equal to a particular value.

FX:R[0,1],FX(x)=Pr{Xx}F_X:\mathbb{R} \to [0, 1],\quad F_X(x) = \text{Pr}\left\{X \leq x\right\}

Note that by the Kolomogorov axioms, FXF_X must satisfy three properties:

  1. FXF_X is non-decreasing.

  2. limx0FX(x)=0\lim_{x\to0} F_X(x) = 0 and limxFX(x)=1\lim_{x\to\infty} F_X(x) = 1.

  3. FXF_X is right continuous.

It turns out that if we have any function FXF_X that satisfies these three properties, then it is the CDF of some random variable on some probability space. Note that FX(x)F_X(x) gives us an alternative way to define continuous random variables. If FX(x)F_X(x) is absolutely continuous, then it can be expressed as

FX(x)=xfX(x)dxF_X(x) = \int_{-\infty}^{x}f_X(x)dx

for some non-negative function fX(x)f_X(x), and this is the PDF of a continuous random variable.

Often, when modeling problems, there are multiple random variables that we want to keep track of.

Definition 11

If XX and YY are random variables on a common probability space (Ω,F,P)(\Omega, \mathcal{F}, P), then the joint distribution (denoted pXY(x,y)p_{XY}(x, y) or fXY(x,y)f_{XY}(x, y)describes the frequencies of joint outcomes.

Note that it is possible for XX to be continuous and YY to be discrete (or vice versa).

Definition 12

The marginal distribution of a joint distribution is the distribution of a single random variable.

pX(x)=ypXY(x,Y=y),fX(x)=fXY(x,y)dyp_X(x) = \sum_yp_{XY}(x, Y=y), \qquad f_X(x) = \int_{-\infty}^{\infty}f_{XY}(x, y)dy

Definition 13

Two random variables XX and YYare independent if their joint distribution is the product of the marginal distributions.

Just like independence, we can extend the notion of conditional probability to random variables.

Definition 14

The conditional distribution of XX given YY captures the frequencies of XX given we know the value of YY.

pXY(xy)=PXY(x,y)pY(y),fXY(xy)=fXY(x,y)fY(y)p_{X|Y}(x|y) = \frac{P_{XY}(x, y)}{p_Y(y)}, \qquad f_{X|Y}(x|y) = \frac{f_{XY}(x, y)}{f_Y(y)}

Often, we need to combine or transform several random variables. A derived distribution is the obtained by arithmetic of several random variables or applying a function to several (or many) random variables. Since the CDF of a distribution essentially defines that random variable, it can often be easiest to work backwards from the CDF to the PDF or PMF. In the special case where we want to find Y=g(X)Y=g(X) for a function gg.

Fy(y)=Pr{Yy}=Pr{g(x)y}=Pr{Xg1([,y])},g1(y)={x:g(x)=y}.F_y(y) =\text{Pr}\left\{Y \leq y\right\} = \text{Pr}\left\{g(x) \leq y\right\} = \text{Pr}\left\{X \in g^{-1}([-\infty, y])\right\} , \quad g^{-1}(y) = \{ x: g(x) = y \}.

Another special case of a derived distribution is when adding random variables together.

Theorem 5

The resulting distribution of a sum of two independent random variables is the convolution of the distributions of the two random variables.

pX+Y(z)=k=pX(k)pY(zk),fX+Y(z)=fX(x)fY(zx)dxp_{X+Y}(z) = \sum_{k=-\infty}^{\infty}p_X(k)p_Y(z-k), \quad f_{X+Y}(z) = \int_{-\infty}^{\infty}f_X(x)f_Y(z - x)dx

Properties of Distributions

Expectation

Definition 15

The expectation of a random variable describes the center of a distribution,

E[X]=xXxpX(x),E[X]=xfX(x)dx\mathbb{E}\left[X\right] =\sum_{x\in\mathcal{X}}xp_X(x), \quad \mathbb{E}\left[X\right] = \int_{-\infty}^{\infty}xf_X(x)dx

provided the sum or integral converges.

Expectation has several useful properties. If we want to compute the expectation of a function of a random variable, then we can use the law of the unconscious statisitician.

Theorem 6 (Law of the Unconscious Statistician)

E[g(X)]=xXg(x)pX(x),E[g(X)]=g(x)fX(x)dx\mathbb{E}\left[g(X)\right] = \sum_{x\in\mathcal{X}}g(x)p_X(x), \quad \mathbb{E}\left[g(X)\right] = \int_{-\infty}^{\infty}g(x)f_X(x)dx

Another useful property is its linearity.

E[aX+bY]=aE[X]+bE[Y], a,bR.\mathbb{E}\left[aX+bY\right] = a\mathbb{E}\left[X\right] +b\mathbb{E}\left[Y\right] ,\ \forall a, b\in\mathbb{R}.

Sometimes it can be difficult to compute expectations directly. For disrete distributions, we can use the tail-sum formula.

Theorem 7 (Tail Sum)

For a non-negative integer random variable,

E[X]=k=1Pr{Xk}.\mathbb{E}\left[X\right] = \sum_{k=1}^{\infty}\text{Pr}\left\{X\geq k\right\} .

When two random variables are independent, expectation has some additional properties.

Theorem 8

If XX and YY are independent, then

E[XY]=E[X]E[Y].\mathbb{E}\left[XY\right] = \mathbb{E}\left[X\right] \mathbb{E}\left[Y\right] .

Earlier, we saw that we find a derived distribution by transforming and combining random variables. Sometimes, we don’t need to actually compute the distribution, but only some of its properties.

Definition 16

The nth moment of a random variable is E[Xn]\mathbb{E}\left[X^n\right] .

It turns out that we can encode the moments of a distribution into the coefficients of a special power series.

Definition 17

The moment generating function of a random variable XX is given by MX(t)=E[etX]M_X(t) = \mathbb{E}\left[e^{tX}\right] .

Notice that if we apply the power series expansion of etXe^{tX}, we see that

MX(t)=n=0t!n!E[Xn].M_X(t) = \sum_{n=0}^{\infty}\frac{t!}{n!}\mathbb{E}\left[X^n\right] .

Thus the nth moment is encoded in the coefficients of the power series and we can retrieve them by taking a derivative:

E[Xn]=dndtnMX(t).\mathbb{E}\left[X^n\right] = \frac{d^{n}}{dt^{n}}M_X(t).

Another interesting point to notice is that for a continuous random variable

MX(t)=fX(x)etxdxM_X(t) = \int_{-\infty}^{\infty}f_X(x)e^{tx}dx

is the Laplace transform of the distribution over the real line, and for a discrete random variable,

MX(t)=x=pX(x)etxM_X(t) = \sum_{x=-\infty}^{\infty}p_X(x)e^{tx}

is the Z-transform of the distribution evaluated along the curve at ete^{-t}.

Theorem 9

If the MGF of a function exists, then it uniquely determines the distribution.

This provides another way to compute the distribution for a sum of random variables because we can just multiply their MGF.

Variance

Definition 18

The variance of a discrete random variable XX describes its spread around the expectation and is given by

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

Theorem 10

When two random variables XX and YY are independent, then

Var(X+Y)=Var(X)+Var(Y).\text{Var}\left(X+Y\right) = \text{Var}\left(X\right) + \text{Var}\left(Y\right) .

Definition 19

The covariance of two random variables describes how much they depend on each other and is given by

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

If Cov(X,Y)=0\text{Cov}\left(X,Y\right) = 0 then XX and YY are uncorrelated.

Definition 20

The correlation coefficient gives a single number which describes how random variables are correlated.

ho(X,Y)=Cov(X,Y)Var(X)Var(Y).ho(X, Y) = \frac{\text{Cov}\left(X, Y\right) }{\sqrt{\text{Var}\left(X\right) }\sqrt{\text{Var}\left(Y\right) }}.

Note that 1ρ1-1\leq \rho \leq 1.

Common Discrete Distributions

Definition 21

XX is uniformly distributed when each value of XX has equal probability.

XUniform({1,2,,n})    pX(x)={1nx=1,2,,n,0 else.X\sim \text{Uniform}(\{ 1, 2, \cdots, n \}) \implies p_X(x) = \begin{cases} \frac{1}{n} & x = 1, 2, \cdots, n,\\ 0 & \text{ else.} \end{cases}

Definition 22

XX is a Bernoulli random variable if it is either 00 or 11 with pX(1)=pp_X(1) = p.

XBernoulli(p)    pX(x)={1px=0,px=1,0 else.X\sim\text{Bernoulli}(p) \implies p_X(x) = \begin{cases} 1 - p & x=0,\\ p & x=1,\\ 0 & \text{ else.} \end{cases}

E[X]=pVar(X)=(1p)p\mathbb{E}\left[X\right] = p \qquad \text{Var}\left(X\right) = (1-p)p

Bernoulli random variables are good for modeling things like a coin flip where there is a probability of success. Bernoulli random variables are frequently used as indicator random variables 1A\mathbb{1}_A where

1A={1if A occurs,0 else.\mathbb{1}_A = \begin{cases} 1 & \text{if A occurs,}\\ 0 & \text{ else.} \end{cases}

When paired with the linearity of expectation, this can be a powerful method of computing the expectation of something.

Definition 23

XX is a Binomial random variable when

XBinomial(n,p)    pX(x)={(nx)px(1p)nxx=0,1,,n0 else.X \sim \text{Binomial}(n, p) \implies p_X(x) = \begin{cases} \binom{n}{x} p^x (1-p)^{n-x} & x=0, 1, \cdots, n\\ 0 & \text{ else.} \end{cases}

E[X]=npVar(X)=np(1p)\mathbb{E}\left[X\right] = np \qquad \text{Var}\left(X\right) = np(1-p)

A binomial random variable can be thought of as the number of successes in nn trials. In other words,

XBinomial(n,p)    X=i=1nXi,XiBernoulli(p).X \sim \text{Binomial}(n, p) \implies X = \sum_{i=1}^{n}X_i, \quad X_i \sim \text{Bernoulli}(p).

By construction, if XBinomial(n,p)X\sim\text{Binomial}(n, p) and YBinomial(m,p)Y\sim\text{Binomial}(m, p) are independent, then X+YBinomial(m+n,p)X+Y \sim \text{Binomial}(m+n, p).

Definition 24

A Geometric random variable is distributed as

XGeom(p)    pX(x)={p(1p)x1x=1,2,0 else.X\sim\text{Geom}(p) \implies p_X(x) = \begin{cases} p(1-p)^{x-1} & x=1, 2, \cdots\\ 0 & \text{ else}. \end{cases}

E[X]=1pVar(X)=1pp2\mathbb{E}\left[X\right] = \frac{1}{p} \qquad \text{Var}\left(X\right) = \frac{1-p}{p^2}

Geometric random variables are useful for modeling the number of trials required before the first success. In other words,

XGeom(p)    X=min{k1:Xk=1} where XiBernoulli(p).X \sim \text{Geom}(p) \implies X = \min\{k \geq 1: X_k=1 \} \text{ where } X_i\sim \text{Bernoulli}(p).

A useful property of geometric random variables is that they are memoryless:

Pr{X=K+MX>k}=Pr{X=M}.\text{Pr}\left\{X=K+M|X>k\right\} = \text{Pr}\left\{X=M\right\} .

Definition 25

A Poisson random variable is distributed as

XPoisson(λ)    pX(x)={λxeλx!x=0,1,0 else.X\sim Poisson(\lambda) \implies p_X(x) = \begin{cases} \frac{\lambda^xe^{-\lambda}}{x!} & x=0, 1, \cdots \\ 0 & \text{ else.} \end{cases}

E[X]=λ\mathbb{E}\left[X\right] = \lambda

Poisson random variables are good for modeling the number of arrivals in a given interval. Suppose you take a given time interval and divide it into nn chunks where the probability of arrival in chunk ii is XiBernoulli(pn)X_i \sim \text{Bernoulli}(p_n). Then the total number of arrivals Xn=i=1nXiX_n = \sum_{i=1}^{n}X_i is distributed as a Binomial random variable with expectation npn=λnp_n=\lambda. As we increase nn to infinity but keep λ\lambda fixed, we arrive at the poisson distribution.

A useful fact about Poisson random variables is that if XPoisson(λ)X\sim\text{Poisson}(\lambda) and YPoisson(μ)Y\sim\text{Poisson}(\mu) are independent, then X+YPoisson(λ+μ)X+Y \sim \text{Poisson}(\lambda + \mu).

Common Continuous Distributions

Definition 26

A continuous random variable is uniformly distributed when the pdf of XX is constant over a range.

XUniform(a,b)    fX(x)={1baaxb,0 else.X \sim \text{Uniform}(a, b) \implies f_X(x) = \begin{cases} \frac{1}{b-a} & a \leq x \leq b,\\ 0 & \text{ else.} \end{cases}

The CDF of a uniform distribution is given by

FX(x)={0,x<a,xaba,x[a,b)1,xb.F_X(x) = \begin{cases} 0, & x < a,\\ \frac{x-a}{b-a}, & x\in[a, b)\\ 1, & x \geq b. \end{cases}

Definition 27

A continuous random variable is exponentially distributed when its pdf is given by

XExp(λ)    fX(x)={λeλxx0,0 else.X \sim \text{Exp}(\lambda) \implies f_X(x) = \begin{cases} \lambda e^{-\lambda x} & x \geq 0,\\ 0 & \text{ else.} \end{cases}

Exponential random variables are the only continuous random variable to have the memoryless property:

Pr{X>t+sX>s}=Pr{X>t},t0.\text{Pr}\left\{X > t+s | X > s\right\} = \text{Pr}\left\{X > t\right\} , \quad t \geq 0.

The CDF of the exponential distribution is given by

FX(x)=λ0xeλudu=1eλxF_X(x) = \lambda \int_0^{x}e^{-\lambda u}du = 1 - e^{-\lambda x}

Definition 28

XX is a Gaussian Random Variable with mean μ\mu and variance σ2\sigma^2 (denoted XN(μ,σ2)X\sim \mathcal{N}(\mu, \sigma^2)) if it has the PDF

fX(x)=12πσ2e(xμ)22σ2f_X(x) = \frac{1}{\sqrt{2\pi\sigma^2}}e^{\frac{-(x-\mu)^2}{2\sigma^2}}

The standard normal is XN(0,1)X\sim\mathcal{N}(0, 1), and it has the CDF

Φ(x)=12πxeu22du\Phi(x) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^{x}e^{\frac{-u^2}{2}} du

There is no closed from for Φ(x)\Phi(x). It turns out that every normal random variable can be transformed into the standard normal (i.e XμσN(0,1)\frac{X - \mu}{\sigma} \sim \mathcal{N}(0, 1)). Some facts about Gaussian random variables are

  1. If XN(μx,σx2), YN(μy,σy2)X\sim\mathcal{N}(\mu_x, \sigma_x^2),\ Y\sim\mathcal{N}(\mu_y, \sigma_y^2) are independent, then X+YN(μx+μy,σx2+σy2)X+Y \sim \mathcal{N}(\mu_x+\mu_y, \sigma_x^2 + \sigma_y^2).

  2. If X,YX,Y are independent and (X+Y),(XY)(X+Y), (X-Y) are independent, then both XX and YY are Gaussian with the same variance.

Jointly Gaussian Random Variables

Jointly Gaussian Random Varables, also known as Gaussian Vectors, can be defined in a variety of ways.

Definition 29

A Gaussian Random Vector X=[X1Xn]T\boldsymbol{X} = \begin{bmatrix} X_1 & \cdots & X_n \end{bmatrix}^T with density on Rn\mathbb{R}^n, Cov(X)=Σ,E[X]=μ\text{Cov}\left(\boldsymbol{X}\right) =\Sigma, \mathbb{E}\left[X\right] =\boldsymbol{\mu} is defined by the pdf

fX(x)=1(2π)ndet(Σ)e12(xμ)TΣ1(xμ)f_{\boldsymbol{X}}(\boldsymbol{x}) = \frac{1}{\sqrt{(2\pi)^n\text{det}(\Sigma)}}e^{-\frac{1}{2}(\boldsymbol{x}-\boldsymbol{\mu})^T\Sigma^{-1}(\boldsymbol{x}-\boldsymbol{\mu})}

Definition 30

A joint gaussian random variable is an affine transformation of independent and identically distributed standard normals.

X=μ+AW\boldsymbol{X} = \boldsymbol{\mu}+A\boldsymbol{W}

where A=Σ1/2A=\Sigma^{1/2} is a full-rank matrix and W\boldsymbol{W}is a vector of i.i.d standard normals.

Definition 31

A random variable is jointly gaussian if all 1D projections are Gaussian

aTXN(aTμ,aTΣa)\boldsymbol{a}^T\boldsymbol{X} \sim \mathcal{N}(\boldsymbol{a}^T\boldsymbol{\mu}, \boldsymbol{a}^T\Sigma\boldsymbol{a})

In addition to their many definitions, jointly gaussian random variables also have interesting properties.

Theorem 11

If X\boldsymbol{X} and Y\boldsymbol{Y} are jointly gaussian random variables, then

X=μX+ΣXYΣY1(YμY)+V where VN(0,ΣXΣXYΣY1ΣYX)X = \mu_{\boldsymbol{X}}+\Sigma_{\boldsymbol{XY}}\Sigma_{\boldsymbol{Y}}^{-1}(\boldsymbol{Y} - \boldsymbol{\mu_Y}) + \boldsymbol{V} \text{ where } V \sim \mathcal{N}(0, \Sigma_X-\Sigma_{\boldsymbol{XY}}\Sigma_Y^{-1}\Sigma{\boldsymbol{YX}})

Theorem 11 tells us that each entry in Gaussian Vector can be thought of as a “noisy” version of the others.

Hilbert Spaces of Random Variables

One way to understand random variables is through linear algebra by thinking of them as vectors in a vector space.

Definition 32

An real inner product space VV is composed of a vector space VV over a real scalar field equipped with an inner product ,\langle \cdot,\cdot \rangle that satisfies u,v,wV\forall u,v,w\in V, a,bRa, b\in\mathbb{R},

  1. u,v=v,u\langle u, v \rangle = \langle v, u \rangle

  2. au+bv,w=au,w+bv,w\langle au + bv, w \rangle = a \langle u,w \rangle + b \langle v,w \rangle

  3. u,u0\langle u,u \rangle \geq 0 and <u,u>=0u=0<u,u> = 0 \Leftrightarrow u = 0

Inner products spaces are equipped with the norm v=v,v\|v\| = \sqrt{\langle v, v \rangle }.

Definition 33

A Hilbert Space is a real inner product space that is complete with respect to its norm.

Loosely, completeness means that we can take limits of without exiting the space. It turns out that random variables satisfy the definition of a Hilbert Space.

Theorem 12

Let (Ω,F,P)(\Omega, \mathcal{F}, P) be a probability space. The collection of random variables XX with E[X2]<\mathbb{E}\left[X^2\right] < \infty on this probability space form a Hilbert Space with respect to the inner product X,Y=E[XY]\langle X, Y \rangle = \mathbb{E}\left[XY\right] .

Hilbert spaces are important because they provide a notion of geometry that is compatible with our intuition as well as the geometry of Rn\mathbb{R}^n (which is a Hilbert Space). One geometric idea is that of orthogonality. Two vectors are orthogonal if X,Y=0\langle X, Y\rangle = 0. Two random variables will be orthogonal if they are zero-mean and uncorrelated. Using orthogonality, we can also define projections.

Theorem 13 (Hilbert Projection Theorem)

Let H\mathcal{H} be a Hilbert Space and UH\mathcal{U} \subseteq \mathcal{H} be a closed subspace. For each vector vHv\in\mathcal{H}, argminuv\text{argmin} \|u-v\| has a unique solution (there is a unique closest point uUu\in\mathcal{U} to vv). If uu is the closest point to vv, then uU, uv,u\forall u\in\mathcal{U},\ \langle u-v, u'\rangle.

Theorem 13 is what gives rise to important properties like the Pythogorean Theorem for any Hilbert Space.

u2+uv2=v where u=argminuv.\|u\|^2 + \|u-v\|^2 = \|v\| \text{ where } u=\text{argmin}\|u-v\|.

Suppose we had to random variables XX and YY. What happens if we try and project one onto the other?

Definition 34

The conditional expectation of XX given YY is the bounded continuous function of YY such that XE[XY]X - \mathbb{E}\left[X|Y\right] is orthogonal to all other bounded continuous functions ϕ(Y)\phi(Y).

ϕ, E[(XE[XY])ϕ(Y)]=0.\forall \phi,\ \mathbb{E}\left[(X-\mathbb{E}\left[X|Y\right] )\phi(Y)\right] = 0.

Thus, the conditional expectation is the function of YY that is closest to XX. It’s interpretation is that the expectation of XX can change after observing some other random variable YY. To find E[XY]\mathbb{E}\left[X|Y\right] , we can use the conditional distribution of XX and YY.

Theorem 14

The conditional expectation of a conditional distribution is given by

E[XY=y]=xXxpXY(xy),E[XY=y]=xfXY(x,y)dx\mathbb{E}\left[X|Y=y\right] = \sum_{x\in\mathcal{X}}xp_{X|Y}(x|y), \quad \mathbb{E}\left[X|Y=y\right] = \int_{-\infty}^{\infty}xf_{X|Y}(x, y)dx

\label{defn:drv-conditional-expect}

Notice that E[XY]\mathbb{E}\left[X|Y\right] is a function of the random variable YY, meaning we can apply Theorem 6.

Theorem 15 (Tower Property)

For all functions ff,

E[f(Y)X]=E[f(Y)E[XY]]\mathbb{E}\left[f(Y)X\right] = \mathbb{E}\left[f(Y)\mathbb{E}\left[X|Y\right] \right]

Alternatively, we could apply lineary of expectation to Definition 34 to arrive at the same result. If we apply Theorem 15 to the function f(Y)=1f(Y) = 1, then we can see that E[E[XY]]=E[X]\mathbb{E}\left[\mathbb{E}\left[X|Y\right] \right] = \mathbb{E}\left[X\right] .

Just as expectation can change when we know additional information, so can variance.

Definition 35

Conditional Variance is the variance of XX given the value of YY.

Var(XY=y)=E[(XE[XY=y])2Y=y]=E[X2Y=y]E[XY=y]2\text{Var}\left(X|Y=y\right) = \mathbb{E}\left[(X - \mathbb{E}\left[X|Y=y\right] )^2 | Y=y\right] = \mathbb{E}\left[X^2|Y=y\right] - \mathbb{E}\left[X|Y=y\right] ^2

Conditional variance is a random variable just as expectation is.

Theorem 16 (Law of Total Variance)

Var(X)=E[Var(XY)]+Var(E[XY])\text{Var}\left(X\right) = \mathbb{E}\left[\text{Var}\left(X|Y\right) \right] + \text{Var}\left(\mathbb{E}\left[X|Y\right] \right)

The second term in the law of total variance (Var(E[XY])\text{Var}\left(\mathbb{E}\left[X|Y\right] \right) ) can be interpreted as on average, how much uncertainty there is in XX given we know YY.

Last updated