# sammy's question at Yahoo! Answers regarding approximate integration

#### MarkFL

Staff member
Here is the question:

Trapezoidal rule and Simpson's rule question help :'(?

Note: any letter beside "T" and "S" is a subscript.
Three estimates of int[f(x)*dx] are as follows: Tn is obtained by using trapezoidal rule with (n+1) ordinates while T2n is obtained with (2n+1) ordinates, and Sn is obtained by using Simpson's rule with (2n+1) ordinates.

(a) Show that 4T2n - Tn =3Sn
(b) Evaluate T1, T2, S1 and S2 for the integral int{sqrt[2-(sin x)^2]*dx} (between 0 and pi/4)
I have posted a link there to this topic so the OP can see my work.

#### MarkFL

Staff member
Hello again sammy,

We will need the following:

Trapezoidal Rule:

$$\displaystyle T_n=\frac{b-a}{2n}\left(f\left(x_0 \right)+2f\left(x_1 \right)+\cdots+2f\left(x_{n-1} \right)+f\left(x_n \right) \right)$$

Simpson's Rule:

$$\displaystyle S_n=\frac{b-a}{3n}\left(f\left(x_0 \right)+4f\left(x_1 \right)+2f\left(x_2 \right)+\cdots+2f\left(x_{n-2} \right)+4f\left(x_{n-1} \right)+f\left(x_n \right) \right)$$

(a) Using these definitions, we may write:

$$\displaystyle 4T_{2n}=\frac{b-a}{2n}\left(2f\left(x_0 \right)+4f\left(x_1 \right)+\cdots+4f\left(x_{2n-1} \right)+2f\left(x_{2n} \right) \right)$$

$$\displaystyle T_n=\frac{b-a}{2n}\left(f\left(x_0 \right)+2f\left(x_2 \right)+\cdots+2f\left(x_{2(n-1)} \right)+f\left(x_{2n} \right) \right)$$

Subtracting, we find:

$$\displaystyle 4T_{2n}-T_{n}=\frac{b-a}{2n}\left(f\left(x_0 \right)+4f\left(x_1 \right)+2f\left(x_2 \right)+\cdots+2f\left(x_{2n-2} \right)+4f\left(x_{2n-1} \right)+f\left(x_{2n} \right) \right)$$

Hence:

$$\displaystyle 4T_{2n}-T_{n}=\frac{b-a}{n}\left(f\left(x_0 \right)+4f\left(x_1 \right)+2f\left(x_2 \right)+\cdots+2f\left(x_{n-2} \right)+4f\left(x_{n-1} \right)+f\left(x_{n} \right) \right)$$

$$\displaystyle 4T_{2n}-T_{n}=3S_{n}$$

(b) We are given to approximate:

$$\displaystyle \int_0^{\frac{\pi}{4}}\sqrt{2-\sin^2(x)}\,dx$$

For comparison, W|A returns:

$$\displaystyle \int_0^{\frac{\pi}{4}}\sqrt{2-\sin^2(x)}\,dx\approx1.058095501392563$$

$$\displaystyle T_1=\frac{\frac{\pi}{4}-0}{2\cdot1}\left(f\left(0 \right)+f\left(\frac{\pi}{4} \right) \right)=$$

$$\displaystyle \frac{\pi}{8}\left(\sqrt{2-\sin^2(0)}+\sqrt{2-\sin^2\left(\frac{\pi}{4} \right)} \right)=\frac{\pi}{8}\left(\sqrt{2}+\sqrt{\frac{3}{2}} \right)\approx1.0363165535804948$$

$$\displaystyle T_2=\frac{\frac{\pi}{4}-0}{2\cdot2}\left(f\left(0 \right)+2f\left(\frac{\pi}{8} \right)+f\left(\frac{\pi}{4} \right) \right)=$$

$$\displaystyle \frac{\pi}{16}\left(\sqrt{2-\sin^2(0)}+2\sqrt{2-\sin^2\left(\frac{\pi}{8} \right)}+\sqrt{2-\sin^2\left(\frac{\pi}{4} \right)} \right)\approx1.0527994926632949$$

$$\displaystyle S_1=\frac{\frac{\pi}{4}-0}{3\cdot2}\left(f\left(0 \right)+4f\left(\frac{\pi}{8} \right)+f\left(\frac{\pi}{4} \right) \right)=$$

$$\displaystyle \frac{\pi}{24}\left(\sqrt{2-\sin^2(0)}+4\sqrt{2-\sin^2\left(\frac{\pi}{8} \right)}+\sqrt{2-\sin^2\left(\frac{\pi}{4} \right)} \right)\approx1.0582938056908950$$

$$\displaystyle S_2=\frac{\frac{\pi}{4}-0}{3\cdot4}\left(f\left(0 \right)+4f\left(\frac{\pi}{16} \right)+2f\left(\frac{\pi}{8} \right)+4f\left(\frac{3\pi}{16} \right)+f\left(\frac{\pi}{4} \right) \right)=$$

$$\displaystyle \frac{\pi}{48}\left(\sqrt{2-\sin^2(0)}+4\sqrt{2-\sin^2\left(\frac{\pi}{16} \right)}+2\sqrt{2-\sin^2\left(\frac{\pi}{8} \right)}+4\sqrt{2-\sin^2\left(\frac{3\pi}{16} \right)}+\sqrt{2-\sin^2\left(\frac{\pi}{4} \right)} \right)\approx$$

$$\displaystyle 1.0581079075268218$$

In summary:

$$\displaystyle T_1\approx1.0363165535804948$$

$$\displaystyle T_2\approx1.0527994926632949$$

$$\displaystyle S_1\approx1.0582938056908950$$

$$\displaystyle S_2\approx1.0581079075268218$$