Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the cartesian coordinates for three points $A$, $B$, $C$. I need to find the angle formed by $A\rightarrow B\rightarrow C$ using the 'right-hand rule' from B.

I'm having difficulty here as sometimes the angle will be exterior, and sometimes not.

Is there a single formula I can use for this?

Many thanks!

share|cite|improve this question

There are, of course, may ways to do this. One way would be to use vector. Note that

\begin{array}{ccc} \vec{AB} & = & B-A \\ \vec{BC} & = & C - B \end{array}

The scalar product (a.k.a. the dot product) has the property that

$$\vec{AB} \cdot \vec{BC} = \|\vec{AB}\| \, \|\vec{BC}\| \, \cos\theta $$

where $\| * \|$ measures the length and $\theta$ is the angle between the two vectors.

If you have $A$, $B$ and $C$ then you can work out $\vec{AB}$ and $\vec{BC}$. With that, find the dot product $\vec{AB}\cdot \vec{BC}$ and the lengths $\|\vec{AB}\|$ and $\|\vec{BC}\|$. Then substitute to find $\theta$, where

$$\theta = \arccos \left( \frac{\vec{AB}\cdot \vec{BC}}{ \|\vec{AB}\| \, \|\vec{BC}\|}\right).$$

All I did in the last step was to rearrange the formula to solve for $\theta$.

share|cite|improve this answer
Thanks! I'm not sure I understand, the last line seems to be defined in terms of itself? As AB dot BC includes theta? – James Apr 14 '13 at 17:24
The dot product has its own definition and is a given number. I happens to relate to $\theta$ in the way stated. Let me give an example. $A=(1,2,3)$, $B=(3,2,1)$ and $C = (1,1,1)$. Then $\vec{AB} = (2,0,-2)$ and $\vec{BC} = (-2,-1,0)$. Then the dot product: $$\vec{AB} \cdot \vec{BC} = (-2)(-2)+(0)(-1)+(2)(0)=4$$ The lengths are found using Pythagoras: $$\|\vec{AB}\| = \sqrt{2^2+0^2+(-2)^2} = 2\sqrt{2}$$ $$\|\vec{BC}\| = \sqrt{(-2)^2+(-1)^2+0^2} = \sqrt{5}$$ Putting all of this together: $$\theta = \arccos\left(\frac{4}{2\sqrt{2}\sqrt{5}}\right)$$ $$\theta \approx 50.8^{\circ}$$ – Fly by Night Apr 14 '13 at 17:44
Your example calculation of dot product is wrong, should have been $\vec{AB} \cdot \vec{BC} = (2)(-2) + (0)(-1) + (-2)(0) = -4$ – Michael Pankov Sep 12 '13 at 20:01
@FlybyNight, can you include your comment in the answer? – Mirzhan Irkegulov Jul 5 '14 at 15:46

First convert $AB$ and $BC$ into vectors $\vec{x}, \vec{y}$ by subtracting coordinates. Then use the dot product:

$\vec{x} \cdot \vec{y} = |\vec{x}| |\vec{y}| \cos \theta$

where $\theta$ is the angle between the vectors.

In this way you can get the angle between the vectors.

share|cite|improve this answer

Using properties of triangle you can solve this problem easily,

Let in ABC triangle,

a = distance(C, B)

b = distance(C, A)

c = distance(A, B)

Now the triangle property say,

$ \quad\ 1. \quad\ a^{2} = b^{2} + c^{2} - 2.b.c.CosA $

$ \quad\ \quad\ \quad\ or, cosA = (b^{2} + c^{2} - a^{2}) / 2.b.c $

$ \quad\ \quad\ \quad\ or, A = arccos(b^{2} + c^{2} - a^{2}) / 2.b.c $

$ \quad\ 2. \quad\ b^{2} = a^{2} + c^{2} - 2.c.a.cosB $

$ \quad\ \quad\ \quad\ or, cosB = (a^{2} + c^{2} - b^{2}) / 2.c.a $

$ \quad\ \quad\ \quad\ or, B = arccos(a^{2} + c^{2} - b^{2}) / 2.c.a $

$ \quad\ 3. \quad\ c^{2} = a^{2} + b^{2} - 2.a.b.CosC $

$ \quad\ \quad\ \quad\ or, cosC = (a^{2} + b^{2} - c^{2}) / 2.a.b $

$ \quad\ \quad\ \quad\ or, C = arccos (a^{2} + b^{2} - c^{2}) / 2.a.b $

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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