Numerical Integration Techniques
Numerical Integration Techniques
Objective: By the end of this lesson, students will learn how to use techniques like the
Midpoint Rule, Trapezoidal Rule, and Simpson’s Rule to approximate the area under
curves.
NUMERICAL INTEGRATION
The Midpoint Rule, also known as the midpoint Riemann sum or midpoint method,
is a numerical technique for estimating the integral of a function, which represents the
area under a curve. This method involves dividing the area into rectangles of equal
width and using the function's value at the midpoint of each subinterval to determine
the height of each rectangle. The sum of the areas of these rectangles provides an
approximation of the total integral.
𝑛
𝐴𝑟𝑒𝑎 = ∑ 𝑓(𝑥𝑖 ) △ 𝑥
𝑖=1
𝑏
𝐴𝑟𝑒𝑎 = ∫ 𝑓(𝑥)𝑑𝑥
𝑎
The Midpoint Rule for approximating a definite integral is expressed as:
𝒃 𝒏
∫ 𝒇(𝒙)𝒅𝒙 ≈ ∑ 𝒇(𝒙𝒊 ) △ 𝒙
𝒂 𝒊=𝟏
Where:
• [𝒂, 𝒃] is the interval over which the integral is evaluated,
• 𝒏 is the number of subintervals,
𝒃−𝒂
• △ 𝒙 is the width of each subinterval, which calculated as △ 𝒙 = ,
𝒏
𝟏
• 𝒙𝒊 is the midpoint, which is calculated as 𝒙𝒊 = 𝒂 + (𝒊 − 𝟐) △ 𝒙
EXAMPLE
Solution:
Interval: [1,3]
Number of Subintervals: n = 4
𝑏−𝑎
△𝑥 =
𝑛
3−1
△𝒙= = 𝟎. 𝟓
4
Getting the midpoint of each subinterval:
1
𝑥𝑖 = 𝑎 + (𝑖 − ) △ 𝑥
2
1
𝒙𝟏 = 1 + (1 − ) 0.5 = 𝟏. 𝟐𝟓
2
1
𝒙𝟐 = 1 + (2 − ) 0.5 = 𝟏. 𝟕𝟓
2
1
𝒙𝟑 = 1 + (3 − ) 0.5 𝒙𝟑 = 𝟐. 𝟐𝟓
2
1
𝒙𝟒 = 1 + (4 − ) 0.5 = 𝟐. 𝟕𝟓
2
Evaluate f(x) at each midpoint:
𝑓(𝑥) = 𝑥 2 + 7
The result, 22.625, is an approximate value of the integral, while the exact value is
22.67.
2. TRAPEZOIDAL RULE
The Trapezoidal Rule is a method for estimating the area under a curve by breaking
it into smaller trapezoid-shaped sections rather than rectangles. It works by treating
the space under the curve as a series of trapezoids and adding up their areas.
Essentially, it takes the average of the values at the left and right ends of each interval
to make the calculation.
THE ACCURACY OF TRAPEZOIDAL RULE OVER OTHER METHODS
While the Trapezoidal Rule is a useful tool for approximation, it’s not as accurate
as Simpson’s Rule, especially when dealing with smooth functions. This is because
Simpson’s Rule uses a curved (quadratic) approach to approximate the area, while
the Trapezoidal Rule uses straight lines (linear approximation). Both methods aim to
estimate the area, but Simpson’s Rule tends to be more precise.
FORMULA
We need to consider the formula of a trapezoid for this rule. As such, the area of a
trapezoid is given by:
𝒉
𝑨𝒓𝒆𝒂 = (𝒑 + 𝒒)
𝟐
𝒃−𝒂
Where 𝒉 is the new base and 𝒉 = 𝜟𝒙. Where: 𝜟𝒙 = 𝒏
1 1 1
𝐴𝑟𝑒𝑎 = (𝑦0 + 𝑦1 ) △ 𝑥 + (𝑦1 + 𝑦2 ) △ 𝑥 + (𝑦2 + 𝑦3 ) △ 𝑥 + …
2 2 2
Where the formula is just a summation of all the areas of n no. of trapezoids.
𝒚𝟎 𝒚𝒏
𝑨𝒓𝒆𝒂 ≈△ 𝒙 ( + 𝒚𝟏 + 𝒚𝟐 + 𝒚𝟑 + . … . + )
𝟐 𝟐
To find the △ 𝑥 for the area from x = a to x = b, we use:
𝑏−𝑎
△𝑥 =
𝑛
And we also need
𝑦0 = 𝑓(𝑎)
𝑦1 = 𝑓(𝑎 +△ 𝑥)
𝑦2 = 𝑓(𝑎 + 2 △ 𝑥)
𝑦𝑛 = 𝑓(𝑏)
EXAMPLE 1
𝟏
Using n = 3, approximate the integral ∫𝟎 √(𝒙𝟐 + 𝟏)
𝑏−𝑎 1−0 1
𝜟𝒙 = = = = 𝟎. 𝟑𝟑𝟑𝟑
𝑛 3 3
0.3333
𝑨𝒓𝒆𝒂 = (1 + 2(1.054082013 + 1.201868915) + 1.414142853) = 𝟏. 𝟏𝟓𝟒𝟐
2
EXAMPLE 2
𝟏
Using n= 5, approximate the integral ∫𝟎 √(𝒙𝟐 + 𝟏)
𝑏−𝑎 1−0
𝜟𝒙 = = = 𝟎. 𝟐
𝑛 5
0.2
𝑨𝒓𝒆𝒂 = (1 + 2(1.019803903 + 1.077032961 + 1.166190379 + 1.280624847)
2
+ 1.414213562) = 𝟏. 𝟏𝟓𝟎𝟏𝟓𝟏𝟕𝟕𝟒
Based on the 2 examples above, the more subdivisions (n) you have, the smaller
the error, therefore, the approximation is more accurate.
3. SIMPSON'S RULE
Simpson's Rule is a numerical method to estimate the area under a curve by splitting
it into sections and using curved lines (parabolas) to match the shape of the curve.
This method provides a more accurate estimate of an integral compared to using
rectangles or trapezoids.
Simpson's 1/3 Rule is a type of Simpson's Rule for approximating the area under a
curve by dividing it into an even number of intervals and using parabolas to fit groups
of three points. It calculates the integral more accurately than simpler methods like the
Trapezoidal Rule.
The Simpson's 1/3 Rule approximation formula is:
𝒃
𝟏
∫ 𝒇(𝒙)𝒅𝒙 ≈ △ 𝒙 [𝒇(𝒙𝟎 ) + 𝟒 ∑ 𝒇(𝒙𝒊 ) + 𝟐 ∑ 𝒇(𝒙𝒊 ) + 𝒇(𝒙𝒏 )]
𝒂 𝟑
𝒊=𝒐𝒅𝒅 𝒊=𝒆𝒗𝒆𝒏
Where:
• [𝒂, 𝒃] is the interval over which the integral is evaluated,
• 𝒏 is the number of subintervals (must be even for the formula to work
properly),
𝒃−𝒂
• △ 𝒙 is the width of each subinterval, which calculated as △ 𝒙 = ,
𝒏
• 𝒙𝒊 are the partition points, which is calculated as 𝒙𝒊 = 𝒂 + 𝒊 △ 𝒙
EXAMPLE
Use the Simpson’s Rule with n=6 to approximate the integral:
𝟑
𝟏
∫ 𝒅𝒙
𝟎 𝒙𝟐 +𝟒
Solution:
Interval: [0,3]
Number of Subintervals: n = 6
𝑏−𝑎
△𝑥 =
𝑛
3−0
△𝒙= = 𝟎. 𝟓
6
𝑥𝑖 = 𝑎 + 𝑖 △ 𝑥
𝒙𝟎 = 0 + 0(0.5) = 𝟎
𝒙𝟏 = 0 + 1(0.5) = 𝟎. 𝟓
𝒙𝟐 = 0 + 2(0.5) = 𝟏
𝒙𝟑 = 0 + 3(0.5) = 𝟏. 𝟓
𝒙𝟒 = 0 + 4(0.5) = 𝟐
𝒙𝟓 = 0 + 5(0.5) = 𝟐. 𝟓
𝒙𝟔 = 0 + 6(0.5) = 𝟑
1
𝒇(𝒙𝒐) = = 𝟎. 𝟐𝟓
02 + 4
1
𝒇(𝒙𝟏) = = 𝟎. 𝟐𝟑𝟓𝟑
0.52 +4
1
𝒇(𝒙𝟐) = = 𝟎. 𝟐
12 + 4
1
𝒇(𝒙𝟑) = = 𝟎. 𝟏𝟔
1.52 +4
1
𝒇(𝒙𝟒) = = 𝟎. 𝟏𝟐𝟓
22 +4
1
𝒇(𝒙𝟓) = = 𝟎. 𝟎𝟗𝟕𝟔
2.52 + 4
1
𝒇(𝒙𝟔) = = 𝟎. 𝟎𝟕𝟔𝟗
32 +4
3
1 1
∫ 𝑑𝑥 ≈ (0.5)[0.25 + 4(0.2353 + 0.16 + 0.0976) + 2(0.2 + 0.125) + 0.0769]
0 𝑥2 + 4 3
𝟑
𝟏
∫ 𝒅𝒙 ≈ 𝟎. 𝟒𝟗𝟏𝟒
𝟎 𝒙𝟐 +𝟒
As stated earlier, the Simpson’s rule in general, is more accurate than both the
trapezoidal and bisection methods. Additionally, compared to the Simpson’s 1/3 rule,
the Simpson’s 3/8 rule allows one more degree of freedom as it is a cubic function
while the Simpson’s 1/3 rule is a quadratic function.
The formula for the Simpson’s 3/8 rule is derived from the Lagrange interpolation.
𝑏−𝑎
Like usual, h=𝛥𝑥. Where: 𝛥𝑥 = 𝑛
𝑏
3
∫ 𝑓(𝑥)𝑑𝑥 = △ 𝑥 [(𝑦0 + 𝑦𝑛 ) + 3(𝑦1 + 𝑦2 + 𝑦4 + 𝑦5 + ⋯ 𝑦𝑛−1 )
𝑎 8
+ 2(𝑦3 + 𝑦6 + 𝑦9 + 𝑦𝑛−3 )]
EXAMPLE
𝑏 − 𝑎 5.2 − 4
𝛥𝑥 = = = 0.2
𝑛 6
𝑏
3
∫ 𝑓(𝑥)𝑑𝑥 = △ 𝑥 [(𝑦0 + 𝑦𝑛 ) + 3(𝑦1 + 𝑦2 + 𝑦4 + 𝑦5 + ⋯ 𝑦𝑛−1 )
𝑎 8
+ 2(𝑦3 + 𝑦6 + 𝑦9 + 𝑦𝑛−3 )]
3 (0.2)
= [𝑓(4) + 𝑓(5.2) + 2(𝑓(4.6)) + 3(𝑓(4.2) + 𝑓(4.4) + 𝑓(4.8) + 𝑓(5.0)]
8
0.6
= [1.3863 + 1.6487 + 2(1.5261) + 3(1.4351 + 1.4816 + 1.5686 + 1.6094)]
8
0.6
= [1.3863 + 1.6487 + 3.0522 + 18.2841]
8
0.6
= (24.3713)
8
= 𝟏. 𝟖𝟐𝟕𝟖𝟒𝟕𝟓 , is the required solution.
REFERENCES:
trapezoidal-rule.php
Simpson’s rule.
https://math.libretexts.org/Courses/Mount_Royal_University/MATH_2200%3A
_Calculus_for_Scientists_II/2%3A_Techniques_of_Integration/2.5%3A_Nume
rical_Integration_-_Midpoint%2C_Trapezoid%2C_Simpson's_rule
ScienceDirect. (n.d.). Simpson's rule.
https://www.sciencedirect.com/topics/engineering/simpsons-rule
https://www.sfu.ca/math-
coursenotes/Math%20158%20Course%20Notes/sec_Numerical_Integration.h
tml
examples. https://www.cuemath.com/simpsons-rule-formula/
Testbook. (2023, May 4). Simpson’s Rule: Definition & Formula for 1/3 & 1/8
examples. https://testbook.com/maths/simpsons-rule
rule