How do i find the covariance between two portfolios?

I know that the formula for covariance is

$\sum&space;p{_{i}}\ast&space;(r{_{1,i}}-E()r{_{1,i}})\ast&space;(r{_{2,i}}-E()r{_{2,i}})$

But this is for two securities. How do I find the covariance between two portfolios? more specifically between the global minimum variance (GMV) and the mean-variance efficient (MVE) portfolio.

• In general it is $w_1^T \Sigma w_2$ where $\Sigma$ is the covariance matrix and $w_1,w_2$ the weights for the two portfolios. – noob2 Jun 13 at 18:40
• @noob2 can you tell me whether the weight matrix is a column matrix or a row matrix? – Karmanya GB Jun 13 at 18:45
• $w$ is $n \times 1$ that is a column vector. – noob2 Jun 13 at 18:47