Point on a LineDate: 03/23/2001 at 01:30:02 From: Chris Subject: Point exists on line? Can you please tell me a formula to find if a point exists on a line? Both are in x,y form. Example: is point (x3,y3) on line (x1,y1) - (x2,y2) ? Thank you. Date: 03/23/2001 at 05:31:00 From: Doctor Floor Subject: Re: Point exists on line? Hi, Chris, Thanks for writing. We can check whether the slopes of the lines through * P1(x1,y1) and P2(x2,y2) * P1(x1,y1) and P3(x3,y3) are equal. The first slope is given by y1 - y2 ------- x1 - x2 and the second slope is given by y1 - y3 ------- x1 - x3 The condition that these two are equal gives: y1 - y2 y1 - y3 ------- = ------- x1 - x2 x1 - x3 and thus (y1 - y2)(x1 - x3) = (y1 - y3)(x1 - x2) x1y1 + x3y2 - x1y2 - x3y1 = x1y1 + x2y3 - x1y3 - x2y1 x1(y3-y2) + x2(y1-y3) + x3(y2-y1) = 0 This is the formula you are looking for. Addition: The left-hand side of the equation can be written in the form of a determinant: | 1 x1 y1 | | 1 x2 y2 | = 0 | 1 x3 y3 | (The column of 1's can also be the last column.) This determinant is a very special one: it is the expression for twice the area of triangle P1P2P3. So the condition that P3 lies on line P1 and P2 is translated into the condition that triangle P1P2P3 has an area of zero. For information on the determinant, see, from the Dr. Math archives, Determinants and the Area of a Triangle http://mathforum.org/dr.math/problems/chiaravalli12.14.98.html Finding Area Using Determinants http://mathforum.org/dr.math/problems/victoria.7.27.html If you need more help, just write back. Best regards, - Doctor Floor, The Math Forum http://mathforum.org/dr.math/ |
Search the Dr. Math Library: |
[Privacy Policy] [Terms of Use]
Ask Dr. Math^{TM}
© 1994-2015 The Math Forum
http://mathforum.org/dr.math/