Ma · Mathematics

Evaluate the Integral of the Piecewise Function from −2 to 4

Published By the 9to5Science editorial team

At a glance

  1. 1. Split at the breakpoint

    Separate the integral at x = 0, where the formula for f changes.

  2. 2. Integrate each piece

    Use the constant formula on [−2, 0] and the polynomial formula on [0, 4].

  3. 3. Add signed values

    Add the two definite integrals, keeping negative contributions below the x-axis.

Interpret the expression as the definite integral

∫−24f(x) dx,\int_{-2}^{4} f(x)\,dx,

where

f(x)={2,−2≤x≤0,4−x2,0<x≤4.f(x)= \begin{cases} 2, & -2\le x\le 0,\\ 4-x^2, & 0<x\le 4. \end{cases}

Because the formula changes at x=0x=0, split the integral there. The first interval contributes 44, and the second contributes −16/3-16/3, so the total is −4/3-4/3. The negative result is possible because a definite integral measures signed area, not just geometric area.

Split the integral where the formula changes

On [−2,0][-2,0], the function is constant at 22. On (0,4](0,4], it is the polynomial 4−x24-x^2. By additivity of definite integrals,

∫−24f(x) dx=∫−202 dx+∫04(4−x2) dx.\int_{-2}^{4} f(x)\,dx = \int_{-2}^{0}2\,dx + \int_{0}^{4}(4-x^2)\,dx.

The second piece is written with lower endpoint 00 even though its defining condition uses 0<x0<x. A single endpoint does not affect the value of a definite integral. The function is bounded and has only a jump discontinuity at 00, so it is Riemann integrable on the interval.

Evaluate each part

For the constant piece,

∫−202 dx=2(0−(−2))=4.\int_{-2}^{0}2\,dx =2(0-(-2)) =4.

For the polynomial piece, an antiderivative of 4−x24-x^2 is 4x−x3/34x-x^3/3. Therefore,

∫04(4−x2) dx=[4x−x33]04=(16−643)−0=−163.\begin{aligned} \int_{0}^{4}(4-x^2)\,dx &=\left[4x-\frac{x^3}{3}\right]_{0}^{4}\\ &=\left(16-\frac{64}{3}\right)-0\\ &=-\frac{16}{3}. \end{aligned}

Add the two results:

∫−24f(x) dx=4−163=−43.\int_{-2}^{4} f(x)\,dx =4-\frac{16}{3} =\boxed{-\frac{4}{3}}.

Why the answer is negative

The graph of 4−x24-x^2 crosses the horizontal axis at x=2x=2 on the interval from 00 to 44. It is above the axis from 00 to 22 and below it from 22 to 44. The signed contribution over the full polynomial interval is negative: the area below the axis outweighs the area above it. That negative contribution is large enough to outweigh the positive contribution of 44 from the constant piece.

If you wanted the total geometric area between the graph and the axis instead, you would take the absolute value of the function wherever it is negative. That is a different calculation from the definite integral.

Common mistakes

  • Using one formula across the whole interval: The function is piecewise, so each formula applies only on its specified part. Split at x=0x=0 before integrating.
  • Treating the integral as unsigned area: The part of the graph below the axis contributes negatively. Do not change its sign unless the question asks for geometric area.
  • Losing the minus sign in the antiderivative evaluation: At x=4x=4, 16−64/3=−16/316-64/3=-16/3, not 16/316/3.
  • Worrying about whether the second piece includes x=0x=0: Whether that one endpoint is assigned to the left or right formula does not change the definite integral.

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.