

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Given two straight lines, each represented by two points, there are three
possible cases:
intersect in infinity.
line equal to any of them.
The following derivation shows how to easily find out which case applies to
the two lines and find their intersection point if they intersect in a point.
First, let us assume that the first line S 1 is represented by two points p 1 and
p 2. Similarly, the second line S 2 is represented by two points p 3 and p 4. Each
point pi is represened by two coordinates (xi, yi). Let us also assume that the
intersection point is p 0.
We define the following vectors:
a =
p 1 p 2 = p 2 − p 1 = (x 2 − x 1 , y 2 − y 1 )
b =
p 1 p 0 = p 0 − p 1 = (x 0 − x 1 , y 0 − y 1 )
c =
p 3 p 4 = p 4 − p 3 = (x 4 − x 3 , y 4 − y 3 )
d =
p 3 p 0 = p 0 − p 3 = (x 0 − x 3 , y 0 − y 3 )
Since the intersection point p 0 is on the first line, we have
||a × b|| = 0
(x 2 − x 1 )(y 0 − y 1 ) − (x 0 − x 1 )(y 2 − y 1 ) = 0
(x 2 − x 1 )y 0 + (y 1 − y 2 )x 0 = y 1 x 2 − x 1 y 2 (1)
Similarly, since the intersection point p 0 is on the second line, we have
||c × d|| = 0
(x 4 − x 3 )(y 0 − y 3 ) − (x 0 − x 3 )(y 4 − y 3 ) = 0
(x 4 − x 3 )y 0 + (y 3 − y 4 )x 0 = y 3 x 4 − x 3 y 4 (2)
Now, to find the values of the two unknowns x 0 and y 0 , we need to solve the
two linear equations 1 and 2. We use Cramer’s rule as follows.
x 2 − x 1 y 1 − y 2
x 4 − x 3 y 3 − y 4
Dy 0
y 1 x 2 − x 1 y 2 y 1 − y 2
y 3 x 4 − x 3 y 4 y 3 − y 4
Dx 0 =
x 2 − x 1 y 1 x 2 − x 1 y 2
x 4 − x 3 y 3 x 4 − x 3 y 4
Finally, we find the unknowns x 0 = |Dx 0 |/|D| and y 0 = |Dy 0 /|D|.
The three cases described above will map to the following cases:
have a solution at infinity which means that the two lines are disjoint and
parallel (they intersect at infinity).
infinite number of solutions which means that the two lines are coincident.
the two lines intersect at a single point.
Example 1:
p 1 = (2, 0), p 2 = (0, 1), p 3 = (0, 0), p 4 = (1, 4)
Dx 0
|Dx 0 | = 2
Dy 0
|Dy 0 | = 8