S= u1.u1 + u2.u2+...+un.un
S = u1.(u2 - d) + u2.(u3 - d)+...+un(un+1 - d)
S = u1.u2 + u2.u3 +...+un.un+1-d(u1+u2+...+un)
Đặt A = u2.u3 + u3.u4+...+un.un+1
3d.A = u2.u3.(u4-u1) + u3.u4.(u5-u2)+...+un.un+1.(un+2-un-1)
3d.A = u2.u3.u4 - u1.u2.u3 + u3.u4.u5 - u2.u3.u4+...+un.un+1.un+2 - un-1.un.un+1
3d.A = un.un+1.un+2 - u1.u2.u3
3d.A = (u1 + d.n - d)(u1 + d.n)(u1 + d.n + d) - u1.(u1+d).(u1+2.d)
A = [(u1 + d.n - d)(u1 + d.n)(u1 + d.n + d) - u1.(u1+d).(u1+2.d)]/(3.d)
S = A + u1.(u1 + d) + d[2.u1+(n-1).d].n/2