# Finding if 2 points are clockwise or anti-clockwise of each other

Say I have 2 vectors, for example $$v_1 = (0,1), v_2 = (1,0)$$

In this case I will say that $v_2$ rotates $90 \unicode{xb0}$ to $v_1$, as opposed to $-270 \unicode{xb0}$, as we take the least angle.

My question is that is there a formula to calculate this relative angle between 2 arbitrary vectors, to tell if it is clockwise or anticlockwise?

I have seen a similar answer in this question: https://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-points-are-in-clockwise-order

But I am not sure if it works for 2 points only (does it have to be a closed polygon?)

• Sounds like a sign of cross product. – Alexey Burdin May 20 '15 at 0:48
• @JohnTan Your question already has $3$ points. Aren't you implicitly referencing the origin as the center of rotation? – Erick Wong May 20 '15 at 0:50
• @ErickWong Yes. – John Tan May 20 '15 at 0:51
• You can use $\det$ to figure out a left/right sort of thing. – copper.hat May 20 '15 at 0:52
• You're the one who decides if the vector moves in the clockwise or counterclockwise direction. – user137731 May 20 '15 at 1:02

## 1 Answer

Identify $\Bbb C \cong \Bbb R^2$ in the usual way. The oriented angle formed by the pair $(z,w)$, that is, the angle from $z$ to $w$, counterclockwise, is the number $\arg(w\overline{z})$. This number is defined modulo $2\pi$.

Ok, you want the angle from $(1,0)$ to $(0,1)$. Write $z = 1$ and $w = i$ there. So: $$\arg(w\overline{z}) = \arg(i) = 90º.$$

So $v_1$ is obtained from $v_2$ after a rotation of $90º$ counterclockwise. If you let these guys swap roles, meaning, if you want the angle from $(0,1)$ to $(1,0)$, then call $z = i$ and $w = 1$. So: $$\arg(w\overline{z}) = \arg(-i) = 270º.$$ Hence $v_2$ is obtained from $v_1$ after a rotation of $270º$ counterclockwise (or equivalently, $90º$ clockwise).