# Why is the sum of the numbers $1+2+3+4+\dots+N$ equal to the integral $\int_{0}^{N}x+0.5$, rather than $\int_{0}^{N}x$?

Sorry if this question has been asked in the past, or if it seems silly, but I couldn't find anything on Google or SE, and we didn't cover series in our math classes.

So basically, I'm working on something requiring the use of a triangular kernel, so I need to find the total sum of each point sampled. To make it easier for myself, I used a single side (result multiplied by two when I'm done), so it takes the form of an easier linear equation.

I thought that to find the result of summing each point along the line y=x would be the same as taking the definite integral of 0->N to find the area under the curve (or line, in this case):

$\sum_{n=1}^{N}n = \int_{0}^{N}x\cdot dx = \frac{N^2}{2}$

However, that obviously didn't work. So then I put the sum series through Microsoft Math which gave me $\sum_{n=1}^{N}n = \frac{N^2+N}{2}$

Differentiating it, I found that the integral I was after was actually $\int_{0}^{N}(x+0.5)\cdot dx$

Why does the integral require the 0.5 offset for the sum to work the way I intended? I thought that a possible reason for this was that the integral took one number too many (ie. added N+1 to the result), but I found that wasn't the case.

• Because the difference $(x+1)^2-x^2=2x+1$ is $x=y-0.5$ off from the derivative $\frac {dx^2}{dx}=2x$... – abiessu Nov 18 '13 at 20:08
• Draw a picture of the integral for the case where N=1. Your answer will become evident. – Matt Nov 18 '13 at 20:11
• @Matt: I'm not sure what you mean. As in plot both integrals ($x^2$ and $\frac{x^2+x}{2}$) and look at the case for N=1 (ie. x=1)? Since they both equal the same value at x=1, I'm assuming you mean something else. Sorry if I appear slow at this. >_< – Ruben Nunez Nov 18 '13 at 22:32
• He means draw the line $y=x+0.5$ and look at the area under it from 0 to 1. – Bennett Gardiner Nov 18 '13 at 22:58
• @Bennett Ohhhhh. Okay, that makes sense and also makes abiessu's comment make sense. So basically, since it's a difference of 1.0 between each 1.0dx, you have to modify the equation so that it satisfies $\int_{x}^{x+1} x+b=1$? – Ruben Nunez Nov 19 '13 at 0:35

Here is a picture for $n = 10$. The blue rectangles have width $1$ and height $0, 1, 2, \ldots, n-1$. Adding the red unit squares on top, we see the total shaded area is the sum $1 + 2 + \cdots + n$. The integral $\int_{x=0}^n x \, dx$ is the area under the line $y = x$. You can see that the two areas don't match up: The triangle doesn't include half of the area of all the red squares. But since there are $n$ red squares, their area is $n \times 1 = n$, and half of this is $n/2$. So the sum of $1 + 2 + \cdots + n$ is equal to $n^2/2 + n/2$.