Skip to content or footer

Computing the Intersection of Two Lines

Two different straight lines that lie in a plane and are not parallel always have an intersection point.

Schnittpunkt zweier Geraden

Given are usually two linear functions ff and gg with the general equations of the straight line:

  • f(x)=m1x+t1f(x)=m_1\cdot x+t_1 and

  • g(x)=m2x+t2g(x)=m_2\cdot x+t_2 .

We are looking for the intersection point S(ab)S(a\,|\,b).

For this point S(ab)S(a|b), it holds that

f(a)=g(a)=b\displaystyle f(a)=g(a)=b

Example

Consider the following linear functions:

  • f(x)=3x+2f(x)=3\cdot x+2

  • g(x)=2x+5g(x)=2\cdot x+5.

Calculate the intersection point.

Set the functions equal and bring xx to one side of the equation:

f(x)=g(x)3x+2=2x+523x=2x+32xx=3\displaystyle \def\arraystretch{1.25} \begin{array}{rcll}f(x)&=&g(x)&\\3\cdot x+2&=&2\cdot x+5&|-2\\3\cdot x &=& 2\cdot x +3&|-2\cdot x\\x&=&3\end{array}

The function value of ff and gg are therefore equal at x=3x=3. The point of intersection of the two lines is therefore at S(3?)S(3|?).

You can now calculate the missing yy-value by plugging x=3 x=3 into f(x)f(x) or g(x)g(x). It doesn't make any difference which of both you choose, since according to the calculation above f(3)=g(3)f(3)=g(3) .

x=3x=3 plugged into f(x)f(x) yields:

f(3)=33+2=9+2=11\displaystyle f(3) = 3\cdot 3 +2 = 9+2 = 11

The intersection point is therefore at S(311)S(3|11).

General procedure

You set the two functions equal and bring xx to one side of the equation.

f(x)=g(x)m1x+t1=m2x+t2t1m1x=m2x+(t2t1)m2xm1xm2x=t2t1(m1m2)x=t2t1:(m1m2)x=t2t1m1m2\displaystyle \def\arraystretch{1.25} \begin{array}{rcll}f(x)&=&g(x)&\\m_1\cdot x+t_1&=&m_2\cdot x+t_2&|-t_1\\m_1\cdot x&=&m_2\cdot x + (t_2-t_1)&|-m_2\cdot x\\m_1 \cdot x - m_2 \cdot x &=&t_2-t_1\\(m_1 - m_2) \cdot x &=& t_2-t_1&|:(m_1-m_2)\\x&=&\frac{t_2-t_1}{m_1-m_2}\end{array}

The x-value of the intersection point is therefore at x=t2t1m1m2x=\frac{t_2-t_1}{m_1-m_2}.

Now plug x=t2t1m1m2x=\frac{t_2-t_1}{m_1-m_2} into f(x)f(x) or g(x)g(x) to get the yy-value of the intersection point:

f(x)=m1x+t1\displaystyle f(\textcolor{ff6600}{x})=m_1\cdot\textcolor{ff6600}{x}+t_1
f(t2t1m1m2)=m1t2t1m1m2+t1y-value of the intersection\displaystyle \Rightarrow f(\textcolor{ff6600}{\frac{t_2-t_1}{m_1-m_2}})= \underbrace{m_1\cdot \textcolor{ff6600}{\frac{t_2-t_1}{m_1-m_2}} +t_1}_{\textcolor{009999}{\text{{y-value of the intersection}}}}

The intersection point of the lines is therefore S(t2t1m1m2m1t2t1m1m2+t1)S(\textcolor{ff6600}{\frac{t_2-t_1}{m_1-m_2}}|\textcolor{009999}{m_1\cdot\frac{t_2-t_1}{m_1-m_2}+t_1}).


This content is licensed under
CC BY-SA 4.0Info