MIT 18.650 — Lecture 5

Multivariate Random Vectors

Definition. A random vector X∈RkX \in \mathbb{R}^k is just a vector of random variables X=(X1,X2,…,Xk)X = (X_1, X_2, \dots, X_k).

Definition. The expectation of XX is what you'd expect: E[X]:=(E[X1],E[X2],…,E[Xk])\mathbb{E}[X] := (\mathbb{E}[X_1], \mathbb{E}[X_2], \dots, \mathbb{E}[X_k]).

To define the variance of XX, however, it is not enough to take the variances of each individual XiX_i. That doesn't capture the pairwise covariances between the XiX_i.

Definition. The covariance between XiX_i and XjX_j is Cov⁡(Xi,Xj):=E[(Xi−μi)(Xj−μj)]=E[XiXj]−μiμj\Cov(X_i, X_j) := \mathbb{E}[(X_i - \mu_i)(X_j - \mu_j)] = \mathbb{E}[X_iX_j] - \mu_i \mu_j.

Remark. Here's how covariance relates to dependence / independence.

And here are some algebraic properties of covariance.

That last bullet point is particularly interesting; here's the derivation:

Var⁡(X+Y)=E[(X+Y)2]−E[X+Y]2=(E[X2]+E[Y2]+E[2XY])−(μX2+μY2+2μXμY)=(E[X2]−μX2)+(E[Y2]−μY2)+2(E[XY]−μXμY)=Var⁡(X)+Var⁡(Y)+2Cov⁡(X,Y).\begin{align*}\Var(X + Y) & = \mathbb{E}[(X + Y)^2] - \mathbb{E}[X + Y]^2 \\ & = \left(\mathbb{E}[X^2] + \mathbb{E}[Y^2] + \mathbb{E}[2XY]\right) - \left(\mu_X^2 + \mu_Y^2 + 2\mu_X\mu_Y\right) \\ & = \left(\mathbb{E}[X^2] - \mu_X^2\right) + \left(\mathbb{E}[Y^2] - \mu_Y^2\right) + 2 \left(\mathbb{E}[XY] - \mu_X\mu_Y\right) = \Var(X) + \Var(Y) + 2\Cov(X, Y).\end{align*}

Definition. The variance (covariance matrix) of a random vector X∈RkX \in \mathbb{R}^k is the k×kk \times k matrix of pairwise covariances.

Σ=E[(X−μ)(X−μ)⊤]=E[XX⊤]−μμ⊤.\Sigma = \mathbb{E}[(X - \mu)(X - \mu)^{\top}] = \mathbb{E}[XX^{\top}] - \mu\mu^{\top}.

Note that, equivalently, Σi,j=Cov⁡(Xi,Xj)\Sigma_{i, j} = \Cov(X_i, X_j) for all entries (i,j)(i, j).

Theorem. (Transforming Random Vectors) Consider X∈RkX \in \mathbb{R}^k with E[X]=μ\mathbb{E}[X] = \mu and V[X]=Σ\mathbb{V}[X] = \Sigma.

Proof: It's all just algebra.

Really, the first and second bullet points of this theorem are the same. Think of a∈Rka \in \mathbb{R}^k as a k×1k \times 1 matrix.   ■\blacksquare

Remark. This isn't part of 18.650, but it's worth knowing.

Notice that the covariance matrix Σ\Sigma is always symmetric. Therefore, we may apply the Spectral Theorem, which says Σ=QΛQ⊤\Sigma = Q \Lambda Q^{\top}, where Λ=diag(λ1,…,λk)\Lambda = \mathrm{diag}(\lambda_1, \dots, \lambda_k) (eigenvalues) and QQ is the orthonormal eigenbasis.

Furthermore, Σ\Sigma is positive semidefinite: for any eigen-pair (qi,λi)(q_i, \lambda_i), we have:

V[qi⊤X]=qi⊤Σqi=qi⊤(λiqi)=λi⋅∥qi∥2.\mathbb{V}[q_i^{\top}X] = q_i^{\top} \Sigma q_i = q_i^{\top} (\lambda_i q_i) = \lambda_i \cdot \| q_i \|^2.

Therefore, since variance is nonnegative, every eigenvalue λi\lambda_i is nonnegative!

It turns out that a matrix MM can be a covariance matrix if and only if MM is symmetric positive semidefinite.

Furthermore, 1c⊤cVar⁡(c⊤X)\frac{1}{c^{\top}c}\Var(c^{\top}X) is maximized when cc is the eigenvector with greatest eigenvalue. See 18.701 notes; this gives rise to Principal Component Analysis (PCA), where the eigenvectors are the principal components of XX.