MATH 142: Elements of Calculus II
Spreadsheets and Riemann Sums

These instructions will help you use a spreadsheet program (e.g. Microsoft Excel or OpenOffice) to approximate the area under a curve.

Think about the space between the graph of the function f(x) = x2, the x-axis, the y-axis, and the vertical line x = 1. The area of this roughly triangular shape is a bit less than one half. By following the steps below, we can use a computer to get a much better approximation of its area than just "less than one half". The way we do this is to fill the triangular shape with tall, skinny rectangles then add the areas of the rectangles. This total is called a Riemann Sum.

  1. Start your spreadsheet software. Often you can do this by using the Start menu to look at available Programs, then by choosing Microsoft Office -> Excel.
  2. Put a text label "x" in cell A1 and label "f(x)" in cell B1 by clicking in the cells and typing.
  3. Fill in column A with values of x between 0 and 1. For your first approximation you should use 0, .2, .4, .6, .8 and 1. These will be the values we input to the function, and the points (0,0), (.2, 0), (.4, 0), (.8,0) will be the lower left hand corners of the rectangles we use to approximate the area under the graph.
  4. Fill in column B with the corresponding values of f(x) as follows:
    1. Click on cell B2.
    2. Type = A2*A2 and hit enter. (A zero should appear in cell B2.)
    3. Select cells B2 through B7 by clicking and dragging. Usually, the cells will be highlighted in some color or outlined when you've done this correctly.
    4. Select Fill -> Down from the Edit menu.
    These numbers (except the final one) will be the heights of the rectangles we use to approximate the area under the curve.
  5. Label cell C1 "Areas". The areas of the rectangles used to approximate the triangular shape will go in column C.
  6. In cell C2, type = (A3-A2)*B2 and hit enter. This will fill cell C2 with the area of the rectangle with lower left corner (0, 0), lower right corner (0, .2), and height f(0) = 0. Not surprisingly, a rectangle with height 0 has area 0.
  7. Select cells C2 through C6 and use the Fill command to fill in the rest of the rectangle areas. (If you accidentally select cell C7 you may get a nonsense entry in that cell.)

    Take a second to think about your results. The numbers listed in column C are the areas of rectangles that fit under the graph of the function f(x) = x2. This means that the area under the graph of the function is probably just a little bit more than the sum of those areas because some of the space under the curve was not covered by rectangles.

  8. Label cell D1 "Sum".
  9. In cell D2 type = SUM(C2:C6) and hit enter. Cell D2 should now show the sum of the areas of the rectangles (0.24).
  10. Save your document so that you can come back to it later.

"A little more than 0.24" is a much better estimate than "less than one half". You can improve this answer still further by making your rectangles thinner. To compute a new estimate using areas of rectangles with width .05 units, type = A2 + .05 in cell A3 and Fill down to cell A22, then fill columns B and C down to cells B22 and C21 and set cell D2 to = SUM(C2:C21).

Question 1: What estimate of the area under the graph of f(x) = x2 do you get if you sum the areas of 20 rectangles with base width .05 units (as described above)?

Question 2: Your estimate in Question 1 should have been different from 0.24. Explain the difference between the two estimates. Which is more accurate? Why? Is the new estimate larger or smaller than the old estimate? Is it larger or smaller than the exact value of the area?

Question 3: What do you think the actual area is?

Question 4: If you have time, estimate the area again with even thinner rectangles. What base width did you use and what area estimate did you get?

Later, we'll be able to use calculus to find the exact area and check our work. However, for some functions (like the famous statistics function g(x) = e-x2) it is impossible to compute an exact integral! For functions like these you must use a tool like a calculator or spreadsheet to estimate the area. Those tools use methods very similar to our method of adding areas of rectangles.

Extra Credit: (Turn in a printout of your spreadsheet to add up to 1 point to your final grade.) What is the area between the graph of the function g(x) = e-x2, the x-axis, the y-axis, and the line x = 1? Note: most spreadsheets have a function EXP() that you can use to compute e to a power. For example, EXP(1) = e1 = 2.718...

MATH 142 Home