# Riemann Sum: How to Find the Area Under the Curve

Calculus > Riemann Sum

## What is a Riemann Sum?

A Riemann sum is used in calculus as one way to approximate the area under a curve — which is the same as calculating an integral. There are five main ways to calculate Riemann sums:
The left-hand Reimann sum and the right-hand Reimann sum use the left and the right endpoints of each subinterval to approximate the area. With the right-hand sum, each rectangle is drawn so that the upper-right corner touches the curve; with the left-hand sum, the upper-left corner touches the curve.

A left hand Riemann sum.

A right hand Riemann sum.

The trapezoid rule uses an average of the left- and right-hand values. The trapezoids hug the curve better than left- or right- hand rule rectangles and so give you a better estimate of the area.

Trapezoid Riemann sum.

The midpoint rule uses the midpoint of the rectangles for the estimate. A midpoint rule is a much better estimate of the area under the curve than either a left- or right- sum. As a rule of thumb, midpoint sums are twice as good than trapezoid estimates.

Midpoint Riemann sum.

Simpson’s rule uses parabolas and is an extremely accurate approximation method. It will give the exact area for any polynomial of third degree or less.

Simpson’s rule uses a combination of the midpoint rules and trapezoid rules, so if you have already calculated the midpoint and trapezoid areas, it’s a simple way to get a more accurate approximation. The subscript 2n in the equation means that if you use M1 and T1, you get S2, if you use M2 and T2, you get S4.
S2n=(Mn+Mn+Tn)⁄3

Riemann sum, Simpson’s.

## Sample Problem (Right Hand Riemann)

Sample problem: Find the area under the curve from x=0 to x=2 for the function x3 using the right endpoint rule.

Step 1: Sketch the graph:

Step 2: Draw a series of rectangles under the curve, from the x-axis to the curve. We’ll use four rectangles for this example. The question asks for the right endpoint rule, so draw your rectangles using points furthest to the right. Place your pen on the endpoint (the first endpoint to the right is 0.5), draw up to the curve and then draw left to the y-axis to form a rectangle.

Step 3: Calculate the area of each rectangle by multiplying the height by the width.

 Interval 0 to 0.5 0.5 to 1 1 to 1.5 1.5 to 2 Height 0.125 1 3.375 8 Width .5 .5 .5 .5 W * H .0625 .5 1.6875 4

Step 4: Add all of the rectangle’s areas together to find the area under the curve: .0625 + .5 + 1.6875 + 4 = 6.25
That’s it!

Tip:The number of rectangles is arbitrary — you can use as many, or as few, as you want. However, the more rectangles you use, the better the approximation will be to the actual area.
Tip:The right-hand curve is an overestimate of the actual area and the left-hand rule is an underestimate.
Tip:While the left-hand rule, the right-hand rule and the midpoint rule use rectangles, The trapezoid rule uses trapezoids.

Left hand rule.

Midpoint rule

Trapezoid rule.

## Example 2: Midpoint Riemann Sum

Sample question: Calculate a Riemann sum for f(x)=x2+2 on the interval [2,4] using n=8 rectangles and midpoint evaluation.

Step 1: Divide the interval into segments. For this sample problem, divide the x-axis into 8 intervals.
Step 2: Find the midpoints of those segments. The midpoints for the segments (in red on the picture below) are: 2.125, 2.375, 2.625, 2.875, 3.125, 3.375, 3.625, and 3.875. These will be your inputs (x-values) for the Riemann sum.

Step 3: Plug the midpoints into the function, and then multiply by the interval length, which is 0.25:
f(2.125)0.25 + f(2.375)0.25 + f(2.625)0.25 + f(2.875)0.25 + f(3.125)0.25 + f(3.375)0.25 + f(3.625)0.25 + f(3.875)0.25
Using algebra to rewrite:
= [f(2.125) + f(2.375) + f(2.625) + f(2.875) + f(3.125) + f(3.375) + f(3.625) + f(3.875)]0.25
Plugging the function’s values into the equation:
= [6.515625 + 7.640625 + 8.890625 + 10.265625 + 11.765625 + 13.390625 + 15.140625 + 17.015625]0.25
= 90.625(0.25) = 22.65625

That’s it!

Tip:The midpoint came pretty close to the actual integral (22.6666). But you can check your work by using the following Definite Integral calculator. Plug your equation into the “integral” line on the calculator (note: use the ^ key to indicate an exponent, like 2^2 for 22. Then plug your interval into the “From x=” boxes (leave “x” in the first box). In this particular example, you’d type “2” into the second box and “4” into the third box. Click “Submit” to get the integral.

------------------------------------------------------------------------------

If you prefer an online interactive environment to learn R and statistics, this free R Tutorial by Datacamp is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try this Statistics with R track.

Comments are now closed for this post. Need help or want to post a correction? Please post a comment on our Facebook page and I'll do my best to help!
Riemann Sum: How to Find the Area Under the Curve was last modified: October 12th, 2017 by