For a random vector X=(X1,,Xd)X=(X_1,\ldots,X_d) with finite second moment, its covariance matrix is

Cov(X)=E[(XEX)(XEX)T].\operatorname{Cov}(X)=\mathbb E[(X-\mathbb EX)(X-\mathbb EX)^T].

Its (i,j)(i,j) entry is the scalar Cov(Xi,Xj)\operatorname{Cov}(X_i,X_j). Equivalently, it is E[XXT](EX)(EX)T\mathbb E[XX^T]-(\mathbb EX)(\mathbb EX)^T.

Positivity and degeneracy

For every aa, aTCov(X)a=Var(aX)0a^T\operatorname{Cov}(X)a=\operatorname{Var}(a\cdot X)\ge0. It is positive definite precisely when no nonzero linear combination aXa\cdot X is almost surely constant. The deterministic choice of a probability average on a torus gives the same matrix construction for a periodic vector field.

Velocity fluctuations

is the covariance matrix of a fluctuating velocity. Its sign in a momentum equation depends on which side contains the tensor divergence.