I was trying to find an equation for the distance between 2 points on a function, following (tracing) that function i.e. not the shortest distance (Pythagoras), rather actually tracing the distance of the function from one point to the other.

I reasoned that if I zoomed up on the function and the "rectangles" produced by Riemann sum integration, in particular as (in an example case) the function is decreasing, the distance between the individual points of the top vertices of the rectangles is found by Pythagorus' and is the square root of the dx^2 + the change in height ($f(x_i) - f(x_{i-1})$).

Though there is an infinite number of these, as such I eventually concluded that it is given by; $$\lim_{n \to \infty} \sum_{i=1}^n \sqrt{(\Delta x)^2 + (\Delta y)^2}$$ Where, $\Delta x = \frac{b-a}{n}, \Delta y = f(x_i) - f(x_{i-1}), x_i = a+\Delta x (i)$

This works when I tested it on straight lines (I already knew how to find the distance), though when I tried it on a parabola ($y=x^2$) from $x=-1$ to $x=1$, I didn't get an answer that seemed correct (Link - it eventually got approx. 8.26).

So my question is where is my oversight? For curiosity, is there a way to simplify the above sum? What is the actual formula for finding the distance between 2 points by tracing the function?


  • $\begingroup$ There is a way of simplifying your sum. The formula you want is the arc length formula which is defined as an integral (or line integral more generally). Do you know single variable calculus? $\endgroup$ – lordoftheshadows Nov 19 '16 at 0:33
  • $\begingroup$ Yes @lordoftheshadows . Though to what extent, is likely questionable. I'm a high school student, as such I know to that extent single variable calculus (though I constantly delve into more rigorous definitions, such as Riemann sum and the delta-epsilum definition of limits). Regardless, it would be much appreciated if you could show me :) $\endgroup$ – frog1944 Nov 19 '16 at 0:37

As lordoftheshadows commented, what you need is to use the arc length formula which corresponds to your sum for very small $\Delta x$ (or very large $n$).

I suggest you have a look here.

Between two points on the curve $y(x)$, the formula is just $$L=\int_{a}^{b}\sqrt{1+(y'(x))^2}\,dx$$ In the case of $y(x)=x^2$. If not yet done, you will very soon learn about the antiderivatives and be able to show that $$\int\sqrt{1+4x^2}\,dx=\frac{1}{2} x\sqrt{1+4 x^2} +\frac{1}{4} \sinh ^{-1}(2 x)$$ So, using the integration bounds, $$L=\left(\frac{1}{2} b\sqrt{1+4 b^2} +\frac{1}{4} \sinh ^{-1}(2 b)\right)-\left(\frac{1}{2} a\sqrt{1+4 a^2} +\frac{1}{4} \sinh ^{-1}(2 a)\right)$$ For illustration purposes, let us use $a=0$ and $b=2$; the result would then be $$L=\sqrt{17}+\frac{1}{4} \sinh ^{-1}(4)\approx 4.64678$$

Suppose that you apply the discrete method using $\Delta x=\frac{1}{10}$; you should arrive to $\approx 4.64598$; using $\Delta x=\frac{1}{100}$ you should arrive to $\approx 4.64678$ which is "exact" for six significant figures.

Just for the fun, use the discrete method with Excel varying the size of $\Delta x$; you will notice how the result converges to the correct value.

  • $\begingroup$ Thank you very much. Do you know what I assumed or did wrong in the derivation to end up with my equation for it ($\lim_{n \to \infty} \sum_{i=1}^n \sqrt{(\Delta x)^2 + (\Delta y)^2}$)? $\endgroup$ – frog1944 Nov 19 '16 at 6:56
  • $\begingroup$ Even if the equation I got was wrong, out of curiosity is there a way to simplify it into something much nicer? Perhaps an integral? $\endgroup$ – frog1944 Nov 19 '16 at 6:56
  • $\begingroup$ Your equation is correct if you write $x_i=a+(i-1)\Delta x$. Concerning the integral, it is what I wrote. $\endgroup$ – Claude Leibovici Nov 19 '16 at 7:07
  • $\begingroup$ Oh, ok. That's quite annoying to know that was the mistake I made. Thank you very much. To transition then from what I had to the integral, do you use Riemann sums? Also does the arc length formula work on all continuous and differentiable functions? $\endgroup$ – frog1944 Nov 19 '16 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.