Here is a graph of the two functions with f in pink and g in blue.
By symmetry, the area of each of the two enclosed regions is the same—area, here, meaning
the geometric concept which is nonnegative (or perhaps positive), as opposed to signed area. In terms of signed area, one might think of the two pieces as having opposite sign because f is above g for oen piece and g is above f for the other piece. However, typically, a problem asking for the area between curves or the area enclosed by one or more curves is asking for geometric area. The typical method of solution in that instance is to consider each piece separately, integrating (top function) – (bottom function) for each piece, to guarantee a positive (nonnegative) result.
There is not, for polynomials at least, any need to even see which is on top on the various intervals determined.
Example:$$f(x)=2x^3-6x^2+13x, \\ g(x)=x^3+x^2+x.$$
Begin by factoring the difference: $f(x)-g(x)=x(x-3)(x-4).$ [really not so easy for arbitrary polynomials, but likely works if doing a typical calc exercise.]
We see the zeros of the difference are $0,\ 3,\ 4.$ Since dealing with an area between graphs, the regions before $0$ and after $4$ are not considered (would contribute infinite areas). In the usual method one would see which is on top on each of the intervals $[0,3]$ and $[3,4]$ etc. But since area over each is the integral of the absolute value of $f-g$, which over each is either $f-g$ or $g-f$ [since the crossing point at $3$ was removed], we can complete the process of getting the total area as follows.
Step (1) Get (an) antiderivative $F(x)$ of the difference. Here $F(x)=(1/4)x^4-(7/3)x^3+6x^2.$
Step (2) evaluate $F(x)$ at each intersection point. Here $F(0)=0,\ F(3)=45/4,\ F(4)=32/3.$
Step (3) Add the absolute values of the successive differences. $(45/4-0)+(45/4-32/3)=45/4+7/12=71/6.$
So the area is $71/6,$ and we didn't need to know which function is on top during the intervals between intersections. I think this method also works for other reasonable functions defined on the reals, provided we can get effectively a list of values where the functions are equal, and we can successfully get a closed form antiderivative, and we are not interested in evaluationg improper integrals (which might converge in some cases).
Best Answer
Here's an easy fix for the negative area problem: use absolute value signs! To find the area between the two functions from $x=a$ to $x=b$, you can just do $$\int_a^b |f(x)-g(x)|dx$$ As for evaluating the integral, you can then divide the integral up into pieces where $f(x)-g(x)$ is negative and pieces where it is positive, then continue. Hopefully this clears things up.