# Consider the definite integral. x ln(1 + x) dx a) Use the Trapezoidal rule to estimate the value...

## Question:

Consider the definite integral.

{eq}\int_{1}^{\frac{3}{2}} {/eq} x ln(1 + x) dx

a) Use the Trapezoidal rule to estimate the value of I with a maximal absolute error of 0.001

b) Use the Simpson rule to estimate the value of I with a maximal absolute error of 0.0000001

c) Use Gaussian Quadrature of order 4 to estimate the value of I

d) Use the Fundamental Theorem of Calculus to find the value of I, round your answer to 7 decimal places.

## Numerical Integration:

The integral

{eq}I=\int^b_a f(x)dx {/eq}

If {eq}f {/eq} is Riemann integrable on {eq}[a, b] {/eq} then

{eq}\int^b_a f(x)dx = F(b)-F(a) {/eq}

where{eq}F {/eq} is an antiderivative of {eq}f {/eq}, fundamental theorem of calculus.

In most cases it is not possible to find {eq}F {/eq}. This means we need to find a way to approximate {eq}I {/eq}.

There are several techniques to approximate {eq}I {/eq}. Let's take a closer look at three of them.

To obtain the area under {eq}f {/eq} on {eq}[a, b] {/eq}, we can construct Riemann sums. Considering a partition of the interval, {eq}x_0 = a <x_1 <... <x_n = b {/eq}, the area of the rectangle {eq}A_i = f (x ^ *) (x_i-x_ {i-1}) = \text{height} * \text{base}, {/eq} that is formed in the interval {eq}[x_ {i-1}, x_i] {/eq} (Figure 1), adding the area of all the rectangles and if {eq}n {/eq} tends to infinity, we arrive at the integral by definition.

{eq}\begin{eqnarray} \int_a^b f(x)dx &=& \lim_{n\rightarrow\infty} \sum_{i=1}^n A_i\\ &=& \lim_{n\rightarrow\infty} \sum_{i=1}^n f(x^*)(x_i-x_{i-1}) \end{eqnarray} {/eq}

If the limit is not considered ({eq}\lim_{n \rightarrow \infty} {/eq}), we have an approximation of the value of the area.

Trapezoidal scheme

When replacing the rectangles with trapezoids, the approach should improve in an "intuitive" way.

Let an equally spaced partition of {eq}[a, b] {/eq}, {eq}x_0 = a <x_1 <... <x_n = b {/eq}, the area {eq}A_i = \frac{h}{2}\left(f (x_{i-1}) + f (x_{i})\right) {/eq} (Figure 2), with {eq}h = x_i-x_{i-1} = \frac{b-a}{n} {/eq}; then the approximation is

{eq}\begin{eqnarray} \int^b_af(x)dx&\approx& A_0+A_1+...+A_n\\ &=&\frac{h}{2}[f(x_0)+f(x_1)]+\frac{h}{2}[f(x_1)+f(x_2)]+...+\frac{h}{2}[f(x_{n-1})+f(x_n)] \end{eqnarray} {/eq}

Trapezoidal rule

Suppose that {eq}f'' {/eq} exists on the interval {eq}[a, b] {/eq}. Then,

{eq}\int^b_af(x)dx=\frac{h}{2}[ f(x_0)+2f(x_1)+2f(x_2)+...+2f(x_{n-1}+f(x_n)]+E_n {/eq}

where the error {eq}E_n {/eq} is

{eq}E_n= -\frac{(b-a)^3}{12n^2} f''(c) {/eq}

and {eq}c {/eq} is such that {eq}c\in[a, b] {/eq}.

Simpson's scheme

Similarly, Simpson's rule is obtained by improving the calculation of the area of the rectangle {eq}A_i {/eq} considering quadratic interpolation to approximate {eq}f {/eq} on {eq}[x_i, x_{i-1} ] {/eq}, Figure 3.

In this case, {eq}A_i=\frac{h}{3}[f(x_{i-1})+4f(x_i)+f(x_{i+x})] {/eq} and the number of subintervals is even ({eq}n {/eq} even).

When adding {eq}A_1+A_2+...+A_{\frac{n}{2}} {/eq}, we have Simpson's integration rule.

Simpson's integration rule ({eq}n {/eq} even)

Suppose that {eq}f^{(IV)} {/eq} exists on the interval {eq}[a, b] {/eq}. Then,

{eq}\int^b_a f(x)dx = \frac{h}{3}[f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+...+4f(x_{n-1})+f(x_n)]+E_n {/eq}

the coefficients pattern is {eq}1, 4, 2, 4, 2,...,2, 4, 1. {/eq}

and the error {eq}E_n {/eq} is

{eq}E_n =-\frac{(b-a)^5}{180n^4}f^{(IV)}(c) {/eq}

and {eq}c {/eq} is such that {eq}c\in[a, b] {/eq}.

Considering an idea similar to the trapezoidal rule ({eq}n=1 {/eq}) it is possible to find approximations to {eq}I {/eq} with few terms (two terms) Figure 4.

In this example, it can be assumed that the approximation will be exact for polynomials of degree 3. Then for two points (Figure 4), we have

{eq}\begin{eqnarray} c_0f(x_0)+c_1f(x_1)=\int_{-1}^1 1dx=2\\ c_0f(x_0)+c_1f(x_1)=\int_{-1}^1 xdx=0\\ c_0f(x_0)+c_1f(x_1)=\int_{-1}^1 x^2dx=2\\ c_0f(x_0)+c_1f(x_1)=\int_{-1}^1 x^3dx=0 \end{eqnarray} {/eq}

the solution is {eq}c_0=c_1=1 {/eq}

{eq}x_0=-\frac{1}{\sqrt{3}}, x_1=\frac{1}{\sqrt{3}}, {/eq}

then {eq}I=\int_{-1}^1 f(x)dx\approx f(-\frac{1}{\sqrt{3}})+ f(\frac{1}{\sqrt{3}}) {/eq}

In general, the Gauss quadrature formula is written as follows

{eq}\int^{1}_{-1} f(x)dx\approx\sum_{i=1}^n w_if(x_i) {/eq}

where {eq}w_i {/eq} are the weights and {eq}x_i {/eq} are the nodes.

The {eq}x_i {/eq} points are the roots of Legendre polynomials {eq}P_n(x) {/eq} and the weights {eq}w_i {/eq} are {eq}w_i =\frac{2}{(1-x_i^2)[P'_n(x_i)]^2} {/eq}

The Gauss quadrature is defined over the interval {eq}[-1,1] {/eq} but is easy to move to an interval of the form {eq}[a, b] {/eq} with the change

{eq}\begin{eqnarray} x&=& \frac{1}{2}\left( (b+a)+(b-a)\xi\right)\\ dx&=&\frac{b-a}{2}d\xi \end{eqnarray} {/eq}

Let

{eq}I= \int_{1}^{\frac{3}{2}} x \ln(1 + x) dx {/eq}

We need to calculate the derivatives

{eq}\begin{eqnarray} f(x)&=&x \ln(1+x)\\ f'(x)&=& \ln(x+1)+\frac{1}{1+x}\\ f''(x)&=& \frac{1}{1+x}+\frac{1+x-x}{(1+x)^2}= \frac{2+x}{(1+x)^2}\\ f'''(x)&=&-\frac{1}{(1+x)^2}\frac{2+x}{1+x}+\frac{1}{1+x}\left(\frac{x+1-(2+x)}{(1+x)^2}\right)=-\frac{3+x}{(1+x)^3}\\ f^{(IV)}(x)&=&-\frac{(1+x)^3-3(3+x)(1+x)^2}{(1+x)^6}=2\frac{x+4}{(1+x)^4} \end{eqnarray} {/eq}

We need to find an upper bound to {eq}|f''| {/eq} and {eq}|f^{(IV)}| {/eq} on {eq}\left[1, \frac{3}{2} \right] {/eq}

• For {eq}|f''| {/eq}

{eq}f''(x) {/eq} decreasing on {eq}\left[1,\frac{3}{2} \right] {/eq}, since {eq}f'''(x) {/eq} is negative on {eq}\left[1,\frac{3}{2}\right] {/eq}

• For {eq}|f^{(IV)}| {/eq}

Similarly we have

{eq}\begin{eqnarray} |f^{(IV)}(x)|&\leq& 2\frac{4+1}{(1+1)^4} = \frac{5}{8}, \quad x\in\left[1, \frac{3}{2} \right] \end{eqnarray} {/eq}

a) Use the Trapezoidal rule to estimate the value of I with a maximal absolute error of 0.001

In this case, {eq}|E_n|<0.001=\frac{1}{1000} {/eq} and the error is

{eq}E_n= -\frac{(b-a)^3}{12n^2} f''(c) {/eq}

Replacing {eq}a=1, b= \frac{3}{2} {/eq} and using the bound for {eq}|f''(x)|\leq\frac{3}{4} \quad x\in \left[1, \frac{3}{2}\right] {/eq}

{eq}\begin{eqnarray} |E_n|&=& \frac{(\frac{3}{2}-1)^3}{12n^2}f''(c)\\ &\leq& \frac{(\frac{1}{2})^3}{12n^2}\frac{3}{4} =\frac{1}{128n^2} \end{eqnarray} {/eq}

Then

{eq}\begin{eqnarray} \frac{1}{128n^2}&<&\frac{1}{1000} \Rightarrow 1000<128 n^2 \Rightarrow n\geq3\\ \end{eqnarray} {/eq}

The approximation of {eq}I {/eq} (n=3) is

{eq}\begin{eqnarray} I= \int_{1}^{\frac{3}{2}} x \ln(1 + x) dx &\approx& \frac{h}{2}\left[f(x_0)+2f(x_1)+2f(x_2)+f(x_3) \right]\\ &=& \frac{\frac{3}{2}-1}{6}\left[ f(1)+2f\left(\frac{7}{6}\right)+2f\left(\frac{8}{6}\right)+f\left(\frac{3}{2}\right)\right]\\ &=&\frac{1}{12}\left( \ln(2)+2\left(\frac{7}{6}\ln\left(\frac{13}{6}\right)\right) +2\left(\frac{8}{6} \ln\left(\frac{14}{6}\right)\right)+\frac{3}{2}\ln\left(\frac{5}{2}\right)\right)\\ &\approx&0.51 \end{eqnarray} {/eq}

b) Use Simpson's rule to estimate the value of I with a maximal absolute error of 0.0000001

Similarly {eq}|E_n|<0.0000001=\frac{1}{10000000} {/eq}

{eq}\begin{eqnarray} |E_n|&=& \frac{(\frac{1}{2})^5}{180n^4}f^{(IV)}(c)\\ &=& \frac{1}{5760 n^4}f^{(IV)}(c)\\ &\leq&\frac{1}{5760 n^4}\frac{5}{8}\\ \end{eqnarray} {/eq}

Then

{eq}\frac{1}{5760 n^4}\frac{5}{8}=\frac{1}{9216 n^4} \leq \frac{1}{10000000} \Rightarrow 10000000<9216 n^4 \Rightarrow n\geq 6 {/eq}

The approximation of {eq}I {/eq} (n=6) is

{eq}\begin{eqnarray} I= \int_{1}^{\frac{3}{2}} x \ln(1 + x) dx &\approx&\frac{h}{3}[f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+2f(x_4)+4f(x_5)+f(x_6)]\\ &=&\frac{1}{36}\left(f(1)+4f\left(\frac{13}{12}\right)+2f\left(\frac{7}{6}\right)+4f\left(\frac{5}{4}\right)+2f\left(\frac{4}{3}\right)+4f\left(\frac{17}{12}\right)+f\left(\frac{3}{2}\right) \right)\\ &\approx&0.510182 \end{eqnarray} {/eq}

c) Use Gaussian Quadrature of order 4 to estimate the value of {eq}I {/eq} (round your coefficients, nodes and final answer to seven decimal places).

With the change

Now,

{eq}\begin{eqnarray} I=\int_1^{\frac{3}{2}}x\ln(1+x)dx=\frac{1}{4}\int_{-1}^1f\left( \frac{1}{4}(5+\xi )\right)d\xi=\frac{1}{16}\int_{-1}^1 \left( 5+\xi \right) \ln\left( \frac{9}{4}+\frac{\xi}{4} \right)d\xi \end{eqnarray} {/eq}

with

{eq}F(\xi)= \left( 5+\xi \right) \ln\left( \frac{9}{4}+\frac{\xi}{4} \right) {/eq}

Using the Gaussian quadrature, we have

{eq}\begin{eqnarray} I=\int^{\frac{3}{2}}_1 f(x)dx &\approx& \frac{1}{16}\sum_{i=1}^4 w_i F(\xi_i)\\ &=&w_1F(\xi_1)+w_2F(\xi_2)+w_3F(\xi_3)+w_4F(\xi_4) \end{eqnarray} {/eq}

where

{eq}\begin{eqnarray} \xi_1=-0.8611363116, & &w_1=0.3478548451\\ \xi_2=-0.3399810436, & & w_2=0.6521451549\\ \xi_3=0.3399810436, & & w_3=0.6521451549\\ \xi_4=0.8611363116, & & w_4=0.3478548451\\ \end{eqnarray} {/eq}

Implies that

{eq}I=\int_1^{\frac{3}{2}}x\ln(1+x)dx\approx0.5101817 {/eq}

d) Use the Fundamental Theorem of Calculus to find the value of I, round your answer to 7 decimal places.

{eq}I=\int_1^{\frac{3}{2}}x\ln(1+x)dx {/eq}

Through integration by parts

{eq}\begin{eqnarray} \int_1^{\frac{3}{2}}x\ln(1+x)dx&=&\left.\begin{matrix} \frac{x^2\ln(1+x)}{2} \end{matrix}\right|_1^\frac{3}{2}-\frac{1}{2}\int_1^{\frac{3}{2}}\frac{x^2}{1+x}dx\\ &=&\frac{9}{8}\ln\left(\frac{5}{2}\right)-(\frac{1}{2}\ln(2)-\frac{1}{2}\int_1^{\frac{3}{2}} x-1 +\frac{1}{1+x}dx\\ &=&\frac{9}{8}\ln\left(\frac{5}{2}\right)-\frac{1}{2}\ln(2)-\frac{1}{2}\left.\left( \frac{x^2}{2}-x+\ln(1+x)\right)\right|_1^{\frac{3}{2}}\\ &=&\frac{9}{8}\ln\left(\frac{5}{2}\right)-\frac{1}{2}\ln(2)-\frac{1}{2}\left( \frac{1}{8}+\ln\left(\frac{5}{2}\right)-\ln(2)\right)\\ &=&\frac{5}{8}\ln\left(\frac{5}{2}\right)-\frac{1}{16}\\ &\approx& 0.5101817 \end{eqnarray} {/eq}

In summary

Trapezoidal rule (n=3)

{eq}\begin{eqnarray} I=\int_1^{\frac{3}{2}}x\ln(1+x)dx\approx 0.51 \end{eqnarray} {/eq}

Simpson rule (n=6)

{eq}\begin{eqnarray} I=\int_1^{\frac{3}{2}}x\ln(1+x)dx\approx 0.510182 \end{eqnarray} {/eq}

{eq}\begin{eqnarray} I=\int_1^{\frac{3}{2}}x\ln(1+x)dx\approx 0.5101817 \end{eqnarray} {/eq}

Fundamental Theorem of Calculus

{eq}\begin{eqnarray} I=\int_1^{\frac{3}{2}}x\ln(1+x)dx\approx 0.5101817 \end{eqnarray} {/eq}

Integration Problems in Calculus: Solutions & Examples

from AP Calculus AB & BC: Homework Help Resource

Chapter 13 / Lesson 13
114K