# Thread: covariance of two matrices

1. ## covariance of two matrices

I am not a math major, so I am having a really hard time understanding covariance matrices.

I have 2 arrays. One that goes (Row, Column)
Array 1 is (5, 1) and Array 2 is (1, 5).

Something like this
Array1: [1, 1, 1, 1, 1]

; indicates new line
Array 2: [1; 1; 1; 1; 1]

I want to do Covariance of Array1 and Array2, so
Array3 = Cov(Array1, Array2).

*Would the solution (Array3) be an array of 5 Rows and 5 Columns?

*and what would be the values of each element in the new array be? like for position 3, 4 in Array3 would be?

If someone could help me out that would be great and I would really appreciate it.
$\mbox{Cov}(x, y) = \mbox{E}[(x - \mbox{E}x)(y -\mbox{E}y)']$
then it should be undefined. You will end up evaluating things like $xy'$ and because your first array is apparently 1 x 5 and your second array is 5 x 1 this is undefined (when you explicitly spelled out the dimensions this is what you get). If you got it backwards, it is still undefined for the same reasons. You need xy' to be defined to get an answer. Normally it is a 5 x 5 matrix in this case if they are both column vectors, or a scalar if they are both row vectors.