# Wolfram Language & System 10.3 (2015)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.
BUILT-IN WOLFRAM LANGUAGE SYMBOL

# Covariance

Covariance[v1,v2]
gives the covariance between the vectors and .

Covariance[m]
gives the covariance matrix for the matrix m.

Covariance[m1,m2]
gives the covariance matrix for the matrices and .

Covariance[dist]
gives the covariance matrix for the multivariate symbolic distribution dist.

Covariance[dist,i,j]
gives the covariance for the multivariate symbolic distribution dist.

## DetailsDetails

• Covariance[v1,v2] gives the unbiased estimate of the covariance between and .
• The lists and must be the same length.
• Covariance[v1,v2] is equivalent to (v1-Mean[v1]). Conjugate[v2-Mean[v2]]/(Length[v1]-1).
• For a matrix m with columns, Covariance[m] is a × matrix of the covariances between columns of m.
• For an × matrix and an × matrix , Covariance[m1,m2] is a × matrix of the covariances between columns of and columns of .
• Covariance works with SparseArray objects.
• Covariance[dist,i,j] gives Expectation[(xi-μi)(xj-μj),{x1,x2,}dist], where is the i component of the mean of dist.
• Covariance[dist] gives a covariance matrix with the entry given by Covariance[dist,i,j].

## ExamplesExamplesopen allclose all

### Basic Examples  (3)Basic Examples  (3)

Covariance between two vectors:

 Out[1]=

Covariance matrix for a matrix:

 Out[1]//MatrixForm=

Covariance matrix for two matrices:

 Out[1]//MatrixForm=