Consider the function f(x)=−x2+3x−2. We determine the area of the region enclosed by the graph of f(x), the x-axis and the lines x=0 and x=2.
We first of all investigate on which (sub)intervals the function f(x) is non-negative or non-positive. For this we determine the zeros of f(x).
f(x)=0⇔−x2+3x−2=0⇔−(x−1)(x−2)=0⇒x=1 or x=2.
On the interval [0,1] it holds that f(x)≤0 and on the interval [1,2] it holds that f(x)≥0, see the following graph.

The total area O(f,0,2) of the shaded region is equal to O1+O2. According to the theorem regarding integrals and areas we can express this area in terms of integrals, that is
O1+O2=−∫10(−x2+3x−2)dx+∫21(−x2+3x−2)dx.
An antiderivative of f(x) is the function F(x)=−13x3+32x2−2x. Now we are able to calculate the desired integrals.
∫10(−x2+3x−2)dx=[−13x3+32x2−2x]x=1x=0=(−13+32−2)−0=−56∫21(−x2+3x−2)dx=[−13x3+32x2−2x]x=2x=1=(−83+6−4)−(−56)=16
Hence, the area of the the shaded region i O=O1+O2=56+16=1.