Covariance matrix for 2 vectors with elements in the plane I am given 2 vectors of points in the $R^2$ plane and I want to compute the covariance matrix of the two vectors.
I know this will result in a 2x2 matrix. However, I am slightly confused. From Wikipedia, and from what I know, the covariance applies to vectors of random variables. In this case I do not have vectors of random variables, but rather a set of n samples from 2 random variables (one which yields the first vector and the other one which yields the second vector). I would like to use these samples in computing the variance, rather than estimating the two random variables in the underlying distributions.
I believe I lack some sort of understanding in the matter, and an explanation (rather than a simple answer) would be more than welcome.
Edit: this issue arises from me trying to understand the matlab function cov. 
Thank you!
 A: If you are treating your data as just two vectors of points, then what you are looking for is the variance of each sample (the word "sample" referring to the collection of the $n$ points) and the covariance between the two samples (which can be contained in a $2\times 2$ matrix, with variances in the main diagonal and the covariance off-diagonal). This is of course not what is meant by "covariance matrix" (or "cross-covariance matrix" between two random vectors).
This matrix you are looking for can be written as 
(bar denoting the sample mean)
$$ V = \left[\begin{matrix}
\frac 1n \sum_{i=1}^{n}x_i^2 - \bar x^2 & \frac 1n \sum_{i=1}^{n}x_iy_i - \bar x \bar y \\
\frac 1n \sum_{i=1}^{n}x_iy_i - \bar x \bar y & \frac 1n \sum_{i=1}^{n}y_i^2 - \bar y^2 \\
\end{matrix} \right]$$
...where $x_i$ and $y_i$ denote the points from each sample.
Again, this is not what is called the "covariance between two random vectors", it is just "variance-covarinace between two sets of points". 
A: If each of the vectors contains two different variables, e.g. x,y, and you have n vectors, then you must compute mean value for each variable and then construct a vector of residuals by computing mean difference of each variable across whole sample.
$A=(x_1,y_1), B=(x_2,y_2)$
$C=\frac{A+B}{2}$
$D=\sqrt{\frac{(A-C)^2+(B-C)^2}{2}}$  ... operations hold for each vector element separately
The covariance matrix is then $\begin{pmatrix}
        D(1)\cdot{D}(1) & D(1)\cdot{D}(2)\\
        D(1)\cdot{D}(2) & D(2)\cdot{D}(2)\\ \end{pmatrix}
$
Note: for just two measurements, you should use corrected standard deviation, that is
$D=\sqrt{\frac{(A-C)^2+(B-C)^2}{n-1}}=\sqrt{(A-C)^2+(B-C)^2}$
