# Trapezoidal Rule Formula

In mathematics, and more specifically in numerical analysis, the trapezoidal rule, also known as the trapezoid rule or trapezium rule, is a technique for approximating the definite integral.

The trapezoidal rule works by approximating the region under the graph of the function f(x) as a trapezoid and calculating its area.

The trapezoidal rule is to find the exact value of a definite integral using a numerical method. This rule is mainly based on the Newton-Cotes formula which states that one can find the exact value of the integral as an nth order polynomial.

Assume that f(x) be a continuous function on the given interval [a, b]. Now divide the intervals [a, b] into n equal subintervals with each of width,

Then the Trapezoidal Rule formula for area approximating the definite integral

$$\begin{array}{l}\int_{a}^{b}f(x)dx\end{array}$$
is given by:

$$\begin{array}{l}\int_{a}^{b}f(x)dx\approx T_{n}=\frac{\bigtriangleup x}{2}[f(x_{0})+ 2f(x_{1})+2f(x_{2})+….2f(x_{n-1})+f(x_{n})]\end{array}$$

Where, xi = a+iΔx

Δx = (b-a)/n, Such that x0 < x1< x2< x3<…..<xn = b,

When n →∞, R.H.S of the expression approaches the definite integral

$$\begin{array}{l}\int_{a}^{b}f(x)dx\end{array}$$

### Solved Examples of Trapezoidal Rule

Example 1:

Use the trapezoidal rule with n = 8 to estimate:

$$\begin{array}{l}\int_{1}^{5}\sqrt{1+x^{2}}dx\end{array}$$

Solution:

Given, function:

$$\begin{array}{l}\int_{1}^{5}\sqrt{1+x^{2}}dx\end{array}$$

we know that, a=1, b=5 and n=8.

Now, substitute the values in the formula, we get

Δx = (b-a)/n

Δx = (5-1)/8

Δx = 1/2

Now, divide the interval into 8 subintervals with the length of Δx = 1/2, with the following endpoints,

a=1, 3/2, 2, 5/2, 3, 7/2, 4, 9/2, 5 = b

Now, compute the functions with these endpoints,

f(x0) = f(1) = √2 = 1.4142135623731

2f(x1) = 2f(3/2) = √13 = 3.60555127546399

2f(x2) = 2f(2) = 2√5 = 4.47213595499958

2f(x3) = 2f(5/2) = √29 = 5.3851648071345

2f(x4) = 2f(3) = 2√10 = 6.32455532033676

2f(x5) = 2f(7/2) = √53 = 7.28010988928052

2f(x6) = 2f(4) = 2√17 = 8.24621125123532

2f(x7) = 2f(9/2) = √85 = 9.21954445729289

2f(x8) = 2f(5) = √26 = 5.09901951359278

Now, substitute the values in the trapezoidal rule formula,

$$\begin{array}{l}\int_{a}^{b}f(x)dx\approx T_{n}=\frac{\bigtriangleup x}{2}[f(x_{0})+ 2f(x_{1})+2f(x_{2})+….2f(x_{n-1})+f(x_{n})]\end{array}$$

= 1/4 (1.4142135623731 + 3.60555127546399 + 4.47213595499958 + 5.3851648071345 + 6.32455532033676 +7.28010988928052 + 8.24621125123532 +  9.21954445729289 + 5.09901951359278)

= 1/4( 51.0465060317)

= 12.7616265079

Which can be approximately written as 12.76

Hence,

$$\begin{array}{l}\int_{1}^{5}\sqrt{1+x^{2}}dx\end{array}$$
≈ 12.76