Let a matrix of random observations such that $$\textbf{X}=\begin{bmatrix}x_{11}&x_{12}\\ x_{21}& x_{22}\end{bmatrix}$$ where $x_{jk}$ is the jth measure of the kth variable.Each column is a random variable. Why the covariance matrix of $\textbf{X}$ is given by $XX'$?
I don't understood this result, because
$$\overline{x}_k=\frac{1}{n}\sum_{i=1}^n x_{ik}$$
in this case $\overline{x_1}=\frac{x_{11}+x_{21}}{2}$ and $\overline{x_2}=\frac{x_{12}+x_{22}}{2}$
and the sample covariances are given by $$s_{ik}=\frac{1}{n}\sum_{j=1}^n(x_{ji}-\overline{x_i})(x_{jk}-\overline{x_k})$$
Taking $s_{11}$ as example
$$s_{11}=\frac{1}{2}\sum_{j=1}^2 (x_{j1}-\overline{x_1})^2=\frac{1}{2}\Big((x_{11}-(\frac{x_{11}+x_{21}}{2}))^2+(x_{21}-(\frac{x_{11}+x_{21}}{2} ))^2\Big)$$ $$=\frac{x_{11}^2}{2}-x_{11}x_{21}+\frac{x_{21}^2}{2}$$
If I make $$XX'$$ then $$s_{11}=x_{11}^2+x_{21}^2$$
I made some confusion? Or is there some restriction to this result?
EDIT: I get this result from here Correlation matrix from Covariance matrix . Since no one said that is wrong I assumed that will be valid in this case too.
There is indeed a restriction of the result: this formula is only correct if each row has mean $0$. See this explained, for example, on the wiki page. The same seems to be true for correlation matrices.
Presumably, one takes the rows of the observation matrix to have mean zero "by default".