Consider the function y=x^2 for x[0,1]. Show using the trapezoidal rule with n intervals that the integral 0 -> 1 of x^2 dx is equivalent to n(n+1)(2n+1)/6n^3 - 1/2n.

I am having a lot of trouble arranging the trapezoidal rule into a sigma type sequence.

My current working goes as far as

integral of x^2 is equivilant to 1-0/2n [f(x0) +2(f(x1)+f(x2)+...+f(xn-1))+f(n)]

All help is greatly appreciated.