First lets us see what is Modulus function and then we will see how to do Integration of modulus function

## What is modulus function

Modulus Function is defined as the real valued function $f : R \rightarrow R$ , y = |x| for each $x \in R$

For each non-negative value of x, f(x) is equal to x. But for negative values of x, the value of f(x) is the negative of the value of x

$f(x) = |x|= \begin{cases}

x & \text{ if } x \geq 0 \\

-x & \text{ if } x < 0 \end{cases} $

It is also called the **absolute value function**

## Integration of modulus function

Integrating a modulus function requires breaking the integral into parts where the function inside the absolute value changes its sign. The general approach is to find the points where the function inside the absolute value is zero, and then integrate separately over intervals where the function is positive and negative.

Let’s consider a general example:

**Example:**

Integral of ( |f(x)| )

Suppose you want to integrate $ \int |f(x)| \, dx $ over an interval ([a, b]), and let’s say (f(x)) changes sign at (x = c) within this interval. Then, the integral can be split into two parts:

- From (a) to (c), where (f(x)) is either non-negative or non-positive.
- From (c) to (b), where (f(x)) has the opposite sign.

The integral becomes:

\[

\int_{a}^{b} |f(x)| \, dx = \int_{a}^{c} |f(x)| \, dx + \int_{c}^{b} |f(x)| \, dx.

\]

In each of these integrals, you replace (|f(x)|) with (f(x)) if (f(x)) is non-negative over the interval, or with (-f(x)) if (f(x)) is non-positive.

**Example:**

$ \int_{-1}^{1} |x| \, dx $

The function (f(x) = x) changes sign at (x = 0). So, we split the integral at (x = 0):

- From (-1) to (0), (x) is negative, so (|x| = -x).
- From (0) to (1), (x) is positive, so (|x| = x).

The integral becomes:

\[

\int_{-1}^{1} |x| \, dx = \int_{-1}^{0} -x \, dx + \int_{0}^{1} x \, dx.

\]

Now, integrate each part:

\[

\begin{align}

\int_{-1}^{0} -x \, dx &= \left[ -\frac{x^2}{2} \right]_{-1}^{0} = 0 – \left(-\frac{1}{2}\right) = \frac{1}{2}, \\

\int_{0}^{1} x \, dx &= \left[ \frac{x^2}{2} \right]_{0}^{1} = \frac{1}{2} – 0 = \frac{1}{2}.

\end{align}

\]

Adding these together gives:

\[

\int_{-1}^{1} |x| \, dx = \frac{1}{2} + \frac{1}{2} = 1.

\]

This method can be applied to any piecewise function involving absolute values, by splitting the integral at the points where the function inside the absolute value changes sign.

## Solved Examples

**Question 1:**

$ \int_{0}^{4} |x – 2| \, dx $

**Solution**

we first identify where the expression inside the absolute value, (x – 2), is zero. This occurs at (x = 2). We then split the integral at this point:

- From (0) to (2), (x – 2) is negative, so (|x – 2| = -(x – 2)).
- From (2) to (4), (x – 2) is positive, so (|x – 2| = x – 2).

The integral becomes:

\[

\int_{0}^{4} |x – 2| \, dx = \int_{0}^{2} -(x – 2) \, dx + \int_{2}^{4} (x – 2) \, dx.

\]

Now, integrate each part:

\[

\begin{align}

\int_{0}^{2} -(x – 2) \, dx &= \left[ -\frac{x^2}{2} + 2x \right]_{0}^{2} = \left(-2 + 4\right) – (0) = 2, \\

\int_{2}^{4} (x – 2) \, dx &= \left[ \frac{x^2}{2} – 2x \right]_{2}^{4} = \left(8 – 8\right) – \left(2 – 4\right) = 2.

\end{align}

\]

Adding these together gives:

\[

\int_{0}^{4} |x – 2| \, dx = 2 + 2 = 4.

\]

**Question 2:**

$ \int_{-\pi}^{\pi} |\sin(x)| \, dx $**Solution**

We know that $\sin(x)$ changes sign at $x = 0$ when going from $-\pi$ to $\pi$ so, We split the integral at these points:

- From $-\pi$ to (0), $\sin(x)$ is negative, so $|\sin(x)| = -\sin(x)$.
- From (0) to $\pi$, $\sin(x)$ is positive, so $|\sin(x)| = \sin(x)$.

The integral becomes:

\[

\int_{-\pi}^{\pi} |\sin(x)| \, dx = \int_{-\pi}^{0} -\sin(x) \, dx + \int_{0}^{\pi} \sin(x) \, dx.

\]

Now, integrate each part:

\[

\begin{align}

\int_{-\pi}^{0} -\sin(x) \, dx &= \left[ \cos(x) \right]_{-\pi}^{0} = \cos(0) – \cos(-\pi) = 1 – (-1) = 2, \\

\int_{0}^{\pi} \sin(x) \, dx &= \left[ -\cos(x) \right]_{0}^{\pi} = -\cos(\pi) – (-\cos(0)) = -(-1) – (-1) = 2.

\end{align}

\]

Adding these together gives:

\[

\int_{-\pi}^{\pi} |\sin(x)| \, dx = 2 + 2 = 4.

\]

**Question **3:

$\int_{0}^{4} |x-1| + |x – 2| + |x-3| \, dx$

**Solution**

We need to break it into parts based on the points where each absolute value expression changes sign. These points are at (x = 1), (x = 2), and (x = 3). We’ll split the integral at these points and then integrate over each segment.

- From 0 to 1: In this interval, (x-1 < 0), (x-2 < 0), and (x-3 < 0). So, the integral becomes $ \int_{0}^{1} -(x-1) – (x – 2) – (x-3) \, dx $.
- From 1 to 2: In this interval, $ x-1 \geq 0$, (x-2 < 0), and (x-3 < 0). So, the integral becomes $ \int_{1}^{2} (x-1) – (x – 2) – (x-3) \, dx $.
- From 2 to 3: In this interval, $x-1 \geq 0$, $x-2 \geq 0$, and (x-3 < 0). So, the integral becomes $ \int_{2}^{3} (x-1) + (x – 2) – (x-3) \, dx $.
- From 3 to 4: In this interval, $x-1 \geq 0$, $x-2 \geq 0$, and $x-3 \geq 0$. So, the integral becomes $ \int_{3}^{4} (x-1) + (x – 2) + (x-3) \, dx $.

Now, let’s compute each integral:

- From 0 to 1:

\[

\int_{0}^{1} (-x + 1 – x + 2 – x + 3) \, dx = \int_{0}^{1} (-3x + 6) \, dx = \left[ -\frac{3}{2}x^2 + 6x \right]_{0}^{1} = \left( -\frac{3}{2} + 6 \right) – 0 = \frac{9}{2}.

\] - From 1 to 2:

\[

\int_{1}^{2} (x – 1 – x + 2 – x + 3) \, dx = \int_{1}^{2} (-x + 4) \, dx= \left[ -\frac{1}{2}x^2 + 4x \right]_{1}^{2} = \left( -2 + 8 \right) – \left( -\frac{1}{2} + 4 \right) = \frac{5}{2}.

\] - From 2 to 3:

\[

\int_{2}^{3} (x – 1 + x – 2 – x + 3) \, dx = \int_{2}^{3} (x) \, dx = = \left[ \frac{1}{2}x^2 \right]_{2}^{3} = \left( \frac{9}{2} \right) – \left( 2 \right) = \frac{5}{2}.

\] - From 3 to 4:

\[

\int_{3}^{4} (x – 1 + x – 2 + x – 3) \, dx = \int_{3}^{4} (3x – 6) \, dx=\left[ \frac{3}{2}x^2 – 6x \right]_{3}^{4} = \left( 12 – 24 \right) – \left( \frac{27}{2} – 18 \right) = -3.

]\]

Adding these together gives the total integral:

\[

\frac{9}{2} + \frac{5}{2} + \frac{5}{2} – 3 = 9.

\]

So, $ \int_{0}^{4} |x-1| + |x – 2| + |x-3| \, dx = 9 $.

Other Integration Related Articles