# How do I find the angle a vector makes to the $+x$ axis?

You are given two vectors $\vec a = -3.00\hat i + 7.00\hat j$ and $\vec b= 4.00\hat i + 2.00\hat j$. Let the counterclockwise angles be positive.

What angle $\theta (\vec a)$ where $0^\circ \le \theta (\vec a) < 360^\circ$, does $\vec a$ make with the $+x$-axis?

I drew a right triangle with a $\vec ax$ component of $-3$ and an $\vec ay$ component of $7$. Do I just use trig to find the angle off the $x$-axis?

## migrated from physics.stackexchange.comSep 1 '16 at 11:17

This question came from our site for active researchers, academics and students of physics.

• Yes. Use trig to calculate the angle. – nasu Sep 1 '16 at 2:40
• Used inverse tangent 7/3 = 2.3 for an answer of 66.50 degrees from the x axis or is it 7/-3? – Jessica Sep 1 '16 at 2:40

You can use trig, but since these are vectors, there's a far easier way. Use dot products!

Suppose you have a vector $\vec{a}$ and you need to find the angle it makes with the $x$-axis. So take a unit vector along the $x$-axis, viz. $\hat{i}$. Using the dot product of these vectors,

$$\vec{a}\cdot\hat{i} = |\vec{a}||\hat{i}|\cos\theta$$

where $\theta$ is the angle between the two vectors. Since $|\hat{i}|$ = 1, and $\vec{a}\cdot\hat{i} = a_x$, hence

$$\cos\theta = \frac{a_x}{|\vec{a}|} \implies \theta = \cos^{-1} \frac{a_x}{|\vec{a}|}.$$

A general rule for finding the counterclockwise angle from the positive $x$ axis to the direction of a two-dimensional vector is explained in How to convert components into an angle directly (for vectors)?

The basic idea is that you first take the arc tangent of the $y$-component divided by the $x$-component: $$\theta_1 = \arctan\frac{a_y}{a_x}.$$

One complication is that this procedure gives the same resulting $\theta_1$ for the vector $\langle a_x,a_y \rangle$ and the vector $\langle -a_x,-a_y \rangle,$ which are two vectors in directions $180$ degrees apart. So $\theta_1$ may be in the direction you want, or in the direction $180$ degrees opposite.

In fact $\theta_1$ will be in the correct direction whenever $a_x > 0,$ since that is how the arc tangent function is designed to work. (It always produces angles in the range $-\frac\pi2$ to $\frac\pi2$ radians, that is, $-90$ to $90$ degrees, which correspond to vectors with positive $x$-components.)

The cases where $\theta_1$ is wrong are precisely the cases where $a_x < 0,$ so if $a_x > 0$ (as it is in your particular question) you have to add $180$ degrees to $\theta_1.$

A second complication (which does not actually come up in your particular question) occurs because the procedures given above produce a result in the range $-90$ degrees to $270$ degrees, but people usually want an answer in the range $-180$ to $180$ or $0$ to $360.$ The solution to this, of course, is to add or subtract $360$ degrees as needed to get an answer in the desired angle range.

Problem: Counterclockwise angle between $+x-$ axis and vector $\vec{a} = (-3,7)$.

Draw a $x-,y-$ axes, and vector $\vec{a}$ pointing from the origin $(0,0)$ to $(-3,7)$. Verify that we are in the second quadrant , I.e. $\angle \theta$ is obtuse.

Normalize vector $\vec{a}$ , call it

$\vec{n}$ : $(1/√58) (-3,7)$.

Dot product: $\vec{n} \cdot \vec{e_x}$ = $cos(\theta)$.

$cos(\theta)$ = $(1/√58) (-3, 7) \cdot (1, 0)$= $-3 (1/√58)$.

Left: Look up $arccos ( \theta)$ to find the obtuse angle $\theta$.

Yeah you just use trig. Tan is the easiest. I saw your question about whether it is arctan(7/3) or arctan(7/-3) it is the 7/-3. Now this will give you a negative angle. This is outside your range so add 360 to it to get the answer that is in your range.

• The angle one gets via this method is 180 degrees away from the correct angle for the vector in the question. – David K May 10 '17 at 13:48