Home » Blog » Compute the area between the graphs of functions

Compute the area between the graphs of functions

Let

    \[ f(x) = |x|+|x-1|, \qquad g(x) = 0. \]

Find the area between the graphs of f and g on the interval [-1,2].


First, we draw the graph, shading the region S between the two graphs in blue.

Rendered by QuickLaTeX.com

In this problem f(x) \geq g(x) on the entire interval [-1,2]; however, the function f(x) = |x|+|x-1| is defined piecewise on this interval.

    \begin{align*}  \int_{-1}^2 (f(x) - g(x)) \, dx &= \int_{-1}^2 \left(|x| + |x-1|\right) \, dx \\  &= \int_{-1}^2 |x| \, dx + \int_{-1}^2 | x-1| \, dx. \end{align*}

The functions |x| and |x-1| are defined piecewise on the interval [-1,2] by

    \[ |x| = \begin{cases} -x & \text{if } x \in [-1,0) \\ x & \text{if } x \in [0,2] \end{cases} \]

and

    \[ |x-1| = \begin{cases} -(x-1) & \text{if } x \in [-1,1) \\ (x-1) & \text{if } x \in [1,2] \end{cases}. \]

So, we break each integral into two pieces and compute:

    \begin{align*}  \int_{-1}^2 |x| \, dx + \int_{-1}^2 |x-1| \, dx &= \int_{-1}^0 (-x) \, dx + \int_0^2 x \, dx + \int_{-1}^1 -(x-1) \, dx + \int_1^2 (x-1) \, dx \\  &= \left. \left(-\frac{x^2}{2}\right) \right|_{-1}^0 + \left. \left( \frac{x^2}{2} \right) \right|_0^2 + \left. \left( - \frac{x^2}{2} \right) \right|_{-1}^1 + (x)\biggr \rvert_{-1}^1 + \left. \left( \frac{x^2}{2} \right) \right|_1^2 + (-x) \biggr \rvert_1^2 \\  &= \frac{1}{2} + 2 - \frac{1}{2} + \frac{1}{2} + 1 + 1 + 2 - \frac{1}{2} - 2 + 1 \\  &= 5. \end{align*}

One comment

  1. Hannes says:

    Truly I believe that it is better to just use basic geometry for this problem. I think Apostol intended you to, as well, considering he earlier spoke of “the double-edged sword” of using an integral to calculate area, and sometimes using geometry to calculate an integral.

Point out an error, ask a question, offer an alternative solution (to use Latex type [latexpage] at the top of your comment):