Approximate pi/4=integral from 0 to 1 dx/(1+x²) using (a)
Approximate $\dfrac{\pi}{4}=\displaystyle\int_0^1\frac{dx}{1+x^2}$ using (a) the midpoint rule with $n=10$, (b) the trapezoidal rule with $n=10$, and (c) Simpson's rule with $n=2$; estimate the error in each case.
Explanation of Method
Apply each rule's defining formula with $f(x)=1/(1+x^2)$ at the required nodes, compare the numerical result against the exact value $\pi/4$, and bound the theoretical error using the standard error formulas (which require bounding $|f''|$ for the midpoint and trapezoidal rules, and $|f^{(4)}|$ for Simpson's rule).
Step 0: Exact value
\[I_{\text{exact}}=\int_0^1\frac{dx}{1+x^2}=\big[\arctan x\big]_0^1=\frac{\pi}{4}\approx0.785398163.\]
Step 1(a): Midpoint rule, $n=10$
With $h=0.1$ and midpoints $x_i=(i-\tfrac12)h$:
| $i$ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| $x_i$ | 0.05 | 0.15 | 0.25 | 0.35 | 0.45 | 0.55 | 0.65 | 0.75 | 0.85 | 0.95 |
| $f(x_i)$ | 0.997506 | 0.977995 | 0.941176 | 0.890869 | 0.831601 | 0.767754 | 0.702988 | 0.640000 | 0.580552 | 0.525624 |
Summing the ten values gives $\sum f(x_i)\approx7.856065$, so
\[I_{\text{mid}}=h\sum f(x_i)\approx0.1\times7.856065=0.785606.\]
\[\boxed{I_{\text{mid}}\approx0.785606}\]
Step 1(b): Error bound for the midpoint rule
The midpoint-rule error bound is $E_{\text{mid}}\le\dfrac{(b-a)^3}{24n^2}\max|f''(x)|$. With $f''(x)=\dfrac{6x^2-2}{(1+x^2)^3}$, one finds $|f''(x)|$ is largest at $x=0$, where $|f''(0)|=2$. So
\[E_{\text{mid}}\le\frac{1}{24\times100}\times2=\frac{1}{1200}\approx0.000833.\]
The actual error is $|0.785606-0.785398|\approx0.000208$, comfortably inside the bound.
Step 2(a): Trapezoidal rule, $n=10$
With nodes $x_i=0,0.1,\dots,1.0$ and $f(x_i)$ computed at each, the trapezoidal sum is
\[I_{\text{trap}}=\frac{h}{2}\left[f(0)+f(1)+2\sum_{i=1}^{9}f(x_i)\right]=\frac{0.1}{2}\times15.699630\approx0.784981.\]
\[\boxed{I_{\text{trap}}\approx0.784981}\]
Step 2(b): Error bound for the trapezoidal rule
\[E_{\text{trap}}\le\frac{(b-a)^3}{12n^2}\max|f''(x)|=\frac{1}{1200}\times2=\frac{1}{600}\approx0.001667.\]
Actual error: $|0.784981-0.785398|\approx0.000417$, again inside the bound.
Step 3(a): Simpson's rule, $n=2$
With $h=0.5$, nodes $0,0.5,1$: $f(0)=1$, $f(0.5)=0.8$, $f(1)=0.5$.
\[I_{\text{Simpson}}=\frac{0.5}{3}\left[1+4(0.8)+0.5\right]=\frac{0.5}{3}\times4.7=0.783333.\]
\[\boxed{I_{\text{Simpson}}\approx0.783333}\]
Step 3(b): Error bound for Simpson's rule
\[E_{\text{Simpson}}\le\frac{(b-a)^5}{180n^4}\max|f^{(4)}(x)|.\]
One computes $f^{(4)}(x)=\dfrac{24(5x^4-10x^2+1)}{(1+x^2)^5}$, which attains its maximum magnitude $24$ at $x=0$. With $n=2$:
\[E_{\text{Simpson}}\le\frac{1}{180\times16}\times24=\frac{1}{120}\approx0.008333.\]
Actual error: $|0.783333-0.785398|\approx0.002065$, inside the bound.
Step 4: Summary comparison
All three approximations bracket $\pi/4$ within their theoretical error bounds; with these particular choices of $n$, the midpoint rule (using ten subintervals) happens to be the most accurate, followed by the trapezoidal rule, with Simpson's rule using only two subintervals the least accurate in absolute terms — a reminder that a higher-order method with very few points is not automatically better than a lower-order method with many points.
Result
Final answer:
\[\boxed{\frac{\pi}{4}\approx0.785398,\quad I_{\text{mid}}\approx0.785606\ (n{=}10),\quad I_{\text{trap}}\approx0.784981\ (n{=}10),\quad I_{\text{Simpson}}\approx0.783333\ (n{=}2)}\]