## Finding the intersection of 2 lines in space

A common procedure used both in mathematics as well as computer science, involves the process of finding the intersection between 2 lines. 2 lines on a plane are fairly straightforward. Finding an intersection in space or in 3-dimensions has a few more steps, but can be just as easy.

Given 2 parametric equations:

l1 & l2

x = 1 + 2t —— x = 0 + 5s

y = 0 + 3t —— y = 5 + 1s

z = 0 + 1t —— z = 5 – 3s

Setting the x‘s and y‘s equal, we have to solve

x: 1 + 2t = 0 + 5s & y: 0 + 3t = 5 + 1s

Simplified to:

x: 2t – 5s = -1 &

y: 3t – 1s = 5

Now to solve for one variable, the other must be cancelled.

A possible solution to this would be to multiply the first equation by -1 and the second equation by 5 resulting in:

x: -2t + 5s = 1

y: 15t – 5s = 25

From here the two s variables are equally opposite so we can add these two to cancel s.

Result

13t = 26 => t = 2

Having t allows us to find s easily.

Simply replace t with 2 in the original equation.

x: 1 + 2t = 0 + 5s

=> 1 + 2(2) = 5s => 5 = 5s => 1 = s

Having t & s, you now have when the two line intercect. To ensure that the lines truly intersect, it is important to test these finding for all equations.

x = 1 + 2(2) = 5 x = 0 + 5(1) = 5

y = 0 + 3(2) = 6 y = 5 + 1(1) = 6

z = 0 + 1(2) = 2 z = 5 – 3(1) = 2

We are left with these same answers for both lines, so it can be concluded that these two lines intersect in space at point(5, 6, 2).