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

Distance from the origin to the curve

  1. Mar 12, 2005 #1
    Anyone know the formula to find the minimum distance from the origin to the curve, and find that point on the curve that is the minimum distance from the origin.

    This is for a programming problem in MATLAB, so thanks for any help!!!

    EDIT: By the way, I don't know the points on the curve, so i need to minimize the distance using points that i need to determine.
    Last edited: Mar 12, 2005
  2. jcsd
  3. Mar 13, 2005 #2
    Use the distance formula: [tex] D = \sqrt{(y_2-y_1)^2 + (x_2-x_1)^2}[/tex].

    Differentiate and solve for the shortest distance.
  4. Mar 13, 2005 #3
    OK, I got the D, but both x and y are described as functions of time, so how do I get t?
  5. Mar 13, 2005 #4
    X and Y are the coordinates of the curve. Actually, since one point is the origin you can rewrite the equation as:

    [tex] D = \sqrt{(y_1)^2 + (x_1)^2}[/tex]

    This is because the point (0,0) has no effect on the answer if you put it in.

    You said you wanted to know how to find the shortest possible distance from the point to the curve, why are you talking about time? i don't understand the question.
  6. Mar 14, 2005 #5


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    It is easier to work with the squared distance, rather than the distance.
  7. Mar 14, 2005 #6
    So, putting together the ideas of Jameson and arildno, Let x = x(t), y = y(t), then

    [tex]F = D^{2} = (x(t))^{2} + (y(t))^{2}[/tex]

    Take the derivative of F with respect to t and set it to zero.

    The time at which the minimum distance is attained will be one of the values of t that satisfy the resulting equation, call it [tex]t_{m}[/tex]. The point at which the minimum distance is attained will be [tex](x(t_{m}), y(t_{m}))[/tex] and the minimum distance will be:

    [tex]\sqrt{(x(t_{m}))^{2} + (y(t_{m}))^{2}}[/tex]
    Last edited: Mar 14, 2005
  8. Mar 14, 2005 #7
    I found the output D, but I need to find the input.

    However, this is a programming problem, not a calculus problem, so I have to figure out the code.
  9. Mar 14, 2005 #8
    You explained it correctly, you need to take the derivative and set it equal to zero. So why did you say the minimum distance was [tex]\sqrt{(x(t_{m}))^{2} + (y(t_{m}))^{2}}[/tex]? I just don't understand and would like clarification if possible.

    You differentiate [tex]x^2 + y^2[/tex] and set it equal to zero, getting
    [tex]2x + \frac{dy}{dx} * 2y = 0[/tex]
  10. Mar 14, 2005 #9
    Differentiate with respect to t.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook