# Integration - Area under a curve

I was working on a computer programming project that involves 2D drawing on windows OS. I was displaying curves using simple mathematical formulas, and was thinking of filling the part under a curve.

That requires to draw straight lines from x to y. Then I was thinking, summing up those lines make up the area under the curve, which is clearly what an integral in mathematics is, but I was not able to explain one thing.

The length of those lines is the corresponding y's, so basically I would be summing: y1 + y2 + y3 + ...

So, if I have a graph for y = x, the sum is:

1 + 2 + 3 + . . .

The formula for this sum is clearly ((x * x) + x) / 2, and not (x * x) / 2. I don't get it, because the laws of integration tell us that the integral of x^n is (x ^ (n+1)) / (n+1). How is that so?

• The formula for the integral does not bear resemblance necessarily to the formula for the summation. – max_zorn Apr 28 '18 at 7:03
• Are you talking about Simpson's rule? – Narasimham Apr 28 '18 at 7:39

## 1 Answer

Perhaps this figure will help you What you're doing is the adding heights of the vertical blue lines on the left, which is clearly not the area under the blue curve!

Imagine you divide the interval $[0, x]$ into $N$ pieces each of size

$$\Delta = \frac{x}{N}$$

The $x$ coordinates of each rectangle on the right figure can be labeled with the number $x_i = \Delta i$. The area of each individual rectangle is

$$A_i = (x_{i + 1} - x_i) y_i = \Delta x_i = \Delta^2 i$$

So that the total area is

$$A_N = \sum_{i=1}^N A_i = \sum_{i=1}^N \Delta x_i = \frac{x^2}{N^2} \sum_{i=1}^N i = \frac{x^2}{N^2}\frac{N(N+1)}{2} = \frac{x^2}{2} \left(1 + \color{blue}{\frac{1}{N}}\right) \tag{1}$$

Look at the term $\color{blue}{1/N}$, the larger the number $N$ the smaller $1/N$. In the limit when $N\to\infty$ this number is zero, and the area converges to

$$\lim_{N\to\infty}A_N = A = \frac{x^2}{2} \tag{2}$$

• I think you are viewing the image in a different manner. The area by my definition would be the number of pixels. Just a number. It does not have to be a square. The formula x^2/2 does not calculate all the pixels under a curve, and thus does not amount to the area. – machine_1 Apr 28 '18 at 9:47