# How do I find the intersection of two lines in three-dimensional space?

Jan 4, 2017

I'll show how to solve this problem using an example using the vector based form of a two straight lines. Bear in mind that there will be one of the following outcomes:

• a single unique point.
• no solution (if the lines do not intersect).
• infinitely many solutions (if the lines coincide).

Suppose we have;

${L}_{1} : \setminus \setminus \setminus \setminus \vec{{r}_{1}} = \left(\begin{matrix}5 \\ 2 \\ - 1\end{matrix}\right) + l a m \mathrm{da} \left(\begin{matrix}1 \\ - 2 \\ - 3\end{matrix}\right)$

${L}_{2} : \setminus \setminus \setminus \setminus \vec{{r}_{2}} = \left(\begin{matrix}2 \\ 0 \\ 4\end{matrix}\right) + \mu \left(\begin{matrix}1 \\ 2 \\ - 1\end{matrix}\right)$

It is vital that the variable parameters ($l a m \mathrm{da}$ and $\mu$) have different symbols, as they are different parameters relative to each line.

If the lines do meet then for some specific values of $l a m \mathrm{da}$ and $\mu$ then:

$\vec{{r}_{1}} = \vec{{r}_{2}}$

In which case we would have:

$\left(\begin{matrix}5 \\ 2 \\ - 1\end{matrix}\right) + l a m \mathrm{da} \left(\begin{matrix}1 \\ - 2 \\ - 3\end{matrix}\right) = \left(\begin{matrix}2 \\ 0 \\ 4\end{matrix}\right) + \mu \left(\begin{matrix}1 \\ 2 \\ - 1\end{matrix}\right)$
$\therefore \setminus \setminus \setminus \setminus \setminus \setminus \left(\begin{matrix}5 + l a m \mathrm{da} \\ 2 - 2 l a m \mathrm{da} \\ - 1 - 3 l a m \mathrm{da}\end{matrix}\right) = \left(\begin{matrix}2 + \mu \\ 2 \mu \\ 4 - \mu\end{matrix}\right)$

By comparing the coefficients of $\hat{i}$, $\hat{j}$ and $\hat{k}$ we have three equations in two unknowns, so we can solve for $l a m \mathrm{da}$ and $\mu$ using the first two equations and check if the third is satisfied:

$\hat{i} : \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus 5 + l a m \mathrm{da} = 2 + \mu \text{ } \ldots \ldots . \left[1\right]$
$\hat{j} : \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus 2 - 2 l a m \mathrm{da} = 2 \mu \text{ } \ldots \ldots . \left[2\right]$
$\hat{k} : \setminus \setminus \setminus \setminus - 1 - 3 l a m \mathrm{da} = 4 - \mu \setminus \text{ } \ldots \ldots . \left[3\right]$

$E q \left[1\right] + \frac{1}{2} E q \left[2\right]$ gives $\implies 6 = 2 + 2 \mu \implies \mu = 2$
Subs $\mu = 2$ into $E q \left[1\right] \implies 5 + l a m \mathrm{da} = 4 \implies l a m \mathrm{da} = - 1$
Subs $\mu = 2$ and $l a m \mathrm{da} = - 1$ into $E q \left[3\right] \implies - 1 + 3 = 2 = 4 - 2$

So we have established that if we choose $l a m \mathrm{da} = - 1$ and $\mu = 2$ then we get a unique solution simultaneously satisfying all three equations.

We can then substitute $l a m \mathrm{da} = - 1$ into ${L}_{1}$, (equally $\mu = 2$ into ${L}_{2}$ would work) to determine the actual coordinate of intersection.

$\vec{{r}_{1}} = \left(\begin{matrix}5 \\ 2 \\ - 1\end{matrix}\right) - \left(\begin{matrix}1 \\ - 2 \\ - 3\end{matrix}\right)$
$\setminus \setminus \setminus = \left(\begin{matrix}5 - 1 \\ 2 + 2 \\ - 1 + 3\end{matrix}\right)$
$\setminus \setminus \setminus = \left(\begin{matrix}4 \\ 4 \\ 2\end{matrix}\right)$

so in this example, the lines ${L}_{1}$ and ${L}_{2}$ intersect at the coordinate $\left(4 , 4 , 2\right)$