Midpoint and Trapezoidal Rules

The Midpoint Rule

Take the height of each rectangle at the midpoint of its subinterval rather than at an end.
It is a Riemann sum like any other, so the definition of the definite integral already covers it.

The Trapezoidal Rule

A rectangle has a flat top, and the curve above it doesn't. Joining the two endpoint heights by a straight segment follows the curve far more closely, and turns each subinterval's region into a trapezoid.
T₄: the same four subintervals, each capped by the chord joining its endpoint heights.
A trapezoid lying on its side, with parallel sides f(xi−1)f(x_{i-1}) and f(xi)f(x_i) a distance Δx\Delta x apart, has area
[f(xi−1)+f(xi)2](b−an).\left[\frac{f(x_{i-1}) + f(x_i)}{2}\right]\left(\frac{b-a}{n}\right).
Now add the nn of them. Every interior height belongs to two trapezoids, once as a right end and once as a left end. It therefore appears with a coefficient of 22, while the two outer heights keep a coefficient of 11:
Area=(b−an)[f(x0)+f(x1)2+⋯+f(xn−1)+f(xn)2]=(b−a2n)[f(x0)+f(x1)+f(x1)+f(x2)+⋯+f(xn−1)+f(xn)]=(b−a2n)[f(x0)+2f(x1)+2f(x2)+⋯+2f(xn−1)+f(xn)].\begin{aligned} \text{Area} &= \left(\frac{b-a}{n}\right)\left[\frac{f(x_0) + f(x_1)}{2} + \cdots + \frac{f(x_{n-1}) + f(x_n)}{2}\right] \\[8pt] &= \left(\frac{b-a}{2n}\right)\bigl[f(x_0) + f(x_1) + f(x_1) + f(x_2) + \cdots + f(x_{n-1}) + f(x_n)\bigr] \\[8pt] &= \left(\frac{b-a}{2n}\right)\bigl[f(x_0) + 2f(x_1) + 2f(x_2) + \cdots + 2f(x_{n-1}) + f(x_n)\bigr]. \end{aligned}
The coefficients are 1,2,2,…,2,11, 2, 2, \ldots, 2, 1. Counting them is the usual place to drop a point: there are n+1n + 1 heights for nn subintervals.
So the two rules bracket the answer: M4≈1.0898M_4 \approx 1.0898 is below ln⁡3≈1.0986\ln 3 \approx 1.0986 and T4≈1.1167T_4 \approx 1.1167 is above it. Whether each rule comes out too big or too small depends on the concavity of the curve.

Error and concavity

A single subinterval shows why. Take the same integral with n=1n = 1, so each rule covers all of [1,3][1, 3] with one shape.
T₁: the chord from (1, 1) to (3, ⅓).
M₁: one rectangle of height f(2) = ½.
M₁ again: its top tilted onto the tangent line at x = 2.
In the first figure, the top of T1T_1 is the chord from (1,1)(1, 1) to (3,13)\left(3, \frac{1}{3}\right). The graph of a concave-up function lies below its chords, so the trapezoid covers the whole region and a little more. Its area is 43≈1.333\frac{4}{3} \approx 1.333, more than ln⁡3\ln 3.
In the second, M1M_1 is one rectangle of height f(2)=12f(2) = \frac{1}{2}, so its area is 11. It crosses the curve at x=2x = 2. It leaves out part of the region on the left and covers empty space on the right. The picture alone doesn't show which of the two is larger.
The third figure tilts the rectangle's top about the point (2,12)\left(2, \frac{1}{2}\right) until it lies along the tangent line there, y=12−14(x−2)y = \frac{1}{2} - \frac{1}{4}(x - 2). The triangle added on the left is the same size as the triangle removed on the right, so the area does not change. The new parallel sides are 34\frac{3}{4} and 14\frac{1}{4}, and 12(34+14)(2)=1\frac{1}{2}\left(\frac{3}{4} + \frac{1}{4}\right)(2) = 1. A tangent line to a concave-up curve lies below the curve, so this trapezoid lies inside the region, and M1M_1 is too small.
The same argument applies to every subinterval of MnM_n and TnT_n, for any nn.
Our example is the first case. 1x\frac{1}{x} is concave up on [1,3][1, 3], and the midpoint estimate came in low, the trapezoid estimate high. A concave-down curve flips both pictures: chord below, tangent above.
On a concave-down curve every chord dips below the graph, so the trapezoid estimate falls short.
The two errors are related as well. The midpoint estimate missed by about 0.0090.009, the trapezoid estimate by about 0.0180.018. So the midpoint error is roughly half the size and on the other side of the answer. For a smooth function whose concavity doesn't change on [a,b][a, b], this holds approximately, and more closely as nn grows. That makes the cruder-looking rule the better one.

Four estimates, one integral

Whether ff increases or decreases tells which endpoint sum is too big, as the Riemann sums lesson showed. Its concavity tells which of the midpoint and trapezoid estimates is. The table collects the four cases.
Too smallToo big
ff increasingLnL_nRnR_n
ff decreasingRnR_nLnL_n
ff concave upMnM_nTnT_n
ff concave downTnT_nMnM_n
The sign of ff plays no part. The left sum of an increasing function is too small whether the function is positive or negative, and the same holds for every other row.
When ff changes concavity inside [a,b][a, b], the trapezoids are too big on one part of the interval and too small on another. Without more information about ff, TnT_n can't be classified as an overestimate or an underestimate, and neither can MnM_n. The same is true of LnL_n and RnR_n when ff changes direction.

Unequal widths

The Trapezoidal Rule's tidy 1,2,2,…,2,11, 2, 2, \ldots, 2, 1 pattern comes from every subinterval having the same width, so the common factor can be pulled out front. An AP question supplying a table of measured values usually spaces them unevenly, and then the rule doesn't apply.
Compute each trapezoid's area on its own width and add them up. The rule was only a shortcut for doing exactly that.
The same goes for the whole construction. The definition of the integral used equal widths for convenience. For an integrable function the limit is the same for every choice of sample points and every partition, provided the widest subinterval shrinks to zero. The trapezoid sum isn't built as a Riemann sum, since its heights are averages rather than values of ff at chosen points. But it's the average of two Riemann sums, Tn=12(Ln+Rn)T_n = \frac{1}{2}(L_n + R_n), so it has the same limit. In the limit, then, left, right, midpoint, and trapezoid all give the same number, although at any fixed nn they differ, as 1.08981.0898 and 1.11671.1167 do here.