# Calculate the angle from the given points coordinates.

I'm trying to figure out the way to calculate the a angle value from given coordinates of three points as showed on the illustration below:

I know how to calculate the a angle from the triangle's base length and its height, but in this case I'm stucked. I'll appreciate any help.

EDIT

The a value should be expressed in degrees. Also, the points coordinates can vary.

• use dot product for obtaining a. Sep 28, 2014 at 21:07
• Or draw perpendicular line from top point to the bottom line, and notice it is a 45-45-90 triangle with the perpendicular. Sep 28, 2014 at 21:08

$$A = (150 - 100, 50 - 100) = (50, -50)$$ $$B = (180 - 100, 100 - 100) = (80, 0)$$ $$\cos\Theta = \dfrac{A \cdot B}{|A||B|} = \dfrac{400}{50\sqrt{2} \times 80} = \dfrac{1}{\sqrt{2}}$$ $$\Rightarrow \Theta = \dfrac\pi4$$

• Is this correct? A * B = 4000 in the numerator? What does |A| and |B| mean? Feb 27, 2020 at 9:45
• @Stefan |A| means 2-norm of A ($\|A\|_2=\sqrt{(A_x^2+A_y^2)}$. Feb 27, 2020 at 19:09
• @Stefan Following on from Panda's reply: the 2-norm of a vector quantity is the magnitude (how long it is in Euclidean space) of that vector
– Dai
Sep 29, 2020 at 18:20

Drop a perpendicular from $x_1y_1$ to get a right triangle with the adjacent and opposite of $a$ both equal to $50$. Hence $a=\pi/4$ (because $\tan a = {O\over A} = {50\over 50} = 1$).

EDIT: Note $\pi/4$ radians equals $45$ degrees. The result here is invariant under translation (it stays the same when the points move).

The angle being non-dimensional, we can proportionally divide the vector magnitude by $$10$$ for convenience of calculation. The $$(i,j)$$ are unit vectors along $$(x,y)$$ axes

$$\vec{P2 \;P0} =(8i+0j)$$

$$\vec{P1 \;P0} =(5i-5j)$$

Using scalar dot product

$$\cos a = \dfrac{a_1b_1+a_2b_2}{|A| \cdot |B|}$$

$$\cos a = \dfrac{40}{\sqrt{64(25+25)}}= \dfrac{40}{8\cdot\sqrt2 \cdot 5}= \dfrac{1}{\sqrt 2}$$ or $$a = \dfrac{\pi}{4}=45^{\circ}$$

Maybe it is just me but the answers here seem a bit overly complex for a simple task like this. This can easily be solved with distance formula and Law of Cosines in a universal way not limited to making special rights. No need for vectors, norms, dot products, or any of that. Just basic algebra and trig.

$$A=\sqrt{\left(x_{2}-x_{1}\right)^{2}+\left(y_{2}-y_{1}\right)^{2}}$$

$$B=\sqrt{\left(x_{2}-x_{0}\right)^{2}+\left(y_{2}-y_{0}\right)^{2}}$$

$$C=\sqrt{\left(x_{1}-x_{0}\right)^{2}+\left(y_{1}-y_{0}\right)^{2}}$$

$$a=\cos^{-1}\left(\frac{A^{2}-B^{2}-C^{2}}{-2BC}\right)$$