# Why do differentiating and integrating 'work'?

Why do you get a function's (changing) slope when you take its derivative and why do you get the area under the function when you take its integral? What is the easiest reasoning behind this?

-
Why they work is merely a matter of proofs and definitions. The intuitive reasoning behind it (which what I think you're asking), is geometric. I'm not good at drawing so hopefully someone will give you an answer soon. –  Git Gud Feb 24 '13 at 12:30
Because derivative is defined in terms of slopes of tiny line segments and integral is defined in terms of areas of tiny rectangles. –  Karolis Juodelė Feb 24 '13 at 12:30
Check this out for integrals : math.stackexchange.com/questions/15294/… –  user10444 Feb 24 '13 at 12:31
Read Derivative and Integral on Wikipedia. I am sure you'll find the answers. –  Heitor Fontana Feb 24 '13 at 12:32

I strongly recommend that you take a look at the first chapter of Gilbert Strang's Calculus textbook: http://ocw.mit.edu/resources/res-18-001-calculus-online-textbook-spring-2005/textbook/MITRES_18_001_strang_1.pdf. This gives insightful (and slightly atypical) introduction to differentiation and integration.

A more standard explanation would be this:

Differentiation

Consider the above image. The derivative essentialy takes the limit as $h \to 0$. It is clear that for small $h$ you get a good approximation for the tangent line. In the limit, this approximation becomes the tangent line. This concept is defined mathematically as:

Graphically, this is:

Integration

Again, consider the above image. With integration we take the limit as the number of rectangles approaches infinity (and hence each rectangles width approaches zero). It is clear that with hundereds or thousands of rectangles, the sum of the area of each rectangle is very nearly the area under the curve. In the limit, we get that the sum is exactly equal to the area. This limit is written mathematically as:

$\int _{ a }^{ b }{ f(x)dx=\lim _{ n\rightarrow \infty }{ \sum _{ i=1 }^{ n }{ f({ x }_{ i })\Delta x } } }$

Graphically, this is:

-
+1 fancy! $\ \!\!$ –  Berci Feb 25 '13 at 0:48

It only works under euclidean metric; change the metric, and they are not that simply related.

Or, just take the Riemann sum of the differences; all the terms cancel out but the first and last.

Or, just differentiate the Riemann sums and all the mid terms cancel each other out but first and last.

Of course, all this has to be still true with more general integration and differentiation methods, but seeing the simple arithmetic that relates the two takes away the mystery.

If the graph was drawn on surface of sphere, the relationship between integration and differentiation would be much more different as one being the inverse of other.

-
-1. Given that the question is fairly elementary, an answer that talks about generalisations to non-Euclidean situations will probably not help very much. Also, the answer has several typos, which I corrected. –  bubba Feb 24 '13 at 13:08
Given that the question asks why, without the generalisation looking only at the specific does not explain the why, but the how. Tx –  Arjang Feb 24 '13 at 13:35

For insight, probably the best is to always consider the quantities like $dx$ as an infinitesimal quantity, i.e. such a positive real-like 'number' which is smaller than all $\frac1n\ (n\in\Bbb N)$. This context can be made precise, using nonstandard analysis. Using this language, real functions can be extended to the nonstandard reals (this contains the reals, together with infinitesimals at each point). Let us introduce the notation $$a\approx b\ \text{ iff }\ a-b\ \text{is infinitesimal}.$$

For a function $f$, we define $df(x):=f(x+dx)-f(x)$, where $dx$ denotes an arbitrary infinitesimal. We have that $f$ is continuous at $x$ iff $df(x)$ is always infinitesimal (for any infinitesimal choice of $dx$), i.e. iff $f(x+dx)\approx f(x)$.

For an arbitrary $h>0$ we have that $\displaystyle\frac{f(x+h)-f(x)}h$ is just the slope of the line going through $(x,f(x))$ and $(x+h,f(x+h))$. In ordinary analysis, we can take its limit as $h\to 0$, then the sector will converge to the tangent at $x$. In the nonstandard approach, it is just defined as $$f'(x):\approx\frac{df(x)}{dx}$$ Intuitively, if the distance of $x$ and $x+dx$ is infinitesimal, then the difference (of the slopes) of the sector with $h=dx$ to the tangent is also infinitesimal.

For the integral, $f(x)\cdot dx$ is already the (signed) area of a rectangle of height $f(x)$ and infinitesimal width $dx$. If $f(x)$ is real, then $f(x)\cdot dx$ is again infinitesimal, and we can 'sum' these up for all reals $x\in [a,b]$ -- these are so much that their sum is usually already not infinitesimal. $$\int_a^b f :=\sum_{x\in [a,b]}f(x)\cdot dx$$ This only wanted to give just an insight for the original and now called nonstandard approach. For more details, see the wikipedia article.

-
Let $f$ be the function and $F$ be its integral, so $F(x) = \int_a^x f(t) dt$, where $a$ is the initial integration point. It does not matter what $a$ is - it will soon exit, stage right.
The derivative of $F$ at $x$ is approximately $\frac{F(x+h)-F(x)}{h}=\frac1{h}\int_x^{x+h} f(t) dt$ (told you $a$ would go away, now all ok, say hey!). Since $f$ is "nice", over a small interval, such as $[x, x+h]$, it is nearly constant, so each $f(t)$ in $[x, x+h]$ is $f(x)$ with an error that gets smaller and goes to zero as $h \to 0$ (that is what "nice" means).
This $\int_x^{x+h} f(t) dt \approx \int_x^{x+h} f(x) dt = h f(x)$ so $F'(x) \approx \frac{F(x+h)-F(x)}{h} =\frac1{h}\int_x^{x+h} f(t) dt \approx \frac1{h} (h f(x)) = f(x)$.