Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Drawing perperdicular to existing coordinates

  1. May 24, 2004 #1
    Hi ,

    I have drawn a line between two co-ordinates say (x1,y1) and (x2,y2). I have a point called (x3,y3) . From the point (x3,y3) i need to draw a perpendicular line to (x1,y1) and (x2,y2). so that i will be able to find the perpendicular distance . Is there any formula for calculating or drawing this perpendicular line. Any equations for finding this? I have depicted the question in terms of diagram which is attached along with this message.
    pls help.

    Thanks in advance

    Attached Files:

  2. jcsd
  3. May 24, 2004 #2


    User Avatar
    Staff Emeritus
    Science Advisor

    The slope of the line from (x1,y1) to (x2,y2) is m= (y2-y1)/(x2-x1). The slope of a line perpendicular to that is -1/m (the slopes of two perpendicular lines always have a product of -1). Finally, the line through (x3,y3) with slope -1/m is y= -1/m(x- x3)+ y3.
  4. May 24, 2004 #3

    Thanks for the very prompt response. Will you please brief with one small example ? I am sorry and i am not much good in mathematics. your help will be greatly appreciated.
  5. May 25, 2004 #4
    The following is for three (or more) dimensions. If you have two points p1 and p2, the equation of a line going through p1 and p2 is generally given by:

    p(t) = p1 + (p2-p1)*t

    We normalize the direction vector (p2-p1) of this line and obtain the equation:

    p(t) = p1 + e*t with e = (p2-p1)/||p2-p1||

    Then the equation of the line perpendicular to |p1p2| going through p3 is given by:

    p(t) = p3 + v3*t with v3 = (p3-p2) - (e*(p3-p2))*e

    If you normalize v3 obtaining the normal vector e3 = v3/||v3||, the distance d3 of the point p3 to the line defined by p1,p2 is given by:

    d3 = (p3-p2)*e3

    With the dot product of two vector v1(x1,y1,z1) and v2(x2,y2,z2) given by:

    v1*v2 = x1*x2 + y1*y2 + z1*z2

    For two dimensions, just take the z component zero.
    Last edited: May 25, 2004
  6. May 25, 2004 #5


    User Avatar
    Staff Emeritus
    Science Advisor

    An example: Let (x1,y1)= (1, 1), (x2,y2)= (5,3) and (x3,31)= (0,3). (Made up pretty much at random.)

    The slope of the line through (1,1) and (5,3) is (3-1)/(5-1)= 2/4= 1/2. (In fact, it is easy to see that the line through those two points is given by y= (1/2)(x-1)+ 1.)

    The slope of any line perpendicular to that is -2 (since -2(1/2)= 1). The line with slope -2 passing through (0,3) is y= -2(x-0)+ 3 or y= -2x+ 3.

    To find the "perpendicular distance" you would now find the point where the two lines y= y= (1/2)(x-1)+ 1= (1/2)x+ 1/2 and y= -2x+ 3 intersect. That gives, of course, (1/2)x+ 1/2= -2x+ 3 or (2+ 1/2)x= 3- 1/2. That is, (5/2)x= 5/2 so x= 1 and then y= 1 (I swear! I picked the numbers "at random"!!) Finally, the distance from (0,3) to (1,1) (the intersection) is sqrt(12+ 22)= sqrt(5).
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Drawing perperdicular to existing coordinates
  1. Existence of functions (Replies: 3)

  2. Existence of N (Replies: 1)

  3. How to draw (Replies: 1)