# Co-variance of Portfolio A with Portfolio B

I'm trying to calculate the correlation between two separate portfolios.

I've used A*COV(AB)*B to calculate the co-variance of each portfolio where:

A = Array of weights of stocks within portfolio 1

B = Array of weights of stocks within portfolio 2

COV(AB) = Co-variance/variance matrix of stocks within either portfolio

The result that comes out is an array with 1 row and 5 columns with the same figure in each column (picture below).

I'm wondering, is the co-variance of the portfolio the sum of the 1*4 array that I got for the answer, or just one cell in the array?

Thanks in advance!

• If you take $A^T* COV* B$ then the result will be 1 x1 ( a scalar). (1xN * NxN * Nx1 = 1x1). I believe you forgot to take the transpose of A. The vector on the left needs to be a row vector. – Alex C Feb 2 '19 at 16:29

## 1 Answer

If you take $$A^T∗COV∗B$$ then the result will be 1 x1 ( a scalar). (1xN * NxN * Nx1 = 1x1).

I believe you forgot to take the transpose of A. The vector which pre-multiplies COV needs to be a row vector, because in your example it isn't you may be getting this weird result.

• Thanks a lot! The issue is that I wasn't sure whether the result would be 1*5 or 1*1, because I was using excel, I used =mmult(array1,array2) with a 1*5 output and got 5 of the same answer. I used it with 1*1 and it worked. Thank you very much this really helped! – Daniel Feb 3 '19 at 4:13