# correlation between basis vectors

how come Matlab give me the result corr(u,v)=-1 u=[1 0]' and v=[0 1]' (i.e., two orthogonal column vectors, basis of the Euclidean plane ...)

Suddenly this makes no sense to me ... their scalar product = 0 ... they should be perfectly UNcorrelated?

i know it works out to -1 with the correlation formula $dot((x-mean(x)),(y-mean(y))/(norm(x)*norm(y))$ but could someone enlighten me ? (it's very frustrating ... i seem to miss something (and I have been working with such things for a while...)

To summarize: why (logical understanding point of view) are they negatively perfectly correlated (-1) whereas I would expect them to be perfectly UNCORRELATED (0) ?

We have two data points: (u[0], v[0]) and (u[1], v[1]). In terms of $x$ and $y$ axis, when $x=0$ then $y=1$. When $x=1$, $y$ went down and became $y=0$. So when $x$ increases, $y$ decreases. I wouldn't interpret the data points as vectors. Even if you were to interpret them as vectors, clearly the two vectors are orthogonal so there is perfect anti-correlation. No correlation means if $x$ is increasing $y$ stays the same
• Note that your two data points are not $u$ and $v$. $u$ contains all Xs and $v$ contains all Ys. Your data points are $(u[0], v[0])$ and $(u[1], v[1])$(which happen to be the same as $u$ and $v$). Nevertheless, you need to first subtract the mean from each direction and then visualize the vectors. You get something like $(0.5, -0.5)$ and $(-0.5, 0.5)$ which you can see they point in different directions. I will update my answer to add an intuitive explanation Mar 17, 2018 at 17:53