# Calculating angle of a 2D vector with positive y-axis

This has been a burning question that I've been thinking about recently.

In statics problems like the one I've attached here where we are asked to find the angle that the resulting vector has with the positive y-axis, do we take the angle going clockwise or counter-clockwise from the y-axis to the resulting vector?

I remember from class that we calculate the angle between the positive x-axis with a vector going counter-clockwise 'always' however I'm unfamiliar with the rule when it comes to finding the angle with the positive y-axis.

I would appreciate any insight on this topic.

Reference: Engineering Mechanics STATICS, J.L. Meriam, L.G. Kraige, 7th Edition

Angles in right handed coordinate systems are always measured as positive counter-clockwise.

With respect to x axis the angle of the vector can be easily be found with the use of atan2 (although the result is usually $$[-\pi, \pi]$$ instead of 0 to $$2\pi$$. So in Excel you only need to do =atan2(40,-30) and you get the result in radians (-0.6435) or =ATAN2(40,-30) *180/PI() if you want it degress ($$\phi_x =-36.87\deg$$).

In this case you could use atan and you would get the same result, however the problem with atan is that it gives the same result of e.g. $$\langle x_0,y0\rangle$$ and $$\langle-x_0,-y0\rangle$$ (i.e. it cannot distinguish between 1st and 3rd quadrant and 2nd and 4th).

Regarding the angle between the y-axis you only need to subtract 90 degrees from the angle with the x-axis. i.e. for this example:

$$\phi_y = -90-36.87 = -126.87 [\deg]$$

Additionally, if you wanted to use atan2 for the y-axis and the vector had coordinates $$\vec{V} = (xV, yV)$$ then in excel you'd need to use =atan2(yV, -xV). This is because you'd be expressing $$\vec{V}$$ in terms of coordinate system which is rotated by 90 deg ccw compared to the initial one.

Regarding the second part of the answer (unit vector) the answer kamran gave is succinct and to the point.

I could only add the following. Given the unit vector $$\vec{e}_V = \frac{4}{5}\vec{i} - \frac{3}{5}\vec{j}$$ you can estimate the angle with the x axis (let denote it $$\phi_x$$)by taking the dot product of the unit vector of X with the unit vector of V and then calculating the $$\arccos(\vec{e}_{x}\cdot \vec{e}_{V})$$. However you will only get the magnitude and you need to check which quadrant you are in. (Similary for the y-axis $$\arccos(\vec{e}_{y}\cdot \vec{e}_{V})$$ ).



By definition of dot product: $$\vec{a} \ . \vec{b} = \|\vec{a}\| \|\vec{b}\| \cos (\theta)$$

Where $$\theta$$ is the angle between the two vectors $$\vec{a}$$ and $$\vec{b}$$.

To find angle between your vector and +ve x-axis, set $$\vec{a} = (40, -30)$$, $$\vec{b} = \vec{i} = (1, 0)$$ such that $$\|\vec{i}\| = 1$$

$$\theta = \cos^{-1}( \frac{(40, -30) \ . (1, 0)}{50 * 1 } ) = -36.86$$

You can calculate the angle between the vector and the +ve y-axis by setting $$\vec{b} = \vec{j} = (0, 1)$$, which you can easily calculate as shown above.

• however, using that method a valid answer is also 36.86 isn't it? because the dot product of the V and unit X vector is 4/5. – NMech Nov 1 '20 at 17:17
• @NMech The definition above of the angle between two vectors came from the Cauchy-Schwarz inequality, assuming that two vectors $x$ and $y$ in $\mathbb{R}^2$ vector space $x \ne 0$, $y \ne 0$ then, $-1 \le \frac{\langle x, y \rangle}{\|x\|\|y\|} \le 1$, therefore there is a unique number $\theta$ in $[0, \pi]$ such that $\cos \theta = \frac{\langle x, y \rangle}{\|x\|\|y\|}$, that number is the angle between the two vectors, and since usually in engineering we measure +ve angles counter-clockwise and knowing that $V$ is in the 4th quarter of $xy$ space, I added the minus just for convention. – Algo Nov 2 '20 at 6:42
• That's what I thought. we are in agreement then that through the dot product you can calculate the magnitude, and you need intuition to perform additional checks for the +/-. – NMech Nov 2 '20 at 7:29
• @NMech Yes, exactly. – Algo Nov 2 '20 at 8:43
• @NMech That makes sense. Follow-up question: Can we also say that the angle between vector V and the +ve x-axis would be +323.14 degrees? Similarly, the angle between vector V and the +ve y-axis would be +233.14 degrees? – Michael Nov 2 '20 at 14:15

the magnitude of the vector is

$$\|\vec{V}\|=\sqrt{40^2+30^2}=50$$

The unit vectot u along the vector is the vector divided by its magnitude:

$$\vec{u}=\frac{\vec{v}}{\|v\|}=1/ \|\vec{v}\| *\vec{v}= 1/50*\vec{v}$$

$$\vec{u}= 1/50*\langle40, -30\rangle$$

And the angle $$\theta \ with \ X \ axis =arctan(-30/40)=-36.86$$

Edit

angle with Y axis $$-36.86-90=-126.86^\circ$$

• Thank you for taking your time to answer. Yes I am aware of the method of solving for the unit vector. I am asking about the first part of the question, which is calculating the angle that the vector V makes with the positive x and y axes. I would appreciate any help on that please. – Michael Nov 1 '20 at 16:18
• @Michael, I modified my answer and added the angle. – kamran Nov 1 '20 at 16:28
• @NMech, my bad. now it should be okay. I am flying and the tower cleared me for take off. i come back to this. – kamran Nov 1 '20 at 16:40
• @NMech, you are right, I was in a rush. will modify my answer. thanks. – kamran Nov 2 '20 at 15:28