# Rectangle rule

A formula for calculating an integral over a finite interval $[a,b]$:

$$\label{eq:1} \int\limits_a^bf(x)dx\cong h\sum_{k=1}^Nf(\alpha+(k-1)h),$$

where $h=(b-a)/N$ and $\alpha\in[a,a+h]$. Its algebraic degree of accuracy is 1 if $\alpha=a+h/2$ and 0 otherwise.

The quadrature formula \eqref{eq:1} is exact for the trigonometric functions

$$\cos\frac{2\pi}{b-a}kx,\quad\sin\frac{2\pi}{b-a}kx,\quad k=0,\dots,N-1.$$

If $b-a=2\pi$, then \eqref{eq:1} is exact for all trigonometric polynomials of order at most $N-1$; moreover, its trigonometric degree of accuracy is $N-1$. No other quadrature formula with $N$ real nodes can have trigonometric degree of accuracy larger than $N-1$, so that the rectangle rule with $b-a=2\pi$ has the highest trigonometric degree of accuracy.

Let $R(f,\alpha)$ be the error of the rectangle rule, i.e. the difference between the left- and right-hand sides of \eqref{eq:1}. If the integrand $f$ is twice continuously differentiable on $[a,b]$, then for $\alpha=a+h/2$ one has

$$R\left(f,a+\frac h2\right)=\frac{b-a}{24}h^2f''(\xi),$$

for some $\xi\in[a,b]$. If $f$ is a periodic function with period $b-a$ and has a continuous derivative of order $2k$ (where $k$ is a natural number) on the entire real axis, then for any $\alpha\in[a,a+h]$,

$$R(f,\alpha)=-(b-a)B_{2k}\frac{h^{2k}}{(2k)!}f^{(2k)}(\eta),$$

for some $\eta\in[a,b]$, where $B_{2k}$ is the Bernoulli number (cf. Bernoulli numbers).