I want to measure the scale of a 2d matrix that contains the coordinates (x,y) of a set of point. I know that the standard deviation of the x coordinates of these points is the scale of the x coordinates, and the same for the standard deviation of the y coordinates. I looked for a way to calculate the standard deviation of the whole matrix but apparently the standard deviation is defined for 1d vectors only. But I noticed that some people use the square of the norm of the covariance matrix as a scale. Does that mean that the covariance matrix is the equivalent of the standard deviation, but the latter is defined for 1d vectors while the former is for 2d matrices? Is there another way to calculate the scale of a set of points?

  • 1
    $\begingroup$ I'm not sure if this is quite a duplicate, but you might want to read: Dispersion of points on 2D or 3D, & 2D analog of standard deviation? $\endgroup$ Jan 23 '16 at 23:41
  • $\begingroup$ @gung, thank you for the pointing me to that post. It answers indeed my first question, but I still need an answer for the second question (regarding the other ways of calculating the scale of a 2d matrix). $\endgroup$
    – S.E.K.
    Jan 23 '16 at 23:58
  • $\begingroup$ I linked to 2 posts. Between them, they list 3 possibilities. Can you clarify what you still need to know? $\endgroup$ Jan 24 '16 at 0:14
  • $\begingroup$ "Dispersion of points on 2D or 3D" is the one that answers my first question. $\endgroup$
    – S.E.K.
    Jan 24 '16 at 0:31

Short answer: The covariance matrix is the multidimensional analog of 1-d variance (which is itself sd^2).

Some authors have even referred to the covariance matrix as the variance-covariance matrix, or even simply the variance where the dimensions are implied from context.

If you are looking for scale specifically, you could get the square roots of the eigenvalues of the covariance matrix which will be the standard deviations along the principal components. For this interpretation see https://math.stackexchange.com/questions/23596/why-is-the-eigenvector-of-a-covariance-matrix-equal-to-a-principal-component. The "volume" of your covariance matrix can be found by the square root of the product of these eigenvalues, which is also equal to the square root of the determinant of the matrix.

Alternatively, you might consider the Cholesky decomposition as a method to get something similar to a multivariate standard deviation. This concept is often seen when generating random variates from a multivariate normal distribution and the resulting lower triangular matrix is used essentially in place of the univariate standard deviation. See here for more details: Can I use the Cholesky-method for generating correlated random variables with given mean?


You may find other answers easier to find if you change your terminology: when you have a collection of zero-dimensional values, you can measure its dispersion by taking the variance or the standard deviation. If you want to store them all, then it probably makes sense to stuff them into a one-dimensional vector, but you could just as easily have a two-dimensional collection, for example, the pixels in an image. The point is: the things whose dispersion you're trying to measure are each just numbers, zero-dimensional objects, so you can use the standard deviation or the variance.

If you have one-dimensional things whose dispersion you want to measure - for example, you have a bunch of objects and for each one, several measured quantities - then you need something more than just a variance. The natural generalization is the covariance matrix, because you need information about not just how much each thing varies, but about how they vary compared to each other. So if you have a bunch of one-dimensional things, you describe their variance with a two-dimensional matrix. Again, you might or might not put the things in an array (which would be at least two-dimensional, but might be more, for example if you were looking at the R G and B channels of an image).

What if you have a higher-dimensional thing and you're interested in dispersion? A bunch of matrices, perhaps? Well, now you run into notation and bookkeeping headaches. Really you should be getting higher-dimensional analogues of matrices, tensors, but these are usually awkward to work with, so usually you "flatten" your matrices into vectors and just take the covariance matrix again, "unflattening" as needed.

My point is: there are two separate notions here, how you organize the collection of things you're trying to summarize statistically, and what the dimension of each thing is. A variance or standard deviation is something you do to (a lot of) just-plain-numbers, while a covariance matrix is what you get when you have (a lot of) vectors.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.