# Distance from the origin to the curve

1. Mar 12, 2005

### physicsCU

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. Mar 13, 2005

### Jameson

Use the distance formula: $$D = \sqrt{(y_2-y_1)^2 + (x_2-x_1)^2}$$.

Differentiate and solve for the shortest distance.

3. Mar 13, 2005

### physicsCU

OK, I got the D, but both x and y are described as functions of time, so how do I get t?

4. Mar 13, 2005

### Jameson

X and Y are the coordinates of the curve. Actually, since one point is the origin you can rewrite the equation as:

$$D = \sqrt{(y_1)^2 + (x_1)^2}$$

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.

5. Mar 14, 2005

### arildno

It is easier to work with the squared distance, rather than the distance.

6. Mar 14, 2005

### Jimmy Snyder

So, putting together the ideas of Jameson and arildno, Let x = x(t), y = y(t), then

$$F = D^{2} = (x(t))^{2} + (y(t))^{2}$$

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 $$t_{m}$$. The point at which the minimum distance is attained will be $$(x(t_{m}), y(t_{m}))$$ and the minimum distance will be:

$$\sqrt{(x(t_{m}))^{2} + (y(t_{m}))^{2}}$$

Last edited: Mar 14, 2005
7. Mar 14, 2005

### physicsCU

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.

8. Mar 14, 2005

### Jameson

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 $$\sqrt{(x(t_{m}))^{2} + (y(t_{m}))^{2}}$$? I just don't understand and would like clarification if possible.

You differentiate $$x^2 + y^2$$ and set it equal to zero, getting
$$2x + \frac{dy}{dx} * 2y = 0$$

9. Mar 14, 2005

### Jimmy Snyder

Differentiate with respect to t.