Why Piecewise Averages Need Care
A piecewise-defined function can follow one rule on part of an interval and a different rule on another part. Its average over the whole interval depends on all of those pieces, not on any one formula alone.
The essential procedure is simple: locate every point where the formula changes, integrate each rule over the subinterval where it applies, add those contributions, and divide by the length of the original interval. The integral contributions are signed, so a negative contribution reduces the total.
This procedure uses the average-value formula for a function on an interval. The earlier material on average values establishes that the integral represents the function’s signed total across that interval; here, the key task is to handle the changes in formula without omitting or miscounting any part.
Definition and Conditions
A sufficient condition for the integral to exist is that \(f\) is piecewise continuous on \([a,b]\): it is continuous on finitely many subintervals and has only finitely many finite one-sided limits or finite discontinuities. The formulas may change abruptly at breakpoints; continuity at those points is not required.
To apply the definition, list the endpoints and all formula-change points in increasing order. If these are \(a=c_0<c_1<\cdots<c_n=b\), then the integral over the full interval is the sum of the integrals over the subintervals. Each subinterval must use the formula assigned to it.
The denominator is always the length of the full interval, \(b-a\), even when the function changes formula several times. The numerators being added are signed integral values, not necessarily positive areas.
A Reliable Calculation Process
Write the endpoints of the averaging interval and every formula-change point that lies between them, in increasing order.
For each pair of consecutive points, identify which formula for \(f\) applies there.
Use the corresponding formula and the endpoints of that subinterval. Keep negative results negative.
Add all the integral contributions, then divide by the length of the original interval.
Multiply the proposed average by the full interval length; the result must equal the combined integral.
Worked Calculations
Worked Example: Two Formula Changes
Find the average value of the function on \([0,4]\):
The formula changes at \(x=1\) and \(x=3\), so split the integral into the three corresponding parts:
Evaluate the first contribution:
Evaluate the second:
Evaluate the third:
The full integral is \(2+6+\frac{3}{2}=\frac{19}{2}\). The interval length is \(4-0=4\), so
Check: The proposed average times the full interval length is \(\frac{19}{8}\cdot 4=\frac{19}{2}\), which agrees with the combined integral.
Worked Example: A Negative Contribution
Find the average value on \([0,6]\) for
The breakpoints are \(2\) and \(4\). Integrate the three formulas on their respective intervals:
The first contribution is
The constant negative piece contributes
The last piece contributes
Thus the combined integral is \(4+(-2)+0=2\). Since the full interval has length \(6\),
Check: \(\frac{1}{3}\cdot 6=2\), the combined signed integral. In particular, replacing the negative contribution \(-2\) by \(2\) would give the wrong total.
Worked Example: Combining Three Different Rules
Find the average value on \([0,5]\) for
Split at both formula changes:
For the first piece,
For the constant piece,
For the last piece,
The sum is \(2+4+4=10\). Dividing by the full interval length \(5-0=5\) gives
Check: \(2\cdot 5=10\), agreeing with the sum of the three integrals. Each local contribution has been included once, and together their subintervals cover all of \([0,5]\).
Why Splitting Works
The splitting rule follows from additivity of the definite integral. If \(a<c<b\) and \(f\) is integrable on \([a,b]\), then
This property applies whether or not the formula for \(f\) changes at \(c\). For a piecewise-defined function, choose \(c\) to be a formula-change point so each integral can be evaluated using one formula. Repeating the property at each breakpoint gives the sum over all subintervals.
The proof also explains why the denominator does not change when the numerator is split. The calculation still finds the average on \([a,b]\); the subinterval integrals are only a way to evaluate its one full-interval integral.
Common Mistake: Averaging the Piece Formulas Separately
A frequent error is to find an average on each piece and then take an unweighted average of those local averages. That generally gives the wrong result when the pieces have different lengths. For example, in the first worked example the three subinterval lengths are \(1\), \(2\), and \(1\), not three equal lengths.
The three local averages there are \(2\), \(3\), and \(\frac{3}{2}\). Simply averaging those three numbers gives
which is not the correct full-interval average \(\frac{19}{8}\). The correction is to add the integrals, which already account for the lengths of their subintervals, and then divide once by the total length:
Another way to see the issue is that an integral on a longer subinterval typically represents a contribution across more of the domain. Giving every piece equal weight ignores that difference. The full-interval integral avoids this error by combining each contribution over its actual interval.
Practical Checks
Before accepting a result, check that the split covers the full interval with no gaps or overlaps of positive length, and that each formula is integrated only where it applies. Then confirm that the denominator is \(b-a\), not the number of pieces or the length of just one piece.
Finally, multiply the proposed average by \(b-a\). The product should equal the sum of the piece integrals. If a piece has a negative integral, retain its sign when adding: the average is determined by the net signed contribution over the whole interval.
Check Your Understanding
For each question, identify the full interval and the formula-change points before setting up any integrals.
- What is the average-value formula for an integrable function on \([a,b]\)?
- Why must a piecewise integral be split at each formula-change point inside the interval?
- If a piece contributes a negative integral, how does it affect the combined total?
- Why is the denominator the length of the full interval rather than the number of formulas?
- A proposed average on an interval of length \(7\) is \(3\). What should the combined integral equal if the answer is correct?