# Distance between two points on a function

My question concerns simple functions e.g. exponential or trigonometrical curves. Suppose you are given two points, and are asked to find the distance between those two points which also lie on the curve, how would this be calculated?

In case the answer is obvious, pardon my naivete- I'm not a math major. Thanks!

EDIT

I think an example would help- suppose the curve is y = 2^x, what is the distance between the points (2, 4) and (10, 1024)? This is not homework- the functions I'm working with are much more complicated.

-
Here's what you need, it's called arc length. – Raskolnikov May 1 '11 at 20:20
Ockham - you say 'shortest distance', but there is only one path right? – jon_darkstar May 1 '11 at 20:26
@jon_darkstar yes, you're correct. There's only one path. My mistake. btw, dark star is one of my favourite jams, and i absolutely adore the grateful dead. – OckhamsRazor May 1 '11 at 20:29
glad to hear it, mine too. =D. arc length is pretty common problem. its basically the integral of infintesimal distances. Rask's link is good – jon_darkstar May 1 '11 at 20:34
@jon_darkstar could you illustrate this with an example, though? that would be of great help. – OckhamsRazor May 1 '11 at 20:43

So with the curve y=2^x and the arc between (2,4) and (10,1024)

Formula is: s = Int(a,b,sqrt(1+f'(x)^2)) when y is function of x (little more involved for more general curves like a circle or something)

f'(x) = ln(2)*2^x

s=Int(2,10,sqrt(1+ln(2)*2^x))

Answer is ~72.8. makes some intuitive sense. it must be longer than the straight line connecting the points, so that gives us a lower bound. sqrt(8^2 + 1020^2) = 31.8

The formula i gave above follows pretty closely from standard distance / pythagorean theorem

We need to sum up a bunch of infintesimal distances, should be a pretty familiar calculus concept. We are solving for s, the arc length

ds^2 = dx^2 + dy^2 <--divide thru by dx^2
(ds/dx)^2 = 1 + (dy/dx)^2 <-- take square root
ds/dx = sqrt(1 + (dy/dx)^2) <-- multiply by dx
ds = sqrt(1 + (dy/dx)^2)*dx <-- take integral. sub f'(x) for (dy/dx) since we have function
s = int(sqrt(1+f'(x)^2))*dx

this leaves us with indefinite integral. take definite integral between a and b to get specific result.

PS - sorry for lack of TeX skills

-
@Ockham: As you can probably tell from jon's answer, arclength functions can be very complicated beasties. If for instance you had given a trigonometric function like $y=\sin\;x$, the arclength functions for these curves are (usually) nonelementary, requiring the use of elliptic integrals. – J. M. May 1 '11 at 21:10
thanks! btw, u forgot to square ln2 * 2^x – OckhamsRazor May 1 '11 at 22:12
you can use codecogs.com/latex/eqneditor.php to help with tex code. just enclose what the page produces in dollar signs. – WWright May 1 '11 at 22:41
aah i sure did. final answer is certainly wrong. ill try to update, but in the meantime dont let it throw you. hopefully you can still learn from it – jon_darkstar May 1 '11 at 22:43