Back to Top

Trapezoidal Rule Examples

Trapezoidal rule Calculator 

Find and learn the trapezoidal rule with this user-friendly calculator. Input the required data and get the complete process of finding the area under the curve with the trapezium rule calculator. 

How to use this tool?

The guideline to use this calculator is given below.

  1. Enter the function.
  2. Identify the upper and lower limits and enter them in the mentioned boxes. 
  3. Determine the interval.
  4. Click calculate.

What is the trapezoidal rule?

The trapezoidal rule, also known as the trapezium rule in certain regions, is a fundamental concept in numerical integration, which is the process of calculating the numerical value of a definite integral. This rule provides a method to estimate the area under a curve by approximating it with a series of trapezoids, hence the name "trapezoidal rule."


The mathematical formula for the trapezoidal rule is derived from the geometric formula for the area of a trapezoid. For a function f(x) continuous over the interval [a, b], the trapezoidal rule with n equal subdivisions is given as:

∫(a to b) f(x) dx ≈ (Δx / 2) * [f(a) + 2f(a+Δx) + 2f(a+2Δx) + ... + 2f(a+(n-1)Δx) + f(b)]

Here, Δx denotes the width of each trapezoid, calculated as (b - a) / n, where [a, b] is the interval over which the integral is being computed, and n is the number of trapezoids used.


The calculation using the trapezoidal rule involves the following steps:

  1. Interval Determination: Define the interval [a, b] over which you intend to estimate the integral.
  2. Trapezoid Number Selection: Decide on the number of trapezoids (n) you wish to use for the approximation. More trapezoids generally lead to a more accurate approximation but at the cost of increased computational time.
  3. Width Calculation: Calculate the width (Δx) of each trapezoid by dividing the total interval length by the number of trapezoids: Δx = (b - a) / n.
  4. Function Evaluation: Evaluate the function f(x) at the endpoints of each trapezoid. The function should be evaluated once at each endpoint except for the first and the last point, where the function is only evaluated once.
  5. Summation: Multiply the sum of the function evaluations by Δx/2 to get the final approximation of the definite integral.


Let's illustrate the use of the trapezoidal rule with an example. Suppose we want to estimate the integral of f(x) = x^2 over the interval [0, 2] using 4 trapezoids.

  • The interval is [0, 2] 
  • The number of trapezoids is 4.
  • The width of each trapezoid is Δx = (2 - 0) / 4 = 0.5.

We evaluate f(x) at x = 0, 0.5, 1, 1.5, and 2, resulting in the values 0, 0.25, 1, 2.25, and 4.

Applying the trapezoidal rule formula gives: (0.5 / 2) * [0 + 2(0.25) + 2(1) + 2(2.25) + 4] = 1.875

So, the approximation of ∫(0 to 2) x^2 dx using the trapezoidal rule with 4 trapezoids is 1.875.

let's consider a more detailed example using the trapezoidal rule. We'll estimate the integral of the function f(x) = sin(x) over the interval [0, π] using 6 trapezoids. This is a particularly interesting example because we know the exact answer should be 2, so we can also evaluate the accuracy of the approximation.

  • Interval and Trapezoid Number: The interval is [0, π], and we're using 6 trapezoids.
  • Width Calculation: The width of each trapezoid is Δx = (π - 0) / 6 ≈ 0.524.
  • Function Evaluation: Evaluate f(x) = sin(x) at x = 0, 0.524, 1.047, 1.571, 2.094, 2.618, and π. Using a calculator, we get the following values:

f(0) = sin(0) = 0

f(0.524) = sin(0.524) ≈ 0.500

f(1.047) = sin(1.047) ≈ 0.866

f(1.571) = sin(1.571) ≈ 1

f(2.094) = sin(2.094) ≈ 0.866

f(2.618) = sin(2.618) ≈ 0.500

f(π) = sin(π) = 0

  • Summation: Apply the trapezoidal rule formula:

(0.524 / 2) * [0 + 2(0.500) + 2(0.866) + 2(1) + 2(0.866) + 2(0.500) + 0] = 2.002

So, the approximation of ∫(0 to π) sin(x) dx using the trapezoidal rule with 6 trapezoids is approximately 2.002.

This example demonstrates that the trapezoidal rule can yield fairly accurate results, especially for relatively smooth functions. In this case, with just 6 trapezoids, we got a very close result to the exact answer of 2. However, the accuracy of the trapezoidal rule will depend on the specific function and interval you're working with, as well as the number of trapezoids you use.

Uses and Applications

The trapezoidal rule finds extensive applications across various fields including physics, engineering, and computer science, among others.

  • In physics, it is often used to compute the work done by a variable force or to estimate total energy or power consumption over time when the force or power as a function of time is known.
  • In engineering fields, especially civil and environmental engineering, the trapezoidal rule is commonly used in the design and analysis of structures and environmental systems. For instance, it is used in the calculation of moments and forces in structural members, or in the estimation of total rainfall or pollutant load in a watershed given a time series of measurements.
  • In computer science, the trapezoidal rule is used in numerical methods and algorithms. For example, it is used in the field of computer graphics for the rasterization of polygons. In digital signal processing, it is used for numerical integration, solving ordinary differential equations, and in the implementation of filters.


While the trapezoidal rule is straightforward and easy to implement, it may not be as accurate for functions that exhibit high curvature or rapid changes. Other more accurate numerical integration methods, such as Simpson's rule or Gaussian quadrature, might be more suitable for these cases. However, the trapezoidal rule often serves as a good starting point and a useful tool for quick approximations.

Use android or iOS app of our limit calculator on your mobile

Download Download
Limit Calculator