Approximation with Riemann Sums: Understanding Numerical Integration

Master Riemann sums: comprehensive guide with step-by-step solutions, methods, and visual explanations for numerical integration.

Exercise Solutions 1 to 3
1 Left Riemann Sum
Exercise 1
Approximate ∫[0,2] x² dx using a left Riemann sum with n = 4 subintervals.
Definition:

Riemann sum: A method for approximating definite integrals by dividing the area under a curve into rectangles. The sum of the areas of these rectangles approximates the integral.

Riemann sum methodology:

1. Divide the interval [a,b] into n subintervals of width Δx = (b-a)/n

2. Choose sample points in each subinterval (left, right, midpoint)

3. Calculate f(sample point) for each subinterval

4. Multiply by width: f(xi)·Δx for each rectangle

5. Sum all rectangle areas: Σ f(xi)·Δx

Step 1
Find Δx
Step 2
Find sample points
Step 3
Calculate sum
Step 1: Calculate the width of each subinterval

Δx = (b - a)/n = (2 - 0)/4 = 2/4 = 0.5

Step 2: Identify the left endpoints

For left Riemann sum, we use the left endpoints of each subinterval:

x₀ = 0, x₁ = 0.5, x₂ = 1.0, x₃ = 1.5

Step 3: Evaluate f(x) = x² at each left endpoint

f(0) = 0² = 0

f(0.5) = (0.5)² = 0.25

f(1.0) = (1.0)² = 1.0

f(1.5) = (1.5)² = 2.25

Step 4: Calculate the left Riemann sum

Left Riemann sum = Δx[f(x₀) + f(x₁) + f(x₂) + f(x₃)]

= 0.5[0 + 0.25 + 1.0 + 2.25]

= 0.5[3.5]

= 1.75

Left Riemann sum: 1.75
Actual integral: 8/3 ≈ 2.67
Final answer:

The left Riemann sum approximation of ∫[0,2] x² dx with n = 4 subintervals is 1.75.

Applied rules:

• Left Riemann sum: Use left endpoints: Lₙ = Δx Σᵢ₌₀ⁿ⁻¹ f(xᵢ)

• Subinterval width: Δx = (b-a)/n

• Left endpoints: xᵢ = a + i·Δx for i = 0, 1, ..., n-1

2 Right Riemann Sum
Exercise 2
Approximate ∫[0,2] x² dx using a right Riemann sum with n = 4 subintervals.
Definition:

Right Riemann sum: A Riemann sum where the height of each rectangle is determined by the function value at the right endpoint of each subinterval. This often gives an overestimate for increasing functions.

Step 1
Find Δx
Step 2
Find sample points
Step 3
Calculate sum
Step 1: Calculate the width of each subinterval

Δx = (b - a)/n = (2 - 0)/4 = 2/4 = 0.5

Step 2: Identify the right endpoints

For right Riemann sum, we use the right endpoints of each subinterval:

x₁ = 0.5, x₂ = 1.0, x₃ = 1.5, x₄ = 2.0

Step 3: Evaluate f(x) = x² at each right endpoint

f(0.5) = (0.5)² = 0.25

f(1.0) = (1.0)² = 1.0

f(1.5) = (1.5)² = 2.25

f(2.0) = (2.0)² = 4.0

Step 4: Calculate the right Riemann sum

Right Riemann sum = Δx[f(x₁) + f(x₂) + f(x₃) + f(x₄)]

= 0.5[0.25 + 1.0 + 2.25 + 4.0]

= 0.5[7.5]

= 3.75

Step 5: Compare with actual value

Actual value: ∫[0,2] x² dx = [x³/3]₀² = (2³/3) - (0³/3) = 8/3 ≈ 2.67

The left Riemann sum (1.75) underestimates, while the right Riemann sum (3.75) overestimates.

Right Riemann sum: 3.75
Actual integral: 8/3 ≈ 2.67
Final answer:

The right Riemann sum approximation of ∫[0,2] x² dx with n = 4 subintervals is 3.75.

Applied rules:

• Right Riemann sum: Use right endpoints: Rₙ = Δx Σᵢ₌₁ⁿ f(xᵢ)

• Subinterval width: Δx = (b-a)/n

• Right endpoints: xᵢ = a + i·Δx for i = 1, 2, ..., n

3 Midpoint Riemann Sum
Exercise 3
Approximate ∫[0,2] x² dx using a midpoint Riemann sum with n = 4 subintervals.
Definition:

Midpoint Riemann sum: A Riemann sum where the height of each rectangle is determined by the function value at the midpoint of each subinterval. This often provides the most accurate approximation among the three basic methods.

Step 1
Find Δx
Step 2
Find midpoints
Step 3
Calculate sum
Step 1: Calculate the width of each subinterval

Δx = (b - a)/n = (2 - 0)/4 = 2/4 = 0.5

Step 2: Identify the midpoints

For midpoint Riemann sum, we use the midpoints of each subinterval:

Subintervals: [0, 0.5], [0.5, 1.0], [1.0, 1.5], [1.5, 2.0]

Midpoints: x̄₁ = 0.25, x̄₂ = 0.75, x̄₃ = 1.25, x̄₄ = 1.75

Step 3: Evaluate f(x) = x² at each midpoint

f(0.25) = (0.25)² = 0.0625

f(0.75) = (0.75)² = 0.5625

f(1.25) = (1.25)² = 1.5625

f(1.75) = (1.75)² = 3.0625

Step 4: Calculate the midpoint Riemann sum

Midpoint Riemann sum = Δx[f(x̄₁) + f(x̄₂) + f(x̄₃) + f(x̄₄)]

= 0.5[0.0625 + 0.5625 + 1.5625 + 3.0625]

= 0.5[5.25]

= 2.625

Step 5: Compare with actual value and other methods

Actual value: ∫[0,2] x² dx = 8/3 ≈ 2.667

Left sum: 1.75 (underestimate)

Right sum: 3.75 (overestimate)

Midpoint sum: 2.625 (most accurate)

Midpoint Riemann sum: 2.625
Actual integral: 8/3 ≈ 2.667
Final answer:

The midpoint Riemann sum approximation of ∫[0,2] x² dx with n = 4 subintervals is 2.625.

Applied rules:

• Midpoint Riemann sum: Use midpoints: Mₙ = Δx Σᵢ₌₁ⁿ f(x̄ᵢ)

• Subinterval width: Δx = (b-a)/n

• Midpoints: x̄ᵢ = a + (i-0.5)·Δx for i = 1, 2, ..., n

Key Concepts & Formulas
\(S_n = \sum_{i=1}^{n} f(x_i^*) \Delta x\)
General Riemann Sum
Left Sum
\(L_n = \sum_{i=0}^{n-1} f(x_i) \Delta x\)
Uses left endpoints
Right Sum
\(R_n = \sum_{i=1}^{n} f(x_i) \Delta x\)
Uses right endpoints
Midpoint Sum
\(M_n = \sum_{i=1}^{n} f(\bar{x}_i) \Delta x\)
Uses midpoints
Key definitions:

Riemann sum: An approximation of a definite integral using rectangles under the curve.

Partition: Division of the interval [a,b] into n subintervals.

Sample point: The x-value in each subinterval where we evaluate the function.

Norm of partition: The width of the largest subinterval, denoted ||P||.

Refinement: Making subintervals smaller to improve accuracy.

Riemann sum methodology:
  1. Divide the interval: Split [a,b] into n subintervals of equal width Δx = (b-a)/n
  2. Choose sample points: Select xᵢ* in each subinterval [xᵢ₋₁, xᵢ]
  3. Calculate rectangle areas: For each subinterval, area = f(xᵢ*)·Δx
  4. Sum the areas: Rₙ = Σ f(xᵢ*)·Δx for all subintervals
  5. Take the limit: As n → ∞ (or Δx → 0), Rₙ approaches the definite integral
  6. Verify: Check that the approximation makes sense given the function's behavior
Tip 1: Midpoint Riemann sums are usually more accurate than left or right sums.
Tip 2: For increasing functions, left sums underestimate and right sums overestimate.
Tip 3: As n increases, the approximation generally improves.
Advantages: Provides intuitive understanding of integration, works for any integrable function, foundation for numerical methods.
When to use: When exact integration is difficult, for numerical approximations, to understand definite integral concept.
Critical formulas to memorize:

• General Riemann sum: Sₙ = Σ f(xᵢ*)·Δx

• Subinterval width: Δx = (b-a)/n

• Left endpoints: xᵢ = a + i·Δx (i = 0, 1, ..., n-1)

• Right endpoints: xᵢ = a + i·Δx (i = 1, 2, ..., n)

• Midpoints: x̄ᵢ = a + (i-0.5)·Δx (i = 1, 2, ..., n)

Method Comparison
📊
Left Sum
Lₙ = Δx Σ f(xᵢ)

• Uses left endpoints

• Underestimates for increasing

• Overestimates for decreasing

Right Sum
Rₙ = Δx Σ f(xᵢ)

• Uses right endpoints

• Overestimates for increasing

• Underestimates for decreasing

Midpoint Sum
Mₙ = Δx Σ f(x̄ᵢ)

• Uses midpoints

• Generally most accurate

• Balanced approximation

Exercise Solutions 4 to 5
4 Trapezoidal Approximation
Exercise 4
Approximate ∫[0,2] x² dx using the trapezoidal rule with n = 4 subintervals.
Definition:

Trapezoidal rule: A numerical integration method that approximates the area under a curve using trapezoids instead of rectangles. It averages the left and right Riemann sums.

Step 1
Find Δx
Step 2
Find endpoints
Step 3
Apply formula
Step 1: Calculate the width of each subinterval

Δx = (b - a)/n = (2 - 0)/4 = 0.5

Step 2: Identify all endpoints

All endpoints: x₀ = 0, x₁ = 0.5, x₂ = 1.0, x₃ = 1.5, x₄ = 2.0

Evaluate f(x) = x² at each point:

f(0) = 0, f(0.5) = 0.25, f(1.0) = 1.0, f(1.5) = 2.25, f(2.0) = 4.0

Step 3: Apply the trapezoidal rule formula

Trapezoidal rule: Tₙ = (Δx/2)[f(x₀) + 2f(x₁) + 2f(x₂) + ... + 2f(xₙ₋₁) + f(xₙ)]

T₄ = (0.5/2)[f(0) + 2f(0.5) + 2f(1.0) + 2f(1.5) + f(2.0)]

= (0.25)[0 + 2(0.25) + 2(1.0) + 2(2.25) + 4.0]

= (0.25)[0 + 0.5 + 2.0 + 4.5 + 4.0]

= (0.25)[11.0] = 2.75

Step 4: Compare with previous methods

Left sum (n=4): 1.75

Right sum (n=4): 3.75

Midpoint sum (n=4): 2.625

Trapezoidal sum (n=4): 2.75

Actual value: 8/3 ≈ 2.667

Trapezoidal rule: 2.75
Actual integral: 8/3 ≈ 2.667
Final answer:

The trapezoidal rule approximation of ∫[0,2] x² dx with n = 4 subintervals is 2.75.

Applied rules:

• Trapezoidal rule: Tₙ = (Δx/2)[f(x₀) + 2Σf(xᵢ) + f(xₙ)]

• Relationship: Tₙ = (Lₙ + Rₙ)/2

• Accuracy: Often more accurate than basic Riemann sums

5 Increasing Subintervals
Exercise 5
Compare the accuracy of the midpoint Riemann sum for ∫[0,2] x² dx using n = 4 and n = 8 subintervals.
Definition:

Accuracy improvement: As the number of subintervals increases, the Riemann sum approximation typically becomes more accurate, approaching the exact value of the definite integral.

Step 1
Calculate for n=4
Step 2
Calculate for n=8
Step 3
Compare results
Step 1: Midpoint sum with n = 4 (calculated previously)

Δx = 0.5

Midpoints: 0.25, 0.75, 1.25, 1.75

Function values: 0.0625, 0.5625, 1.5625, 3.0625

M₄ = 0.5(5.25) = 2.625

Step 2: Midpoint sum with n = 8

Δx = (2-0)/8 = 0.25

Subintervals: [0,0.25], [0.25,0.5], [0.5,0.75], [0.75,1], [1,1.25], [1.25,1.5], [1.5,1.75], [1.75,2]

Midpoints: 0.125, 0.375, 0.625, 0.875, 1.125, 1.375, 1.625, 1.875

Function values: 0.015625, 0.140625, 0.390625, 0.765625, 1.265625, 1.890625, 2.640625, 3.515625

Sum = 10.625

M₈ = 0.25(10.625) = 2.65625

Step 3: Compare with actual value and analyze improvement

Actual value: ∫[0,2] x² dx = 8/3 ≈ 2.6667

Error with n=4: |2.6667 - 2.625| = 0.0417

Error with n=8: |2.6667 - 2.65625| = 0.0104

The error decreased by approximately a factor of 4 when n doubled, demonstrating the quadratic convergence of midpoint rule.

M₄ = 2.625 (error ≈ 0.0417)
M₈ = 2.65625 (error ≈ 0.0104)
Final answer:

With n=4, M₄ = 2.625; with n=8, M₈ = 2.65625. The approximation improves as n increases, with the error roughly quartered when n doubles.

Applied rules:

• Accuracy improvement: More subintervals → better approximation

• Convergence rate: Midpoint rule has O(h²) error (where h = Δx)

• Error analysis: Compare with known exact value

Comprehensive Summary: Riemann Sums Approximation

Key Definitions

Riemann Sum: An approximation of a definite integral by dividing the area under a curve into rectangles and summing their areas.

Partition: A division of the interval [a,b] into n subintervals [xᵢ₋₁, xᵢ].

Sample Point: The point xᵢ* in each subinterval where we evaluate f(x) to determine rectangle height.

Norm of Partition: The width of the largest subinterval, ||P|| = max Δxᵢ.

Refinement: A partition with smaller subintervals than another partition.

Core Formulas

General Riemann Sum: Sₙ = Σ f(xᵢ*)·Δx

Left Riemann Sum: Lₙ = Δx Σᵢ₌₀ⁿ⁻¹ f(xᵢ) where xᵢ = a + i·Δx

Right Riemann Sum: Rₙ = Δx Σᵢ₌₁ⁿ f(xᵢ) where xᵢ = a + i·Δx

Midpoint Riemann Sum: Mₙ = Δx Σᵢ₌₁ⁿ f(x̄ᵢ) where x̄ᵢ = a + (i-0.5)·Δx

Trapezoidal Rule: Tₙ = (Δx/2)[f(x₀) + 2Σf(xᵢ) + f(xₙ)]

Step-by-Step Method

1. Determine parameters: Calculate Δx = (b-a)/n and identify subintervals.

2. Choose sample points: Select left endpoints, right endpoints, or midpoints.

3. Evaluate function: Calculate f(xᵢ*) at each sample point.

4. Calculate areas: Multiply each function value by Δx.

5. Sum results: Add all rectangle/trapezoid areas.

6. Analyze accuracy: Compare with exact value if known.

Accuracy Comparison

Left Sum: Underestimates for increasing functions, overestimates for decreasing.

Right Sum: Overestimates for increasing functions, underestimates for decreasing.

Midpoint Sum: Generally most accurate among basic methods.

Trapezoidal: Average of left and right sums, often quite accurate.

Error Rates: Midpoint and trapezoidal have O(h²) error; left/right have O(h).

Tips & Common Pitfalls

Tips: Use midpoint for best basic accuracy; increase n for better approximations; consider function behavior to predict over/underestimation.

Pitfalls: Forgetting to multiply by Δx; confusing sample point locations; not accounting for subinterval boundaries.

Verification: Check that approximation makes sense given function behavior.

Convergence: Remember that as n → ∞, Riemann sums approach the definite integral.

Memory Aids

"LRM": Left (0 to n-1), Right (1 to n), Midpoint (1 to n with adjusted points).

"Width × Height": Each rectangle has area Δx × f(sample point).

"More n, Better Approx": Increasing subintervals improves accuracy.

"Midpoint Magic": Midpoint rule typically most accurate for basic methods.

Questions & Answers

Question: How do I decide whether to use left, right, or midpoint Riemann sums? Does one method always give better results than others?

Answer: The choice depends on the situation:

  • Midpoint rule: Generally most accurate for basic Riemann sums (O(h²) error vs O(h) for left/right)
  • Left/Right sums: Useful for understanding the concept and predicting over/underestimation
  • Function behavior: For increasing functions, left sums underestimate, right sums overestimate

For computational efficiency, midpoint and trapezoidal rules are preferred. For learning, all three help understand the concept. The accuracy also depends on the function's properties - for linear functions, all three give exact results.

Question: How do I know if my Riemann sum approximation is too high or too low compared to the actual integral value?

Answer: The relationship depends on both the function's behavior and the type of Riemann sum:

For increasing functions:

  • Left Riemann sum: Underestimates (too low)
  • Right Riemann sum: Overestimates (too high)

For decreasing functions:

  • Left Riemann sum: Overestimates (too high)
  • Right Riemann sum: Underestimates (too low)

For concave up functions, midpoint sums tend to underestimate and trapezoidal sums overestimate. For concave down, the opposite occurs.

Question: How many subintervals should I use for a good approximation? Is there a rule for choosing n?

Answer: There's no universal rule, but here are some guidelines:

  • Class exercises: n = 4-10 is typical for manual calculations
  • Computational applications: n can be in the hundreds or thousands
  • Error tolerance: For specific accuracy requirements, use error bound formulas

As a practical approach, start with a small n and double it until the results stabilize. The error typically decreases by a factor related to the method: for midpoint rule, doubling n roughly quarters the error (O(h²) convergence).