How do I calculate angle C? I can only know what angle between vector and x positive vector {1, 0}

Angle between green and red is 60 degrees. Angle between blue and red is -170 degrees. Shortest angle between green and blue is 130 degrees.

What formula should I use to calculate it?
It must be positive value.


1 Answer 1


Generally when wanting the smallest angle between two vectors, the dot product is used. $$ \vec A \cdot{} \vec B = \cos{\angle \alpha} $$ Where $\vec A$ and $\vec B$ are vectors with the length of $1.0$.

However, you do not have access to the actual vectors themselves, if I understand your question correctly. You just have access to the angles between the vectors and a common direction.

There is a different way you could calculate that angle. You take the absolute value of the difference between the two angles, given that both angles are from a common direction and either both clock-wise or both counter clock-wise. $$ \angle \phi = |\angle \alpha - \angle \beta| $$ Where

  • $\angle \phi$ is the smallest positive angle between the two vectors.
  • $\angle \alpha$ and $\angle \beta$ are angles in the range from $[0, 360)$, between a common direction and the vector, and either both clock-wise or both counter clock-wise.

What do I mean with how I defined those angles?
First off all, that both angles are between a common direction and the vector. In this case it means that the angles should be between the vector and the red vector where the red vector is the common direction. Which is the case for the angles you provided. It is difficult for me to properly explain why they need to share a common direction, but it should be self explanatory.

What do I mean with that they should be either both clock-wise or both counter clock-wise? When having an angle between two directions, it can either be clock-wise or counter clock-wise. The angle between red and green is 60° and if you start at the red vector (which will be the common direction) you go counter clock-wise with an angle of 60°. The other angle should then also be counter clock-wise. This is the case between red and blue with an angle of -170°. If you look at the red vector, then you go clock-wise. However, the angle is negative, so you go backwards. This means that you actually go counter clock-wise.

And lastly, the angles should be in the range from $[0, 360)$. This makes the formula work a bit better. It is not needed, but then you would have to do some stuff with $\angle \phi$ instead. Basically, if the angle is larger than 360° you just keep subtracting 360° until it is within the range. If the angle is smaller than 0° you keep adding 360° until it is within the range.

Let us try this method with your example.

We have three vectors. $\vec Red$, $\vec Blue$ and $\vec Green$. We now the angles between $\vec Red$ and $\vec Blue$ and between $\vec Red$ and $\vec Green$. $$\angle RB = -170$$ $$\angle RG = 60$$

$\angle RG$ is within our range, but $\angle RB$ is not. So we add 360° to $\angle RB$ and we get. $$\angle RB = 190$$

They also both have a common direction, $\vec Red$ and are both counter clock-wise.

When adding them into the formula, we get; $$\angle \phi = |190-60| = 130$$

And there we have it. The answer.

I do not know if this is a formula with a name or something like that. This method is something I just came up with.

Good luck!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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