# Calculate the slope of a line passing through the intersaction of two lines

Let say I have this figure,

I know slope m1, slope m2, (X1,Y1),(X2,Y2) and (X3,Y3). I need to calculate slope m3. Note the line with m3 slope will always equally bisect line with m1 slope and line with m2.

-

A possible answer is that if $$m_1=\tan(\alpha), \qquad m_2=\tan(\beta),$$ then $$m_3=\tan\left(\frac{\alpha+\beta}2\right).$$

-

Suppose $m_1$ is $\tan(x)$ and $m_2$ is $\tan(y)$. We basically want $$\begin{eqnarray} \tan((x+y)/2) &=& (1-\cos(x+y))/\sin(x+y)\\ & =& (1-(\cos(x)\cos(y) - \sin(x)\sin(y)))/(\sin(x)\cos(y) + \cos(x)\sin(y)) \end{eqnarray}$$

This is easy as $\sin(x) = m_1/\sqrt{1+m_1^2}, \cos(x) = 1/\sqrt{1+m_1^2}$, and similarly for $y$. Call $\sqrt{1+m_1^2} = n_1$ and similarly $n_2$ for $m_2$.

$$m_3 = (1-(1/n_1n_2 - m_1m_2/n_1n_2)/(m_1/n_1n_2 + m_2/n_1n_2) = (n_1n_2 + m_1m_2 - 1)/(m_1+m_2)$$

So $m_3 = \left(\sqrt{(1+m_1^2)(1+m_2^2)} + m_1m_2 - 1\right)/(m_1 + m_2).$

You can easily check that if $m_2 = m_1$, then $m_3 = m_1$ here. Looks legit.

-

You have $m_1=\frac{Y_2-Y_1}{X_2-X_1}=\tan(\alpha_1)$ and $m_2=\frac{Y_3-Y_1}{X_3-X_1}=\tan(\alpha_2)$, so you'll get $$m_3=\tan(\alpha_2+\frac{\alpha_1-\alpha_2}{2})=\tan(\frac{\alpha_1+\alpha_2}{2}).$$

-

Other wasting time approach.

First, let us connect points $(x_2,y_2)$ and $(x_3,y_3)$ with a line. The intersection point of $y_3=m_3x+n_3$ with our line we call $P(x_P,y_P)$. Let us now find that point $P$.

As all three points of our triangular(say $\Delta ABC$} are known, we can use the following triangular area formula(that uses only our given points):

$$S_{\Delta ABC}=\frac{1}{2}|x_1y_2+x_2y_3+x_3y_1-x_2y_1-x_3y_2-x_1y_3|$$

Using that formula two more times for small triangles($S_1$ and $S_2$ ),after solving $S_{\Delta ABC}=S_1+S_2$ we will get an equation with two unknowns($x_P,y_P$)

The second equation we could get from compering the slope of points $(x_2,y_2)$, $(x_3,y_3)$ with the slope of $(x_2,y_2)$, $(x_P,y_P)$(all three point are on the same line).

Finally, we solve system of two equations and find point $P$, and with $(x_1,y_1)$ we can find our desired slope.

-