Basic Math/Overlapping lines
Expert: Pawan Musale - 9/8/2009
QuestionPeace be upon the reader, i wanted to ask if there is any formula which can be use to know that two line segments are overlapping on a graph. That is if we have a line from point (2,2) to (2,7) and another line from (2,4) to (2,7) they are parallel but overlapping. I've found something on net which uses max and min values from both the lines to know if they are overlapping but it is not actually working ...
Please if you can suggest sumthing, it would be a GREAT help. Thank you
AnswerRabia,
Consider first set of points: (2,2)and (2,7)
Let us calculate slope (m) of the line passing through these points:
Slope (m) for line passing through points (x1, y1) and (x2, y2) is calculated as,
m = (y2 - y1) / (x2 - x1) ---------------------- #1
Putting values of points in equation 1 above,
m = (7-2)/(2-2) = 5/0 = undefined ------------ #2
Now, remember that if slope of a line is "undefined" then it is parallel to y-axis.
Hence this line is parallel parallel.
Similarly, if we calculate slope of other line, it also turns out to be indefinite as
m = (7-4)/(2-2) = 5/0 = undefined --------------- #3
From equation 2 and 3 above,
Both lines are parallel.
Now we will find equation of both lines.
Now remember this: If a line is parallel to y-axis, then its equation is given as
x = a where a is x co-ordinate of any point on the line.
For first line above passing through (2,2) and (2,7), x co-ordinate is 2.
Hence equation of line 1 is x=2 --------------------- #4
For second line above passing through (2,4) and (2,7), x co-ordinate is 2.
Hence equation of line 2 is x=2 --------------------- #5
From #4 and #5 above, it is clear that both lines are the same. This means that they are overlapping.
This is mathematical proof of the question.
If this is not clear, then please let me know.
All the best for your studies. :)
Regards,
Pawan