Distance Between 2 Points on a Given function 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?
Thanks

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.
