## Saturday, January 31, 2015

Suppose we want to estimate the area under the curve f(x) = x^2 + 3x - 4 over the interval [1, 4].  We can do this be creating rectangles of equal width (noted as w). Suppose we want to have 4 rectangles, each would be of width (4-1)/4 = 3/4. Using the width of 3/4 we can get the left endpoints of each triangle.

x1 = 1,   x2= 1.75, x3 = 2.5, x4 = 3.25 and x5 = 4

f(x1) is the height of the first rectangle using the left endpoint.
f(x2) is the height of the second rectangle using the left endpoint and so on.

Now we take f(x1) = 1 + 3 - 4 = 0
f(x2) =  4.3125
f(x3) = 9.75
f(x4) = 16.3125

To get the area we take w*f(x1) + w*f(x2) + w*f(x3) + w*f(x4). Doing so, we get 22.7815.

Now we can estimate the area again using the right endpoint of each triangle. Those values are

f(x2), f(x3), f(x4) and f(x5)

f(x5) = 24

The estimated area is 22.7815 + 24 = 46.7815.

Using integration on the function f(x), we get (1/3)x^3 + (3/2)x^2 - 4x. Substituting 4 for x, we get 29.333333 Substituting 1 for x, we get -2.166666 Subtracting the values we get the area to be 31.5