Ramp-Up Mathematics: Stochastics Section 4
Section 4 · Part II: Extended notes

Random variables, moments and random vectors

All definitions, theorems, proofs and examples appear here verbatim and with the same numbering as in the lecture notes. Shaded boxes marked Learning aid are supplements for practice: learning goals, interactive experiments and self-tests. Proofs are collapsed; “Step by step” reveals them one paragraph at a time.

4.1 Measurability

Since the half-lines \((-\infty,x]\) generate \(\B(\R)\), a map \(X\colon\Omega\to\R\) is a random variable if and only if \(\{X\le x\}\in\F\) for all \(x\in\R\); see [Klenke2020]. A map \(g\colon\R^n\to\R\) is called measurable if \(g^{-1}(B)\in\B(\R^n)\) for all \(B\in\B(\R)\); continuous, monotone and piecewise continuous functions are measurable.

Proposition 4.1 (Operations on random variables)

Let \(X_1,X_2,\dots\) be real random variables on \((\Omega,\F,\P)\).

  1. (i)

    For every measurable \(g\colon\R^n\to\R\), the map \(g(X_1,\dots,X_n)\) is a random variable. In particular, sums, products and linear combinations of random variables are random variables.

  2. (ii)

    If \(\sup_{n}X_n(\omega)<\infty\) for all \(\omega\in\Omega\), then \(\sup_nX_n\) is a random variable; the same holds for \(\inf_n X_n\), \(\limsup_{n\to\infty}X_n\) and \(\liminf_{n\to\infty}X_n\) when they are finite. Moreover, \(\{\omega\colon\lim_{n\to\infty}X_n(\omega)\text{ exists}\}\in\F\).

Sketch of proof

For (i), \((X_1,\dots,X_n)\) is an \(\R^n\)-valued random variable, and compositions of measurable maps are measurable. For (ii), \(\{\sup_nX_n\le x\}=\bigcap_n\{X_n\le x\}\in\F\); the other cases follow similarly; see [Klenke2020].

□

4.2 Expectation and moments

For a general random variable, \(\E[X]\) is the Lebesgue integral \(\int_\Omega X\,\d\P\) (Remark 1.13). The following results from integration theory are used repeatedly; see [Klenke2020].

Remark 4.2 (Convergence theorems and Fubini's theorem)

Let \(X,X_1,X_2,\dots\) be random variables with \(X_n\to X\) pointwise on \(\Omega\).

  1. (i)

    Monotone convergence: if \(0\le X_1\le X_2\le\cdots\), then \(\E[X_n]\to\E[X]\) in \([0,\infty]\).

  2. (ii)

    Dominated convergence: if \(|X_n|\le Y\) for all \(n\) and a random variable \(Y\) with \(\E[Y]<\infty\), then \(\E[X_n]\to\E[X]\).

  3. (iii)

    Fubini's theorem: let \(g\colon\R^2\to\R\) be measurable. If \(g\ge0\) or \(\int_{\R^2}|g(x,y)|\dd(x,y)<\infty\), then \[\int_\R\Big(\int_\R g(x,y)\dd x\Big)\dd y=\int_\R\Big(\int_\R g(x,y)\dd y\Big)\dd x;\] the same holds for sums and for products of probability measures.

Proposition 4.3 (Tail formula)

Let \(X\) be a random variable with values in \(\N_0\). Then \[\E[X]=\sum_{n=1}^\infty\P(X\ge n)\in[0,\infty].\]

Proof

Since all terms are non-negative, we may interchange the order of summation, which gives \[\sum_{n=1}^\infty\P(X\ge n)=\sum_{n=1}^\infty\sum_{k=n}^\infty\P(X=k)=\sum_{k=1}^\infty k\,\P(X=k)=\E[X].\]

□

For example, a geometrically distributed \(X\) (Example 1.3) satisfies \(\P(X\ge n)=(1-p)^n\), and hence \(\E[X]=(1-p)/p\). Similarly, \(\E[X]=\int_0^\infty\P(X>x)\dd x\) for every random variable \(X\ge0\).

Proposition 4.4 (Moments)

Let \(X\) be a random variable.

  1. (i)

    If \(0<p\le q\) and \(\E[|X|^q]<\infty\), then \(\E[|X|^p]<\infty\). In particular, every random variable with \(\E[X^2]<\infty\) has a finite expectation and a finite variance.

  2. (ii)

    Markov's inequality for moments: for all \(\varepsilon>0\) and \(r>0\), \[\P(|X|\ge\varepsilon)\le\varepsilon^{-r}\,\E[|X|^r].\]

Proof

For (i), we use \(|x|^p\le1+|x|^q\) for all \(x\in\R\) and the monotonicity of the expectation. Part (ii) follows as in the proof of Markov's inequality (Remark 1.14 (iv)): the pointwise bound \(\varepsilon^r\1\{|X|\ge\varepsilon\}\le|X|^r\) and monotonicity of the expectation give the claim.

□

Table 1 collects the distributions used in these notes. The moments follow from Remark 1.13; for instance, for the Poisson distribution, \(\E[X(X-1)]=\sum_{k\ge2}k(k-1)\e^{-\lambda}\lambda^k/k!=\lambda^2\), and hence \(\Var[X]=\lambda^2+\lambda-\lambda^2=\lambda\).

distributiondensityexpectationvariance
\(\Bin_{n,p}\), \(p\in[0,1]\)\(\binom nk p^k(1-p)^{n-k}\), \(k=0,\dots,n\)\(np\)\(np(1-p)\)
\(\Hyp_{n;w,N-w}\)\(\binom wk\binom{N-w}{n-k}\big/\binom Nn\), \(k=0,\dots,n\)\(nw/N\)\(n\frac wN\big(1-\frac wN\big)\frac{N-n}{N-1}\)
\(\Poi_\lambda\), \(\lambda>0\)\(\e^{-\lambda}\lambda^k/k!\), \(k\in\N_0\)\(\lambda\)\(\lambda\)
\(\Geo_p\), \(p\in(0,1]\)\((1-p)^kp\), \(k\in\N_0\)\((1-p)/p\)\((1-p)/p^2\)
\(\Unif_{[a,b]}\), \(a<b\)\((b-a)^{-1}\1\{a\le x\le b\}\)\((a+b)/2\)\((b-a)^2/12\)
\(\Exp_\lambda\), \(\lambda>0\)\(\lambda\e^{-\lambda x}\1\{x\ge0\}\)\(1/\lambda\)\(1/\lambda^2\)
\(\Nor(\mu,\sigma^2)\), \(\sigma>0\)\((2\pi\sigma^2)^{-1/2}\e^{-(x-\mu)^2/(2\sigma^2)}\)\(\mu\)\(\sigma^2\)
Table 1. Common distributions with their discrete or Lebesgue densities, expectations and variances.

4.3 Random vectors

A random vector is an \(\R^n\)-valued random variable \(\vect X=(X_1,\dots,X_n)^\top\), see Section 1.4; equivalently, \(X_1,\dots,X_n\) are real random variables on the same probability space. Its distribution \(\P_{\vect X}\) on \((\R^n,\B(\R^n))\) is called the joint distribution of \(X_1,\dots,X_n\), and \[F_{\vect X}(\vect x)\coloneqq\P(X_1\le x_1,\dots,X_n\le x_n),\qquad\vect x\in\R^n,\] is its joint distribution function. As in one dimension, \(F_{\vect X}\) determines \(\P_{\vect X}\). If \(\vect X\) takes at most countably many values, its joint discrete density is \(\rho_{\vect X}(\vect x)\coloneqq\P(\vect X=\vect x)\), and the marginal densities are obtained by summing over the other coordinates, \[\rho_{X_i}(x_i)=\sum_{x_1,\dots,x_{i-1},x_{i+1},\dots,x_n}\rho_{\vect X}(x_1,\dots,x_n).\] A measurable \(f_{\vect X}\colon\R^n\to[0,\infty)\) is a joint density of \(\vect X\) if \(\P(\vect X\in B)=\int_Bf_{\vect X}(\vect x)\dd\vect x\) for all \(B\in\B(\R^n)\). Then \(X_i\) has the marginal density obtained by integrating out the other coordinates, \[f_{X_i}(x_i)=\int_{\R^{n-1}}f_{\vect X}(x_1,\dots,x_n)\dd x_1\cdots\dd x_{i-1}\dd x_{i+1}\cdots\dd x_n.\]

Proposition 4.5 (Characterisations of independence)

Let \(\vect X=(X_1,\dots,X_n)^\top\) be a random vector. The following are equivalent.

  1. (i)

    \(X_1,\dots,X_n\) are independent in the sense of Definition 1.19.

  2. (ii)

    \(F_{\vect X}(\vect x)=F_{X_1}(x_1)\cdots F_{X_n}(x_n)\) for all \(\vect x\in\R^n\).

  3. (iii)

    \(\P_{\vect X}=\P_{X_1}\otimes\dots\otimes\P_{X_n}\).

If \(\vect X\) is discrete, they are also equivalent to \(\rho_{\vect X}(\vect x)=\prod_{i=1}^n\rho_{X_i}(x_i)\) for all \(\vect x\). If every \(X_i\) has a density \(f_{X_i}\), they are also equivalent to \(\vect x\mapsto\prod_{i=1}^nf_{X_i}(x_i)\) being a joint density of \(\vect X\). Moreover, if \(X_1,\dots,X_n\) are independent and \(g_1,\dots,g_n\colon\R\to\R\) are measurable, then \(g_1(X_1),\dots,g_n(X_n)\) are independent.

Sketch of proof

Choosing \(A_i=(-\infty,x_i]\) in Definition 1.19 shows that (i) implies (ii). Under (ii), both measures in (iii) agree on the products of half-lines, a family that is closed under intersections and generates \(\B(\R^n)\), so they agree. Evaluating (iii) on \(A_1\times\dots\times A_n\) gives (i). The last claim follows from \(g_i(X_i)^{-1}(B)=X_i^{-1}(g_i^{-1}(B))\); see [Klenke2020] for details.

□

For a measurable \(g\colon\R^n\to\R\), the transformation formula of Remark 1.13 becomes \[\E[g(\vect X)]=\sum_{\vect x}g(\vect x)\rho_{\vect X}(\vect x) \qquad\text{respectively}\qquad \E[g(\vect X)]=\int_{\R^n}g(\vect x)f_{\vect X}(\vect x)\dd\vect x,\] whenever \(g\ge0\) or the right-hand side is finite with \(|g|\) in place of \(g\).

Proposition 4.6 (Properties of the covariance)

Let \(X,Y,Z\) be random variables with finite second moments and \(a,b\in\R\).

  1. (i)

    \(\Cov[X,Y]=\E[XY]-\E[X]\E[Y]\), \(\Cov[X,X]=\Var[X]\), and \(\Cov\) is symmetric and bilinear, for instance \(\Cov[aX+bY,Z]=a\Cov[X,Z]+b\Cov[Y,Z]\).

  2. (ii)

    \(\Var[X]=0\) if and only if \(X=\E[X]\) almost surely, that is, \(\P(X=\E[X])=1\).

  3. (iii)

    Cauchy–Schwarz inequality: \(\Cov[X,Y]^2\le\Var[X]\Var[Y]\).

  4. (iv)

    If \(\Var[X]\neq0\neq\Var[Y]\), then \(|\Corr[X,Y]|=1\) if and only if there are \(a\neq0\) and \(b\in\R\) with \(Y=aX+b\) almost surely; in this case, \(a\) has the sign of \(\Corr[X,Y]\).

Proof

Part (i) follows from linearity of the expectation. For (ii), Chebyshev's inequality (Remark 1.17) gives \(\P(|X-\E[X]|\ge\varepsilon)=0\) for all \(\varepsilon>0\) if \(\Var[X]=0\), and continuity from below yields \(\P(X\neq\E[X])=0\); the converse is immediate. For (iii) and (iv), we may assume \(\Var[X]>0\) and consider \[h(t)\coloneqq\Var[Y-tX]=\Var[Y]-2t\Cov[X,Y]+t^2\Var[X]\ge0,\qquad t\in\R.\] A quadratic polynomial that is non-negative has a non-positive discriminant, which is (iii). Equality in (iii) holds if and only if \(h\) has a zero \(t_0\), that is, if and only if \(Y-t_0X\) is almost surely constant by (ii). In this case, \(t_0=\Cov[X,Y]/\Var[X]\), which is non-zero and has the sign of the correlation.

□

For a random vector \(\vect X\) whose coordinates have finite second moments, we write \(\E[\vect X]\coloneqq(\E[X_i])_{i}\) and call \[\Cov[\vect X]\coloneqq\big(\Cov[X_i,X_j]\big)_{i,j=1}^n\] the covariance matrix of \(\vect X\).

Proposition 4.7 (Affine transformations of random vectors)

Let \(\vect X\) be a random vector with values in \(\R^n\) whose coordinates have finite second moments, and let \(\vect B\in\R^{m\times n}\) and \(\vect b\in\R^m\).

  1. (i)

    \(\Cov[\vect X]\) is symmetric and positive semidefinite, since \(\langle\vect\lambda,\Cov[\vect X]\vect\lambda\rangle=\Var[\langle\vect\lambda,\vect X\rangle]\ge0\) for all \(\vect\lambda\in\R^n\).

  2. (ii)

    \(\E[\vect B\vect X+\vect b]=\vect B\,\E[\vect X]+\vect b\) and \(\Cov[\vect B\vect X+\vect b]=\vect B\Cov[\vect X]\vect B^\top\).

Proof

Both parts follow from the linearity of the expectation and the bilinearity of the covariance (Proposition 4.6).

□

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

Proposition 4.8 (Convolution)

Let \(X\) and \(Y\) be independent random variables.

  1. (i)

    If \(X\) and \(Y\) have densities \(f_X\) and \(f_Y\), then \(X+Y\) has the density \[f_{X+Y}(z)=\int_\R f_X(z-y)f_Y(y)\dd y=\int_\R f_X(x)f_Y(z-x)\dd x,\qquad z\in\R.\]

  2. (ii)

    If \(X\) and \(Y\) are discrete, then \(\P(X+Y=z)=\sum_{x}\P(X=x)\,\P(Y=z-x)\) for all \(z\in\R\).

Proof

For (i), Proposition 4.5 gives the joint density \(f_X(x)f_Y(y)\), and Fubini's theorem and the substitution \(u=x+y\) yield \[\P(X+Y\le z)=\int_\R\int_\R\1\{x+y\le z\}f_X(x)f_Y(y)\dd x\dd y=\int_{-\infty}^z\Big(\int_\R f_X(u-y)f_Y(y)\dd y\Big)\dd u.\] Part (ii) follows from \(\{X+Y=z\}=\bigcup_x\{X=x,Y=z-x\}\) and independence.

□
Example 4.9 (Convolutions)
  1. (i)

    If \(U_1,U_2\) are independent and uniformly distributed on \([0,1]\), then \(U_1+U_2\) has the triangular density \(f(z)=z\) for \(z\in[0,1]\), \(f(z)=2-z\) for \(z\in[1,2]\), and \(f(z)=0\) otherwise.

  2. (ii)

    If \(X,Y\) are independent and exponentially distributed with parameter \(\lambda\), then \(X+Y\) has the density \(f(z)=\int_0^z\lambda\e^{-\lambda x}\lambda\e^{-\lambda(z-x)}\dd x=\lambda^2z\e^{-\lambda z}\) for \(z\ge0\).

  3. (iii)

    If \(X\sim\Poi_\lambda\) and \(Y\sim\Poi_\mu\) are independent, then the binomial theorem gives \[\P(X+Y=n)=\sum_{k=0}^n\e^{-\lambda}\frac{\lambda^k}{k!}\,\e^{-\mu}\frac{\mu^{n-k}}{(n-k)!}=\e^{-(\lambda+\mu)}\frac{(\lambda+\mu)^n}{n!},\] so \(X+Y\sim\Poi_{\lambda+\mu}\).

  4. (iv)

    Sums of independent normally distributed random variables are normally distributed; see Proposition 6.1.

Abbildung aus dem Skript

Figure 17. Convolutions from Example 4.9. Left: the sum of two independent uniform random variables on \([0,1]\) has a triangular density. Right: the sum of two independent exponential random variables with parameter \(\lambda=1\) has the density \(z\e^{-z}\), \(z\ge0\).

4.4 Conditional expectations

We extend Section 1.7 for discrete random variables \(X,Y\) with \(\E[|X|]<\infty\). For a value \(y\) of \(Y\) with \(\P(Y=y)>0\), we write \(\E[X\lvert Y=y]\coloneqq\sum_ix_i\,\rho(x_i\lvert y)\), so that \(\E[X\lvert Y](\omega)=\E[X\lvert Y=Y(\omega)]\).

Proposition 4.10 (Properties of conditional expectations)

Let \(X,X',Y\) be discrete random variables with \(\E[|X|],\E[|X'|]<\infty\), and let \(a,b\in\R\). The following hold almost surely.

  1. (i)

    Linearity: \(\E[aX+bX'\lvert Y]=a\E[X\lvert Y]+b\E[X'\lvert Y]\).

  2. (ii)

    Taking out what is known: \(\E[g(Y)X\lvert Y]=g(Y)\E[X\lvert Y]\) for every \(g\colon\R\to\R\) with \(\E[|g(Y)X|]<\infty\); in particular, \(\E[g(Y)\lvert Y]=g(Y)\).

  3. (iii)

    Defining property: \(\E\big[\E[X\lvert Y]\,h(Y)\big]=\E[X\,h(Y)]\) for every bounded \(h\colon\R\to\R\); for \(h=1\), this is Remark 1.24 (i).

  4. (iv)

    Independence: if \(X\) and \(Y\) are independent, then \(\E[X\lvert Y]=\E[X]\).

  5. (v)

    Best prediction: if \(\E[X^2]<\infty\), then \(\E\big[(X-\E[X\lvert Y])^2\big]\le\E\big[(X-h(Y))^2\big]\) for every \(h\colon\R\to\R\).

Proof

Parts (i), (ii) and (iv) follow by direct computation from Definition 1.23. For (iii), we sum over the values \(y\) of \(Y\) with \(\P(Y=y)>0\) and obtain \[\E\big[\E[X\lvert Y]h(Y)\big]=\sum_yh(y)\sum_ix_i\,\rho(x_i\lvert y)\P(Y=y)=\sum_y\sum_ih(y)x_i\,\P(X=x_i,Y=y),\] which equals \(\E[Xh(Y)]\). For (v), we write \[\E\big[(X-h(Y))^2\big]=\sum_y\P(Y=y)\sum_i\big(x_i-h(y)\big)^2\rho(x_i\lvert y).\] For fixed \(y\), the inner sum is the mean squared deviation of the probability distribution \(\rho(\cdot\lvert y)\) from \(h(y)\). This distribution has a finite second moment, since \(\sum_ix_i^2\rho(x_i\lvert y)\le\E[X^2]/\P(Y=y)\). By Remark 1.17 (iii), the inner sum is minimal for \(h(y)=\E[X\lvert Y=y]\).

□

Part (v) generalises Remark 1.17 (iii): the best constant prediction of \(X\) is \(\E[X]\), and the best prediction of \(X\) by a function of \(Y\) is \(\E[X\lvert Y]\).

Example 4.11 (Two dice)

Let \(X_1,X_2\) be the results of two fair dice, as in Example 1.6, and \(S\coloneqq X_1+X_2\). The pairs \((X_1,S)\) and \((X_2,S)\) have the same distribution, so \(\E[X_1\lvert S]=\E[X_2\lvert S]\). By (i) and (ii), \(\E[X_1\lvert S]+\E[X_2\lvert S]=\E[S\lvert S]=S\), and hence \(\E[X_1\lvert S]=S/2\).

For continuous random variables, the conditional density of Remark 1.24 (iv) leads to the same properties; the general theory is developed in [Klenke2020,Durrett2019]. An explicit continuous example is the normal distribution in Proposition 6.6.