Recall that the area below the graph of the function f (x) from a to b is the definite integral
where area counts as negative when f (x) < 0. If the function f (x) takes on both positive and negative values in the interval [a, b], and we want to compute the total area counting all areas as positive, we need to refine our method. The correct thing to do is to break the integral up into several integrals corresponding to the parts of the interval on which the function is positive and those on which it is negative.
For example, let us calculate the area between the graph of f (x) = sin(x) and the x-axis from 0 to 2Π. If we were simply to compute the integral
we would obtain 0, because the areas above and below the x-axis exactly cancel each other out weighted with opposite signs. Instead, we must take the integral of the absolute value of f, splitting it into two separate integrals in order to evaluate it:
|| sin(x)| dx||=||| sin(x)| dx + | sin(x)| dx|
|=||sin(x)dx + - sin(x)dx|
|=||-cos(x)|0Π + cos(x)|Π2Π|
|=||(1 + 1) + (1 + 1)|
Alternately, we could have noted from the symmetry of the graph of sin(x) that it is enough to calculate the area below the graph from 0 to Π and double it.
Integrals also enable us to calculate the area between the graphs of two functions (up to this point, the second function has always been f (x) = 0, with graph equal to the x- axis). For this, we note that the area between the graphs of two functions f and g is the difference of the area between the graph of f and the x-axis and the area between the graph of g and the x-axis. Hence the area between the graphs of f and g from a to b is given by:
|f (x)dx - g(x)dx = f (x) - g(x)dx|
where the area is counted as positive when f (x) > g(x) and as negative when f (x) < g(x).