Covariance Matrix

مصفوفة التغاير

Definition

A matrix containing the covariance of every pair of variables, describing their spread and linear relationships.

Definition

The covariance matrix collects pairwise covariances between variables; its diagonal holds variances and it underlies PCA and multivariate Gaussians.

Practical examples

Code example Python
import numpy as np

X = np.array([[1, 2], [2, 4], [3, 6]], dtype=float).T
print(np.cov(X))

Expected output

[[1. 2.]
 [2. 4.]]

Learn and review

Suggested terms to learn next