# Exterior angle of two line segments

Say I have a $L_1$ with end points $(0,0)$,$(1,1)$ and $L_2$ with the start point $(1,1)$ and the end point anywhere on the Cartesian plane. See example image below.

Example image

How do I determine the angle $X$ when the end point of $L_2$ can be anywhere in the Cartesian plane?

Thanks

geometry

The slope of $L_1$ is $$m_1=\frac{1-0}{1-0}=1$$ Let the other end point of $L_2$ be $(x,y)$.

The slope of $L_2$ then will be $$m_2=\frac{y-1}{x-1}$$

Now, to find the angle $\theta$ between two lines with slopes $m_1$ and $m_2$, use the relation, $$\tan\theta=\frac{m_2-m_1}{1+m_1m_2}$$

There are two angles between a pair of line segments, and it depends on the context which one you are looking for.

In this context, the angle $X$ is the angle made by $L_2$ with respect to $L_1$ when measured clockwise, while as per convention, $\theta$ is taken anti clockwise.

Thus, the relation between $X$ and $\theta$ will be, $$X=\pi-\theta$$

• Thanks @GoodDeeds, if L2 end point is at (2,4) this gives the answer of 26 degrees, but the answer is 180 - 26 ? If the end point of L2 is at an arbitrary position is there a generic formula for the angle ? (if that make sense). Thanks once again – tosspot Feb 26 '16 at 16:26
• @tosspot Updated my answer. – GoodDeeds Feb 27 '16 at 18:39