I understand that in order to calculate the angle between two vectors one does the arccos of the results of the dot product divided by the product of the magnitude of the two vectors. However, this procedure always returns the smallest of the two angles. What I am interested in is the angle from vector v to vector u. This angle may excede $\pi$. I am using this in a computer program with data that I cannot inspect myself to know whever I should add $\pi$ to the angle or not. Any help would be greatly appreciated.


The question only makes sense if your vectors are from a two-dimensional vector space. In that case we also have the relation $$\sin\alpha =\frac{v_xu_y-v_yu_x}{|\mathbf u||\mathbf v|}. $$ From the combined signs of $\sin$ and $\cos$ you can determine the quadrant your angle is in (so in fact you only need the sign of $v_xu_y-v_yu_x$ as additional criterion). Thus we an say that the angle from $(1,0)$ to $(0,1)$ is $\frac\pi2$, but the angle from $(0,1)$ to $(1,0)$ or that from $(1,0)$ to $(0,-1)$ is $\frac{3\pi}2$ (or $-\frac\pi2$, if one prefers negative angles to angles $>\pi$).

To do the same in three or more dimensions, one would have to introduce the distinction between clockwise and anti-clockwise rotation in the plane spanned by two given vectors $\bf u$ amd $\bf v$. There is no poper way to introduce such an orientation (as we'd expect this way to be invariant under rotations). Therefore the range $[0,\pi]$ of angles as found per $\arccos$ is all we can hope for anyway.

  • 1
    $\begingroup$ How does it make sense in 2 dimensions? $\endgroup$ – Inquest Aug 22 '13 at 15:40
  • $\begingroup$ The formula formula $\|u\| \|v\| \cos\theta = u \cdot v$ works perfectly for all $u,v \in \mathbb{R}^n$ with $n \ge 1$. $\endgroup$ – Fly by Night Aug 22 '13 at 15:59
  • $\begingroup$ @Inquest, I guess Hagen may have meant that we must embed any two vectors in some space of more than two dimensions in a a plane and then calculate their angle. $\endgroup$ – DonAntonio Aug 22 '13 at 15:59
  • $\begingroup$ Perhaps I should be more clear, I am working with vectors in three dimensions. It does seem to me that if you look at the angle from v to u it may be $\frac{3\pi}{2}$. However, one could consider the two vectors but ask for the angle from u to v. This angle is of course $\frac{\pi}{2}$. $\endgroup$ – PhiloEpisteme Aug 22 '13 at 16:26
  • $\begingroup$ @vckngs7 In three or more dimensions, it does not make sense to say that an angle between two vectors is negative of $>\pi$. This is because the plane the vectors are in is somewhat arbitrary and there is no proper way to define an orientation (clockwise vs. anticlokwise). $\endgroup$ – Hagen von Eitzen Aug 22 '13 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.