# Thread: Angle between two 3D vectors with proper sign

1. ## Angle between two 3D vectors with proper sign

I have two vectors

A = 2i + 3j + 4k
B = 5i + 6j + 7k

I wish to find out the angle between them with the proper sign.
I read (Maths - Inverse Trigonometric Functions - Martin Baker) that the function atan2 is the right way to do it. But I don't find the method to go about it. I want to do it by hand not using some software or excel or something.
Anyone throw some light on it or any other proper method.

2. Originally Posted by ontherocks
I have two vectors
A = 2i + 3j + 4k
B = 5i + 6j + 7k
I wish to find out the angle between them with the proper sign.
The angle between is: $\arccos \left( {\frac{{A \cdot B}}
{{\left\| A \right\|\left\| B \right\|}}} \right)$
.

3. Unfortunately, arccos doesn't give the angle "with proper sign".

Some discussions on similar lines (http://www.gamedev.net/community/for...opic_id=503639)

4. Originally Posted by ontherocks
Unfortunately, arccos doesn't give the angle "with proper sign".
You are completely mistaken about that.
The angle between any two vectors is such $0\le\theta\le \pi$.
The angle between two vectors does not have a sign.
There is no such a thing mathematically speaking.
I read the discussion, someone there said the same thing.

5. Hello, ontherocks!

I have two vectors: . $\begin{array}{ccc}\vec a &=& 2i + 3j + 4k \\ \vec b &=& 5i + 6j + 7k\end{array}$

I wish to find out the angle between them.
Plato's formula is correct.

. . $\cos\theta \;=\;\frac{\vec a \cdot \vec b}{|\vec a||\vec b|}$

and it does give the proper sign!

We have: . $\begin{array}{ccc} \vec a &=& \langle 2,3,4\rangle \\ \vec b &=& \langle 5,6,7\rangle \end{array}$

Then: . $\cos\theta \;=\;\frac{\langle2,3,4\rangle\cdot\langle5,6,7\ra ngle}{\sqrt{2^2+3^2+4^2}\,\sqrt{5^2+6^2+7^2}} \;=\;\frac{10+18+28}{\sqrt{4+9+16}\,\sqrt{25+36+49 }} \;=\;\frac{56}{\sqrt{29}\,\sqrt{110}}$

Therefore: . $\theta \;=\;\cos^{-1}\left(\frac{56}{\sqrt{29}\,\sqrt{110}}\right) \;\approx\;7.5^o$

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Suppose we have: . $\vec v \:=\:\langle \text{-}5, \text{-}6,\text{-}7\rangle$ . . . the negative of $\vec b$.

The angle between $\vec a$ and $\vec v$ is given by:

. . $\cos\alpha \;=\;\frac{\vec a\cdot \vec v}{|\vec a||\vec v|} \;=\;\frac{-10 - 18 - 28}{\sqrt{4+9+16}\,\sqrt{25+36+49}} \;=\;\frac{-56}{\sqrt{29}\,\sqrt{110}}$

Therefore: . $\alpha \;=\;\cos^{-1}\left(\frac{-56}{\sqrt{29}\,\sqrt{110}}\right) \quad\Rightarrow\quad \alpha \:\approx\:172.5^o$

See?