← Back to all lessons
Class 12Calculus8:17Published 2 Jan 2025

Definite Integral of a Sum of Modulus Functions

Evaluate the definite integral of a sum of absolute value functions by splitting the range at the points where each modulus changes sign.

This lesson works through a board-exam favourite: the definite integral from 1 to 4 of the absolute values of x minus 1, x minus 2 and x minus 3 added together. It shows how to remove each modulus using its definition, break the integral into the intervals where each sign is fixed, and integrate the resulting linear pieces. The pieces are added back together to give the final value of 19 over 2.

What you'll learn

  • How to rewrite an absolute value as two cases depending on its sign
  • How to split a definite integral at the points where each modulus changes sign
  • How to integrate the simplified piece on each interval and add the results

Lesson chapters

0:00The question and why it matters for the board exam
0:31Writing each modulus as two cases
1:45Splitting the integral over 1 to 2, 2 to 3, 3 to 4
4:26Simplifying each piece and integrating
6:30Substituting the limits to reach 19 over 2

Lesson notes

This lesson evaluates the definite integral

I=14(x1+x2+x3)dx,I = \int_{1}^{4} \left( |x-1| + |x-2| + |x-3| \right)\, dx,

a common board-exam question on the modulus function and the properties of integrals.

Removing each modulus

By definition, x=x|x| = x when x0x \ge 0 and x=x|x| = -x when x<0x < 0. Applying this to each term:

x1={x1,x1(x1),x<1|x-1| = \begin{cases} x-1, & x \ge 1 \\ -(x-1), & x < 1 \end{cases}

x2={x2,x2(x2),x<2|x-2| = \begin{cases} x-2, & x \ge 2 \\ -(x-2), & x < 2 \end{cases}

x3={x3,x3(x3),x<3|x-3| = \begin{cases} x-3, & x \ge 3 \\ -(x-3), & x < 3 \end{cases}

The sign of each term changes at x=1x = 1, x=2x = 2 and x=3x = 3.

Splitting the integral

Using the additivity of the integral, the range [1,4][1,4] is split at the change points into [1,2][1,2], [2,3][2,3] and [3,4][3,4], so that every modulus has a fixed sign on each piece.

I=12()dx+23()dx+34()dx.I = \int_{1}^{2} (\dots)\, dx + \int_{2}^{3} (\dots)\, dx + \int_{3}^{4} (\dots)\, dx.

On [1,2][1,2]

Here x1x \ge 1, so x1=x1|x-1| = x-1; but x<2x < 2 and x<3x < 3, so x2=(x2)|x-2| = -(x-2) and x3=(x3)|x-3| = -(x-3). Adding:

(x1)(x2)(x3)=x+4.(x-1) - (x-2) - (x-3) = -x + 4.

On [2,3][2,3]

Here x1x \ge 1 and x2x \ge 2, so x1=x1|x-1| = x-1 and x2=x2|x-2| = x-2; but x<3x < 3, so x3=(x3)|x-3| = -(x-3). Adding:

(x1)+(x2)(x3)=x.(x-1) + (x-2) - (x-3) = x.

On [3,4][3,4]

Here x1x \ge 1, x2x \ge 2 and x3x \ge 3, so all three open positively:

(x1)+(x2)+(x3)=3x6.(x-1) + (x-2) + (x-3) = 3x - 6.

Integrating each piece

12(x+4)dx=[x22+4x]12=(2+8)(12+4)=672=52.\int_{1}^{2} (-x + 4)\, dx = \left[ -\tfrac{x^2}{2} + 4x \right]_{1}^{2} = (-2 + 8) - \left(-\tfrac{1}{2} + 4\right) = 6 - \tfrac{7}{2} = \tfrac{5}{2}.

23xdx=[x22]23=922=52.\int_{2}^{3} x\, dx = \left[ \tfrac{x^2}{2} \right]_{2}^{3} = \tfrac{9}{2} - 2 = \tfrac{5}{2}.

34(3x6)dx=[3x226x]34=(2424)(27218)=0+92=92.\int_{3}^{4} (3x - 6)\, dx = \left[ \tfrac{3x^2}{2} - 6x \right]_{3}^{4} = (24 - 24) - \left(\tfrac{27}{2} - 18\right) = 0 + \tfrac{9}{2} = \tfrac{9}{2}.

Adding the pieces

I=52+52+92=192.I = \tfrac{5}{2} + \tfrac{5}{2} + \tfrac{9}{2} = \tfrac{19}{2}.

Key takeaways

  • Rewrite each absolute value as two cases using x=x|x| = x for x0x \ge 0 and x=x|x| = -x for x<0x < 0.
  • Split the integral at every point where a modulus changes sign, so each term has a fixed sign on each subinterval.
  • Integrate the simplified linear expression on each piece and add the results: here I=192I = \tfrac{19}{2}.