The graph of the piecewise-linear function \(f\), for \(-1\leq x\leq4 \), is shown above. What is the value of \(\displaystyle \int\limits_{-1}^4 f(x)   dx \)
 ?
Since we are not given the equation, we can either derive the piecewise function from the graph or obtain the area under the curve through geometry. You are not expected to derive the equation and it would take significantly longer, so let's use the area under the curve.
The positive area (in gray) and the negative area (in yellow) are both trapezoids:
The formula for a trapezoid is the average of the bases times the height: \(\frac{1}{2}(b_1+b_2)\cdot h\)
You can also split it into triangles, rectangles, and squares if you prefer.
$$ \int\limits_{-1}^4 f(x)   dx = \underbrace{\frac{1}{2}(1+3)(2)}_\text{area of gray region} - \underbrace{\frac{1}{2}(2+1)(1)}_\text{area of yellow region} $$
$$ = 4-1.5 $$
$$ = \boxed{2.5} $$