The page you are reading is part of a draft (v2.0) of the "No bullshit guide to math and physics."
The text has since gone through many edits and is now available in print and electronic format. The current edition of the book is v4.0, which is a substantial improvement in terms of content and language (I hired a professional editor) from the draft version.
I'm leaving the old wiki content up for the time being, but I highly engourage you to check out the finished book. You can check out an extended preview here (PDF, 106 pages, 5MB).
We defined the integral operation ∫f(x)dx as the inverse operation of ddx, but it is important to know how to think of the integral operation on its own. No course on calculus would be complete without a telling of the classical “rectangles story” of integral calculus.
n rectangles.
In the picture on the right, we are approximating the function f(x)=x3−5x2+x+10 between xi=−1 and xf=4 using n=12 rectangles.
The sum of the areas of the 12 rectangles is what we call S12(−1,4).
We say that S12(−1,4)≈A(−1,4).
The main formula you need to know is that the combined area approximation is given by the sum of the areas of the little rectangles: Sn=n∑k=1sk.
Each of the little rectangles has an area sk given by its height multiplied by its width. The height of each rectangle will vary, but the width is constant. Why constant? Riemann figured that having each rectangle with a constant width Δx would make it very easy to calculate the approximation. The total length of the interval from xi to xf is (xf−xi). If we divide this length into n equally spaced segments, each of width Δx given by: Δx=xf−xin.
OK, we have the formula for the width figured out, let's see what the height will be for the k-th rectangle, where k is our counter from left to right in the sequence of rectangles. The height of the function varies as we move along the x axis. For the rectangles, we pick isolated “samples” of f(x) for the following values xk=xi+kΔx, for k∈{1,2,3,…,n}, all of them equally spaced Δx apart.
The area of each rectangle is height times width: sk=f(xi+kΔx)Δx.
Now, my dear students, I want you to stare at the above equation and do some simple calculations to check that you understand. There is no point in continuing if you are just taking my word for it. Verify that when k=1, the formula gives the area of the first little rectangle. Verify also that when k=n, the formula for the xn gives the right value (xf).
Ok let's put our formula for sk in the sum where it belongs. The Riemann sum approximation using n rectangles is given by Sn=n∑k=1f(xi+kΔx)Δx, where Δx=|xf−xi|n.
Let us get back to the picture where we try to approximate the area under the curve f(x)=x3−5x2+x+10 by using 12 pieces.
For this scenario the value we would get for the 12-rectangle
approximation to the area under the curve with
S12=12∑k=1f(xi+kΔx)Δx=11.802662.
You shouldn't trust me though, but always check for yourself using
live.sympy.org
by typing in the following expressions:
>>> n=12.0; xk = -1 + k*5/n; sk = (xk**3-5*xk**2+xk+10)*(5/n); >>> summation( sk, (k,1,n) ) 11.802662...
Who cares though? This is such a crappy approximation! You can clearly see that some rectangles lie outside of the curve (overestimates), and some are too far inside (underestimates). You might be wondering why I wasted so much of your time to achieve such a lousy approximation. We have not been wasting our time. You see, the Riemann sum formula Sn gets better and better as you cut the region into smaller and smaller rectangles.
With n=25, we get a more fine grained approximation
in which the sum of the rectangles is given by:
S25=25∑k=1f(xi+kΔx)Δx=12.4.
Then for n=50 we get:
S50=12.6625.
For n=100 the sum of the rectangles areas is starting to look pretttttty much like the function.
The calculation gives us S100=12.790625.
For n=1000 we get S1000=12.9041562 which is very close to the actual value of the area under the curve: A(−1,4)=12.91666…
You see in the long run, when n gets really large the rectangle approximation (Riemann sum) can be made arbitrarily good. Imagine you cut the region into n=10000 rectangles, wouldn't S10000(−1,4) be a pretty accurate approximation of the actual area A(−1,4)?
The fact that you can approximate the area under the curve with a bunch of rectangles is what integral calculus is all about. Instead of mucking about with bigger and bigger values of n, mathematicians go right away for the kill and make n go to infinity.
In the limit of n→∞, you can get arbitrarily close approximations to the area under the curve. All this time, that which we were calling A(−1,4) was actually the “integral” of f(x) between x=−1 and x=4, or written mathematically: A(−1,4)≡∫4−1f(x)dx≡lim
While it is not computationally practical to make n \to \infty,
we can convince ourselves that the approximation becomes better and
better as n becomes larger. For example the approximation using n=1M rectangles is accurate up to the fourth decimal place as
can be verified using the following commands on live.sympy.org
:
>>> n=1000000.0; xk = -1 + k*5/n; sk = (xk**3-5*xk**2+xk+10)*(5/n); >>> summation( sk, (k,1,n) ) 12.9166541666563 >>> integrate( x**3-5*x**2+x+10, (x,-1,4) ).evalf() 12.9166666666667
In practice, when we want to compute the area under the curve, we don't use Riemann sums. There are formulas for directly calculating the integrals of functions. In fact, you already know the integration formulas: they are simply the derivative formulas used in the opposite direction. In the next section we will discuss the derivative-integral inverse relationship in more details.
[ Riemann sum wizard ]
http://mathworld.wolfram.com/RiemannSum.html