# Proof of generalized open & closed Newton-Cotes formulas

I am looking for proof of generalized open & closed Newton-Cotes formulas. I couldn't find any reference which properly proves both theorems. Most books just state the theorem and do not provide any proof.

Suppose that $$\sum_{i=0}^{n} a_{i} f\left(x_{i}\right)$$ denotes the $$(n+1)$$ -point open Newton-Cotes formula with $$x_{-1}=a, x_{n+1}=b,$$ and $$h=(b-a) /(n+2) .$$ There exists $$\xi \in(a, b)$$ for which $$\int_{a}^{b} f(x) d x=\sum_{i=0}^{n} a_{i} f\left(x_{i}\right)+\frac{h^{n+3} f^{(n+2)}(\xi)}{(n+2) !} \int_{-1}^{n+1} t^{2}(t-1) \cdots(t-n) d t$$ if $$n$$ is even and $$f \in C^{n+2}[a, b],$$ and $$\int_{a}^{b} f(x) d x=\sum_{i=0}^{n} a_{i} f\left(x_{i}\right)+\frac{h^{n+2} f^{(n+1)}(\xi)}{(n+1) !} \int_{-1}^{n+1} t(t-1) \cdots(t-n) d t$$ $$\text { if } n \text { is odd and } f \in C^{n+1}[a, b] \text { . }$$