Order of solving definite integrals I've been coming across several definite integrals in my homework where the solving order is flipped, and am unsure why.  Currently, I'm working on calculating the area between both intersecting and non-intersecting graphs.
According to the book, the formula for finding the area bounded by two graphs is
$$A=\int_{a}^{b}f(x)-g(x) \mathrm dx$$
For example, given $f(x)=x^3-3x^2+3x$ and $g(x)=x^2$, you can see that the intersections  are  $x={0, 1, 3}$ by factoring.  So, at first glance, it looks as if the problem is solved via
$$\int_0^1f(x)-g(x)\mathrm dx+\int_1^3f(x)-g(x)\mathrm dx$$
However, when I solved using those integrals, the answer didn't match the book answer, so I took another look at the work.  According to the book, the actual integral formulas are
$$\int_0^1f(x)-g(x)\mathrm dx+\int_1^3g(x)-f(x)\mathrm dx$$
I was a little curious about that, so I put the formulas in a grapher and it turns out that $f(x)$ and $g(x)$ flip values at the intersection $x=1.$
So how can I determine which order to place the $f(x)$ and $g(x)$ integration order without using a graphing utility?  Is it dependent on the intersection values?

If you know they intersect at 0, 1, and 3 and have no discontinuities (since they're polynomials), you can just plug some number between 0 and 1 into both $f$ and $g$ and see which one is bigger, and also some number between 1 and 3.  You certainly don't need a graphing utility to do that.
