Covariance matrix (source code)

= Covariance matrix
{wiki}

= Variance-covariance matrix
{synonym}

For a random vector $X$ with finite second moments, its covariance matrix is
$$
\operatorname{cov}(X)=\mathbb E[(X-\mathbb EX)(X-\mathbb EX)^T].
$$
It is positive semidefinite, and the variance of $a^TX$ is $a^T\operatorname{cov}(X)a$.