Using the trapezoid rule show that $\sum_{k=1}^nk = \frac{n(n+1)}{2}, \forall n \in \mathbb{N}$ $\sum_{k=1}^nk = \frac{n(n+1)}{2}, \forall n \in \mathbb{N}$
I got as far as
$$k = w_kf(x_k) \\
\sum_{k = 1}^n k = \int_1^n w_kf(x_k)dx = \\
\frac{(n-1)}{2(n-1)}[f_o+2(f_1+f_2+f_3+...+f_{n-1}) +f_n] \\
f(x_k) = k \Rightarrow \\
\frac{1}{2}[(n+1)+2(\sum_{k=2}^{n-1}k)]$$
I got stumped on this part so I improvised
$$\frac{1}{2}[(n+1)+2(\frac{(n-1)n}{2}-1)] = \\
\frac{1}{2}[(n+1)+(n-1)n-2] = \\
\frac{(n-1)(n+1)}{2}$$
I have a gut feeling that on $\frac{(n-1)}{2(n-1)}$ it should be $\frac{(n)}{2(n-1)}$ but the formula states it's $\frac{(b-a)}{2N}$ where N is the number of spaces between the points so I don't know.
Help?
 A: You can write the sum as the area of a trapezium that splits into $n$ trapezia, but that's not the usual meaning of "the trapezoid rule". Since $k$ is the area of a width-$2$ trapezium whose parallel sides have lengths $k\pm\tfrac12$, $\sum_{k=1}^nk$ is the area of a width-$2n$ trapezium whose parallel sides have lengths $n+\tfrac12,\,\tfrac12$.
A: The composite trapezoidal rule for the function $f : [a,b] \rightarrow \mathbb{R}$ with uniform stepsize $h = (b-a)/n$ and points $x_i = a+ih$ for $i=0,1,2,\dots,n$ is given by
$$ T_h(f) = \sum_{i=0}^{n-1} \frac{h}{2} \Big[f(x_i) + f(x_{i+1})\Big] = \frac{h}{2} f(x_0) + h \left(\sum_{i=1}^{n-1} f(x_i)\right) + \frac{h}{2} f(x_i) $$
In the case of $f : [0,n] \rightarrow \mathbb{R}$ given by $f(x) = x$ and $h = 1$ we have $$T_1(f) = 0 + \sum_{k=1}^{n-1} k + \frac{1}{2} n.$$
The trapezoidal rule is exact for all linear functions, so
$$ T_1(f) = \int_0^n x^2 dx = \frac{1}{2}n^2.$$
It follows that
$$\sum_{k=1}^n k = T_1(f) + \frac{1}{2} n = \frac{1}{2}n^2 + \frac{1}{2}n = \frac{n(n+1)}{2}.$$
