The multivariate Gaussian is a probability density over real vectors, x=x1⋮xd∈Rd, which is parameterized by a mean vector μ∈Rd and a covariance matrix Σ∈S+d (i.e., a d-dimensional positive-definite symmetric matrix). The density function is
p(x)=N(x∣μ,Σ)=(2π)d/2∣Σ∣1/21e−21∥x−μ∥Σ2,(1.12)
where ∣Σ∣ is the determinant of Σ, and
∥x−μ∥Σ2=(x−μ)TΣ−1(x−μ)(1.13)
is the Mahalanobis distance. In this problem, we will look at how different covariance matrices affect the shape of the density.
First, consider the case where Σ is a diagonal matrix, i.e., the off-diagonal entries are 0,
Σ=σ120⋱0σd2.(1.14)
(a) Show that with a diagonal covariance matrix, the multivariate Gaussian is equivalent to assuming that the elements of the vector are independent, and each is distributed as a univariate Gaussian, i.e.,
N(x∣μ,Σ)=i=1∏dN(xi∣μi,σi2).(1.15)
Hint: the following properties of diagonal matrices will be useful:
∣Σ∣=i=1∏dσi2,Σ−1=σ1210⋱0σd21.(1.16)
(b) Plot the Mahalanobis distance term and probability density function for a 2-dimensional Gaussian with μ=[00], and Σ=[1000.25]. How is the shape of the density affected by the diagonal terms?
(c) Plot the Mahalanobis distance term and pdf when the variances of each dimension are the same, e.g., μ=[00], and Σ=[1001]. This is sometimes called an i.i.d. (independently and identically distributed) covariance matrix, isotropic covariance matrix, or circular covariance matrix.
Next, we will consider the general case for the covariance matrix.
(d) Let {λi,vi} be the eigenvalue/eigenvector pairs of Σ, i.e.,
Σvi=λivi,i∈{1,⋯,d}.(1.17)
Show that Σ can be written as
Σ=VΛVT,(1.18)
where V=[v1,⋯,vd] is the matrix of eigenvectors, and Λ=diag(λ1,⋯,λd) is a diagonal matrix of the eigenvalues.
(e) Let y=VT(x−μ). Show that the Mahalanobis distance ∥x−μ∥Σ2 can be rewritten as ∥y∥Λ2, i.e., a Mahalanobis distance with a diagonal covariance matrix. (Hint: use Problem 1.12). Hence, in the space of y, the multivariate Gaussian has a diagonal covariance matrix.
(f) Consider the transformation from y to x: x=Vy+μ. What is the effect of V and μ?
(g) Plot the Mahalanobis distance term and probability density function for a 2-dimensional Gaussian with μ=[00], and Σ=[0.6250.3750.3750.625]. How is the shape of the density affected by the eigenvectors and eigenvalues of Σ?