You are looking for the sum of all numbers in a linear function. The sum is equivalent to the area under the curve which you normally use calculus and integrate for. However, in the case of a linear function, it's just a triangle. So, you can take a short cut if you just "know" f(x)=x^2 / 2.