# What is the correct formula to calculate the angle of vector A = 0i + 1j

#### Joseph3

I know the angle is 90 degrees. and the formula to calculate the angle of vector A is inverse tan of (Ay / Ax), but Excel returns an error message because Ax is zero.

Thanks.

#### topsquark

Forum Staff
I know the angle is 90 degrees. and the formula to calculate the angle of vector A is inverse tan of (Ay / Ax), but Excel returns an error message because Ax is zero.

Thanks.
It has to do with, as you say, the 90 degree angle.

Try this:
$$\displaystyle \lim_{A_x \to 0^-} tan^{-1} \left ( \dfrac{A_y}{A_x} \right )$$

and
$$\displaystyle \lim_{A_x \to 0^+} tan^{-1} \left ( \dfrac{A_y}{A_x} \right )$$

What do these two limits tell you?

-Dan

#### Joseph3

Ok, I got it figured out with a little help from Microsoft. For a vertical vector, Ax = 0, you can't use ATAN(Ay/Ax) to calculate the inverse tan, you have to use ATAN2(Ax, Ay) - the arguments are different. Thanks for responding.

#### Woody

ATAN vs ATAN2

Plotting the TAN function shows why there is a problem with ATAN.
However the nature of TAN=SIN/COS means that practical problems often come in the form Q=ATAN(X/Y).

By looking at the relative signs of X and Y (and watching for zeros at 90deg)
and using lots of IFs
A full 360deg solution can be derived.

Happily the ATAN2 function does all this for you...

#### Joseph3

I've found another way to go all around from -360 to 360 without using the Excel function ATAN2. Instead of ATAN2(x,y), I use ATAN(y / (sqrt(x^2+y^2) + x)) and multiply by 2 to get theta. This avoids the infinities.

Last edited: