The composite rectangle rule with uniform spacing:
$$\int_b^a f(x)dx ≈ h \sum_{i=0}^{n-1} f(xi)$$
where h=(b−a)/n and xi =a+ih for 0<=i<=n. Find an expression for the error involved in this latter formula.
I've spent a long time trying to understand why it holds $$|I[f]-M_n[f]|\le \frac{(b-a)^3}{24n^2}\max_{x\in [a,b]}|f''(x)|$$ I would appreciate it a lot if someone could give me an explanation.
There's a reason you don't understand it. If we let $p_0(x)=f(0)$ then if we choose any point $0<x<1$ and compose $$e(y)=f(y)-p_0(y)-\frac yx\left(f(x)-p_0(x)\right)$$ Then $e(0)=e(x)=0$ so one application of Rolle's theorem shows that for any $0<x<1$ there is some $0<v(x)<1$ such that $$e^{\prime}(v(x))=f^{\prime}(v(x))-\frac1x\left(f(x)-p_0(x)\right)=0$$ So that $$f(x)=p_0(x)-xf^{\prime}(v(x))$$ Then we can integrate $$\int_0^1f(x)dx=\int_0^1p_0(x)dx+\int_0^1xf^{\prime}(v(x))dx$$ Since $x\ge0$ over the interval of integration we can conclude that $$\min_{x\in(0,1)}f^{\prime}(x)\int_0^1x\,dx\le\int_0^1f(x)dx-f(0)\int_0^11dx\le\max_{x\in(0,1)}f^{\prime}(x)\int_0^1x\,dx$$ So integration and application of the intermediate value theorem produces $$\int_0^1f(x)dx-f(0)=\frac12f^{\prime}(\xi)$$ For some $0<\xi<1$. How does this help us with the original problem? Well, start with $$\int_{x_i}^{x_{i+1}}f(x)dx=\int_0^1f\left(x_i+u(x_{i+1}-x_i)\right)(x_{i+1}-x_i)du=(x_{i+1}-x_i)\int_0^1g(u)du$$ Where we have transformed the variable of integration via $x=x_i+(x_{i+1}-x_i)u$ and defined a new function $g(u)=f\left(x_i+u(x_{i+1}-x_i)\right)$. Now, if we have an integration formula that uses the value of $g(u_j)$ at points $u_j$ and perhaps also $g^{\prime}(v_j)$ at points $v_j$ and has error proportional to the $k^{\text{th}}$ derivative $g^{(k)}(\xi)$, $$\int_0^1g(u)du=\sum_{j=1}^nw_jg(u_j)+\sum_{j=1}^mz_jg(v_j)+Cg^{(k)}(\xi)$$ Then this becomes $$\begin{align}\int_{x_i}^{x_{i+1}}f(x)dx&=(x_{i+1}-x_i)\int_0^1g(u)du=(x_{i+1}-x_i)\left\{\int_0^1f\left(x_i+(x_{i+1}-x_i)u\right)\right\}du\\ &=(x_{i+1}-x_i)\left\{\sum_{j=1}^nw_jf\left(x_i+(x_{i+1}-x_i)u_j\right)\right.\\ &\quad\left.+\sum_{j=1}^mz_j(x_{i+1}-x_i)f^{\prime}\left(x_i+(x_{i+1}-x_i)v_j\right)+C(x_{i+1}-x_i)^kf^{(k)}(\xi_i)\right\}\\ &=(x_{i+1}-x_i)\sum_{j=1}^nw_jf\left(x_i+(x_{i+1}-x_i)u_j\right)\\ &\quad+(x_{i+1}-x_i)^2\sum_{j=1}^mz_jf^{\prime}\left(x_i+(x_{i+1}-x_i)v_j\right)+C(x_{i+1}-x_i)^{k+1}f^{(k)}(\xi_i)\end{align}$$ Then if we let $h=\frac{b-a}n$ and $x_i=a+ih$, $$\begin{align}\int_a^bf(x)dx&=\sum_{i=0}^{n-1}\int_{x_i}^{x_{i+1}}f(x)dx =h\sum_{i=0}^{n-1}\sum_{j=1}^nw_jf\left(x_i+(x_{i+1}-x_i)u_j\right)\\ &\quad+h^2\sum_{i=0}^{n-1}\sum_{j=1}^mz_jf^{\prime}\left(x_i+(x_{i+1}-x_i)v_j\right)+Ch^{k+1}\sum_{i=0}^{n-1}f^{(k)}(\xi_i)\\ &=h\sum_{i=0}^{n-1}\sum_{j=1}^nw_jf\left(a+ih+hu_j\right)\\ &\quad+h^2\sum_{i=0}^{n-1}\sum_{j=1}^mz_jf^{\prime}\left(a+ih+h_j\right)+Ch^{k+1}nf^{(k)}(\xi)\end{align}$$ Where we have used $$n\min_{a\le x\le b}f^{(k)}(x)\le\sum_{i=0}^{n-1}f^{(k)}(\xi_i)\le n\max_{a\le x\le b}f^{(k)}(x)$$ And the intermediate value theorem to simplify the error term. In the original question this reads $$\int_a^bf(x)dx=\frac{b-a}n\sum_{i=0}^{n-1}f\left(a+\frac{b-a}ni\right)+\frac{(b-a)^2}{2n}f^{\prime}(\xi)$$ for some $a<\xi<b$. We can see that this formula is correct if we try $f(x)=x$.
So what went wrong? I am sure that it was a misprint in your book so that what was intended was to find a polynomial $p_1(x)$ such that $p_1\left(\frac12\right)=f\left(\frac12\right)$ and $p_1^{\prime}\left(\frac12\right)=f^{\prime}\left(\frac12\right)$. $$p_1(x)=f\left(\frac12\right)+\left(x-\frac12\right)f^{\prime}\left(\frac12\right)$$ So then we play the game with $$e(y)=f(y)-p_1(y)-\frac{\left(y-\frac12\right)^2}{\left(x-\frac12\right)^2}\left(f(x)-p_1(x)\right)$$ For any $x\in(0,1)\setminus\left\{\frac12\right\}$. Then $e\left(\frac12\right)=e^{\prime}\left(\frac12\right)=e(x)=0$, so one application of Rolle's theorem shows that there is some $z\in(0,1)\setminus\left\{\frac12\right\}$ such that $e^{\prime}(z)=0$ and taking in hand our already known $e^{\prime}\left(\frac12\right)=0$ we can apply Rolle's theorem again to conclude that there is some $v(x)\in(0,1)\setminus\left\{\frac12\right\}$ such that $$e^{\prime\prime}(v(x))=f^{\prime\prime}(v(x))-\frac2{\left(x-\frac12\right)^2}\left(f(x)-p_1(x)\right)=0$$ So that $$f(x)=p_1(x)+\frac{\left(x-\frac12\right)^2}2f^{\prime\prime}(v(x))$$ And also by inspection for $x=\frac12$. Integrating, $$\int_0^1f(x)dx=\int_0^1p_1(x)dx+\frac12\int_0^1\left(x-\frac12\right)^2f^{\prime\prime}(v(x))dx$$ Since $\left(x-\frac12\right)^2\ge0$ over the interval of integration we can conclude that $$\min_{x\in(0,1)}\frac12f^{\prime\prime}(x)\int_0^1\left(x-\frac12\right)^2dx\le\int_0^1f(x)dx-\int_0^1\left[f\left(\frac12\right)+\left(x-\frac12\right)f^{\prime}\left(\frac12\right)\right]dx\le\max_{x\in(0,1)}\frac12f^{\prime\prime}(x)\int_0^1\left(x-\frac12\right)^2dx$$ Integrating and applying the intermediate value theorem, $$\int_0^1f(x)dx-f\left(\frac12\right)=\frac1{24}f^{\prime\prime}(\xi)$$ For some $0<\xi<1$. This translates in the original problem back to $$\int_a^bf(x)dx=\frac{b-a}n\sum_{i=0}^{n-1}f\left(a+\left(i+\frac12\right)\frac{b-a}n\right)+\frac{(b-a)^3}{24n^2}f^{\prime\prime}(\xi)$$