# Multivariate normal distribution

In probability theory and statistics, a multivariate normal distribution, also sometimes called a multivariate Gaussian distribution (in honor of Carl Friedrich Gauss, who was not the first to write about the normal distribution) is a specific probability distribution.

 Contents

## General case

A random vector [itex]X = [X_1, \cdots, X_N][itex] follows a multivariate normal distribution, also sometimes called a multivariate Gaussian distribution, if it satisfies the following equivalent conditions:

• there is a random vector [itex]Z = [Z_1, \cdots, Z_M][itex], whose components are independent standard normal random variables, a vector [itex]\mu = [\mu_1, \cdots, \mu_N][itex] and an [itex]N \times M[itex] matrix [itex]A[itex] such that [itex]X = A Z + \mu[itex].
• there is a vector [itex]\mu[itex] and a symmetric, positive semi-definite matrix [itex]\Gamma[itex] such that the characteristic function of [itex]X[itex] is
[itex]

\phi_X(u) = \exp \left(

i \mu^\top u - \frac{1}{2} u^\top \Gamma u


\right) . [itex]

The following is not quite equivalent to the conditions above, since it fails to allow for a singular matrix as the variance:

• there is a vector [itex]\mu = [\mu_1, \cdots, \mu_N][itex] and a symmetric, positive definite covariance matrix [itex]\Sigma[itex] ([itex]N \times N[itex] matrix) such that [itex]X[itex] has density
[itex]

f_X(x_1, \cdots, x_N) = \frac

{1}
{(2\pi)^{N/2} \left|\Sigma\right|^{1/2}}


\exp \left(

-\frac{1}{2}
( x - \mu)^\top \Sigma^{-1} (x - \mu)


\right) [itex]

where [itex]\left| \Sigma \right|[itex] is the determinant of [itex]\Sigma[itex]. Note how the equation above reduces to that of the univariate normal distribution if [itex]\Sigma[itex] is a scalar (i.e., a real number).

The vector [itex]\mu[itex] in these conditions is the expected value of [itex]X[itex] and the matrix [itex]\Sigma = A A^T[itex] is the covariance matrix of the components [itex]X_i[itex].

It is important to realize that the covariance matrix must be allowed to be singular. That case arises frequently in statistics; for example, in the distribution of the vector of residuals in ordinary linear regression problems. Note also that the [itex]X_i[itex] are in general not independent; they can be seen as the result of applying the linear transformation [itex]A[itex] to a collection of independent Gaussian variables [itex]Z[itex].

The multivariate normal can be written in the following notation:

[itex]X \sim N(\mu, \Sigma)[itex]

or to make it explicitly known [itex]X[itex] is N-dimensional

[itex]X \sim N_N(\mu, \Sigma)[itex]

### Cumulative distribution function

The cumulative distribution function (cdf) [itex]F(x)[itex] is defined as the probability that all values in a random vector [itex]X[itex] are less than or equal to the corresponding values in vector [itex]x[itex]. Though there is no closed form for [itex]F(x)[itex], there are a number of algorithms that estimate it numerically. For one such example, see  (http://alex.strashny.org/2005/04/multivariate_normal_cumulative_distribution_function_cdf_in_matlab.html) (includes MATLAB code).

## A counterexample

The fact that two random variables X and Y are normally distributed does not imply that the pair (XY) has a bivariate normal distribution. A simple example is one in which Y = X if |X| > 1 and Y = −X if |X| < 1.

If X and Y are normally distributed and independent, then they are "jointly normally distributed", i.e., the pair (XY) does have a bivariate normal distribution. There are of course also many bivariate normally distributions in which the components are correlated.

## Bivariate case

In the 2-dimensional nonsingular case, the probability density function is

[itex]

f(x,y) = \frac{1}{2 \pi \sigma_x \sigma_y \sqrt{1-\rho^2}} \exp \left(

-\frac{1}{2 (1-\rho^2)}
\left(
\frac{x^2}{\sigma_x^2} +
\frac{y^2}{\sigma_y^2} -
\frac{2 \rho x y}{ (\sigma_x \sigma_y)}
\right)


\right) [itex]

where [itex]\rho[itex] is the correlation between [itex]X[itex] and [itex]Y[itex].

## Linear transformation

If [itex]Y = B X[itex] is a linear transformation of [itex]X[itex] where [itex]B[itex] is an [itex]m \times p[itex] matrix then [itex]Y[itex] has a multivariate normal distribution with expected value [itex]B \mu[itex]and variance [itex]B \Sigma B^T[itex] (i.e., [itex]Y \sim N \left(B \mu, B \Sigma B^T\right)[itex].

Corollary: any subset of the [itex]X_i[itex] has a marginal distribution that is also multivariate normal. To see this consider the following example: to extract the subset [itex](X_1, X_2, X_4)^T[itex], use

[itex]

B = \begin{bmatrix}

1 & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 1 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 1 & 0 & \ldots & 0


\end{bmatrix} [itex]

which extracts the desired elements directly.

## Correlations and independence

In general, random variables may be uncorrelated but highly dependent. But if a random vector has a multivariate normal distribution then any two or more of its components that are uncorrelated are independent. This implies that any two or more of its components that are pairwise independent are independent.

But it is not true that two random variables that are (separately, marginally) normally distributed and uncorrelated are independent. Two random variables that are normally distributed may fail to be jointly normally distributed, i.e., the vector whose components they are may fail to have a multivariate normal distribution. For an example of two normally distributed random variables that are uncorrelated but not independent, see normally distributed and uncorrelated does not imply independent.

## Conditional distributions

Then if [itex]\mu[itex] and [itex]\Sigma[itex] are partitioned as follows

[itex]

\mu = \begin{bmatrix}

\mu_1 \\
\mu_2


\end{bmatrix} \quad[itex] with sizes [itex]\begin{bmatrix} q \times 1 \\ N-q \times 1 \end{bmatrix}[itex]

[itex]

\Sigma = \begin{bmatrix}

\Sigma_{11} & \Sigma_{12} \\
\Sigma_{21} & \Sigma_{22}


\end{bmatrix} \quad[itex] with sizes [itex]\begin{bmatrix} q \times q & q \times N-q \\ N-q \times q & N-q \times N-q \end{bmatrix}[itex]

then the distribution of [itex]x_1[itex] conditional on [itex]x_2=a[itex] is multivariate normal [itex]X_1|X_2=a \sim N(\bar{\mu}, \overline{\Sigma})[itex] where

[itex]

\bar{\mu} = \mu_1 + \Sigma_{12} \Sigma_{22}^{-1} \left(

a - \mu_2


\right) [itex]

and covariance matrix

[itex]

\overline{\Sigma} = \Sigma_{11} - \Sigma_{12} \Sigma_{22}^{-1} \Sigma_{21}. [itex]

This matrix is the Schur complement of [itex]{\mathbf\Sigma_{22}}[itex] in [itex]{\mathbf\Sigma}[itex].

Note that knowing the value of [itex]x_2[itex] to be [itex]a[itex] alters the variance; perhaps more surprisingly, the mean is shifted by [itex]\Sigma_{12} \Sigma_{22}^{-1} \left(a - \mu_2 \right)[itex]; compare this with the situation of not knowing the value of [itex]a[itex], in which case [itex]x_1[itex] would have distribution [itex]N_q \left(\mu_1, \Sigma_{11} \right)[itex].

The matrix [itex]\Sigma_{12} \Sigma_{22}^{-1}[itex] is known as the matrix of regression coefficients.

## Fisher information matrix

The Fisher information matrix (FIM) for a normal distribution takes a special formulation. The [itex](m,n)[itex] element of the FIM for [itex]X \sim N(\mu(\theta), \Sigma(\theta))[itex] is

[itex]

\mathcal{I}_{m,n} = \frac{\partial \mu}{\partial \theta_m} \Sigma^{-1} \frac{\partial \mu^\top}{\partial \theta_n} + \frac{1}{2} \mathrm{tr} \left(

\Sigma^{-1}
\frac{\partial \Sigma}{\partial \theta_m}
\Sigma^{-1}
\frac{\partial \Sigma}{\partial \theta_n}


\right) [itex]

where

• [itex]

\frac{\partial \mu}{\partial \theta_m} = \begin{bmatrix}

\frac{\partial \mu_1}{\partial \theta_m} &
\frac{\partial \mu_2}{\partial \theta_m} &
\cdots &
\frac{\partial \mu_N}{\partial \theta_m} &


\end{bmatrix} [itex]

• [itex]

\frac{\partial \mu^\top}{\partial \theta_m} = \left(

\frac{\partial \mu}{\partial \theta_m}


\right)^\top = \begin{bmatrix}

\frac{\partial \mu_1}{\partial \theta_m} \\  \\
\frac{\partial \mu_2}{\partial \theta_m} \\  \\
\vdots \\  \\
\frac{\partial \mu_N}{\partial \theta_m} \\  \\


\end{bmatrix} [itex]

• [itex]

\frac{\partial \Sigma}{\partial \theta_m} = \begin{bmatrix}

\frac{\partial \Sigma_{1,1}}{\partial \theta_m} &
\frac{\partial \Sigma_{1,2}}{\partial \theta_m} &
\cdots &
\frac{\partial \Sigma_{1,N}}{\partial \theta_m} \\  \\
\frac{\partial \Sigma_{2,1}}{\partial \theta_m} &
\frac{\partial \Sigma_{2,2}}{\partial \theta_m} &
\cdots &
\frac{\partial \Sigma_{2,N}}{\partial \theta_m} \\  \\
\vdots & \vdots & \ddots & \vdots \\  \\
\frac{\partial \Sigma_{N,1}}{\partial \theta_m} &
\frac{\partial \Sigma_{N,2}}{\partial \theta_m} &
\cdots &
\frac{\partial \Sigma_{N,N}}{\partial \theta_m}


\end{bmatrix} [itex]

• [itex]\mathrm{tr}[itex] is the trace function

## Estimation of parameters

The derivation of the maximum-likelihood estimator of the covariance matrix of a multivariate normal distribution is perhaps surprisingly subtle and elegant. See estimation of covariance matrices.

In short, the pdf is

[itex]f(x)=(2 \pi)^{-p/2} \det(\Sigma)^{-1/2} \exp\left({-1 \over 2} (x-\mu)^T \Sigma^{-1} (x-\mu)\right)[itex]

and the ML estimator of the covariance matrix is

[itex]\Sigma = {1 \over n}\sum_{i=1}^n (X_i-\overline{X})(X_i-\overline{X})^T[itex]

which is simply the sample covariance matrix.

## Generating values drawn from the distribution

To generate values from a multivariate normal distribution given μ and A such that X = AZ + μ as detailed above, simply generate a suitable vector of independent standard normal values Z using for example the Box-Muller transform, and apply the foregoing equation.

Given only the covariance matrix Q, one can generate a suitable A using Cholesky decomposition.

• Art and Cultures
• Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
• Space and Astronomy