# How to Calculate the Variance of a Matrix

Written by naeem ahmed
• Share
• Tweet
• Share
• Email

Variance is used to determine how data are spread around some central value, such as a mean. If the data is expressed in a matrix form, a variance-covariance matrix can be generated from that. The covariance characterises how two datasets are correlated with each other. One can then use this variance-covariance matrix to determine the generalised variance of the matrix. This is generally done by calculating the determinant of the variance-covariance matrix.

Skill level:
Moderate

## Instructions

1. 1

Transform the raw matrix X having n rows and k columns into deviation data matrix x in the form x=X-II'X(1/n). Here I is an nx1 column vector of ones and I' is its transpose, that is a 1xn row vector of ones. To calculate this, first multiply the matrix X with the row vector I and then multiply the resultant with the column vector I. Then divide each element of the matrix you just obtained with n. Subtracting each element of the new matrix from the corresponding entries in the original matrix X would give the required x.

2. 2

Multiply the transpose of x with x, that is determine x'x. The transpose is obtained by switching the rows of a matrix with its columns, that is by effectively rotating the matrix. Matrices are multiplied together by multiplying the elements of rows of the first matrix with elements of columns of the second matrix.

3. 3

Divide each term of the x'x matrix with n to obtain the variance-covariance matrix, that is V=(1/n)x'x.

4. 4

Calculate the determinant of matrix V. For a 2x2 matrix, this is simply the product of the left diagonal terms minus the produce of the right diagonal terms. For higher order matrices, consult the references provided below. The determinant thus calculated is the generalised variance of the original data.

### Don't Miss

#### References

• All types
• Articles
• Slideshows
• Videos
##### Sort:
• Most relevant
• Most popular
• Most recent