Associated Topics || Dr. Math Home || Search Dr. Math

### Intersection Point of Two Lines

```Date: 07/22/2003 at 10:19:15
From: Bensegueni
Subject: How to find the intersection point of two lines in 3D

I want to find the intersection point of two lines (in 3D) defined
by their direction vectors V1 and V2.

I found this question in the archive:

Vector Algebra: Finding the Intersection Point
http://mathforum.org/library/drmath/view/62814.html

but when I used the method given it didn't work. The method was to
use the two equations that represent the lines:

L1 = P1 + aV1
L2 = P2 + bV2

Where V1 and V2 are the director vectors
P1 point which belongs to L1
P2 point which belongs to L2

<=> P1 + aV1 = P2 + bV2 => aV1 = (P2-P1) + bV2
x V2 in the two sides we will have (cross product):
a(V1 x V2) = (P2-P1) x V2
once we have "a" we can replace it in the 1st equation to get the
point of intersection, but I don't get a correct result.
```

```
Date: 07/22/2003 at 13:00:14
From: Doctor George
Subject: Re: how to find the intersection point of two lines in 3D

Hi Bensegueni,

Here is another way to think about intersecting two lines in 3D.

Define line 1 to contain point (x1,y1,z1) with vector (a1,b1,c1).
Define line 2 to contain point (x2,y2,z2) with vector (a2,b2,c2).

We can write these parametric equations for the lines.

Line1                         Line2
-----                         -----
x = x1 + a1 * t1              x = x2 + a2 * t2
y = y1 + b1 * t1              y = y2 + b2 * t2
z = z1 + c1 * t1              z = z2 + c2 * t2

If we set the two x values equal, and the two y values equal we get
these two equations.

x1 + a1 * t1 = x2 + a2 * t2
y1 + b1 * t1 = y2 + b2 * t2

You can solve these equations for t1 and t2. Then put those values
back into the parametric equations to solve for the intersection
point.

If you have done the arithmetic correctly, you only need to use one of
the equations for each of x and y. You should check both equations for
z to make sure they give the same result. If they give different
results then the lines are skew.

Does that make sense? Write again if you need more help.

- Doctor George, The Math Forum
http://mathforum.org/dr.math/

```

```Date: 02/13/2008 at 13:59:39
From: Ean
Subject: A fallacious answer?

I've tried the method for finding the intersection of two lines in
3D that was given in your archive answer 63719 but it doesn't seem to
work.  Can you show me an example of how it works?

```

```Date: 02/13/2008 at 15:44:04
From: Doctor Peterson
Subject: Re: A fallacious answer? Solving for two unlike terms...

Hi, Ean.

Thanks for writing to Dr. Math.

Here's an example; I'll use both the method the questioner showed
(which Dr. George never commented on) and Dr. George's method, and
maybe you can tell me where you get something erroneous.

Take P1 = (1,0,0)  V1 = (2,3,1)
P2 = (0,5,5)  V2 = (5,1,-3)

Using Bensegueni's method, we find

a(V1 x V2) = a(-10,-11,-13)

and

(P2-P1) x V2 = (-1,5,5)x(5,1,-3) = (-20,-22,-26)

Since the latter is 2(-10,-11,-13), we have a = 2, and the point of
intersection is

P1 + 2V1 = (1,0,0)+(4,6,2) = (5,6,2)

To find b and check the answer,

P2 + bV2 = (0,5,5) + b(5,1,-3)

which will equal (5,6,2) when b=1. So we have a solution.

Now try Dr. George's method. The lines are

Line1                    Line2
-----                    -----
x = 1 + 2t1              x = 0 + 5t2
y = 0 + 3t1              y = 5 + 1t2
z = 0 + 1t1              z = 5 - 3t2

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

1 + 2t1 = 0 + 5t2
0 + 3t1 = 5 + 1t2

This reduces to

2t1 - 5t2 = -1
3t1 - 1t2 = 5

We can multiply the first equation by -1 and the second equation by

-2t1 + 5t2 =  1
15t1 - 5t2 = 25
---------------
13t1       = 26

t1 = 2

Plugging that into the second of our pair, we get

3*2 - t2 = 5

which gives

t2 = 1

Plugging those into all six equations for x, y, and z, we get

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

So this is indeed the intersection of the lines.

If you have any further questions, feel free to write back.

- Doctor Peterson, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
College Linear Algebra
High School Linear Algebra

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search