The Modulus of a function

The modulus of a function represents its positive value excluding the sign. If you’ve ever used a GPS, you may have noticed that the distance from your location to a destination is always a positive number. Behind the scenes, a modulus function is in operation, ensuring the distance remains positive despite any negative calculations along the way. Similarly, in a financial context, if you’re trying to determine the absolute change in a stock price, the modulus function helps depict the sheer magnitude of change, regardless of it being an increase or decrease. Thus, practical uses of the modulus function permeate various real-world scenarios, making it a crucial concept in mathematical computations and problem-solving.

To take the modulus of a function means to take the positive value of that function’s output. Of course, this means that if the function is positive, we do nothing. If it turns out that the value of the function is negative then the modulus is the corresponding positive. We denote the modulus of a function with straight lines, i.e. the modulus of the function f(x) is \vert f(x)\vert. We sometimes write this as \text{abs}\left(f(x)\right) – the absolute value of f(x). Take the modulus of some scalar values, for example, \vert -3\vert=3 but \vert 4\vert =4. It follows that the piecewise definition of the modulus of a function is given by

\vert f(x)\vert\hspace{15pt}=\hspace{15pt}\begin{cases}\hspace{5pt}f(x), &\text{ if }f(x)\geq 0\\-f(x),&\text{ if }f(x)<0\end{cases}

What does piecewise mean? See the Piecewise Definition Example to define the modulus of a linear function in a piecewise fashion. The piecewise definition can be particularly helpful when solving equations. See the other examples.

Sketching the Modulus of a Function and Solving Equations

modulus of a function

Consider the graph of y=\vert x\vert. The piecewise definition of \vert x\vert is given by:

\vert x\vert=\begin{cases}\hspace{5pt}x, &\text{ if }x\geq 0\\-x,&\text{ if }x<0\end{cases}

It follows that the graph doesn’t change for positive x but is reflected for negative x. You can see this from the graph, y=x is in dashed blue whereas y=\vert x\vert is in solid red.

We can apply this process to the modulus of any function. All we need to do is sketch the original curve and reflect any negative parts across the x-axis. We can then use this to solve equations (or inequalities – see example) that involve the modulus of a linear function.

modulus of a functionConsider solving the equation 9-x=\vert 3x-2\vert. We can start by sketching the graph of y=3x-2 (dashed purple), flipping any negative parts across the x-axis to get y=\vert 3x-2\vert (solid purple), then plotting it against y=9-x (solid orange). There are two intersection points and so there are two solutions to the original equation. The piecewise definition of y=\vert 3x-2\vert is y=\begin{cases} 3x-2&\text{ if }x\geq \frac{2}{3}\\2-3x,&\text{ if }x<\frac{2}{3}\end{cases}. It follows that to find the right hand solution we need to solve 3x-2=9-x, that is 4x=11. To find the left hand solution, we solve 2-3x=9-x or -7=2x. Hence the solutions are x=\frac{11}{4} and x=-\frac{7}{2}.

Sketching |f(x)| and f(|x|)

Given the graph of a function y=f(x), you should know how to sketch the graphs of \vert f(x)\vert and f(\vert x\vert). We obtain the graph of \vert f(x)\vert by reflecting any part of graph that falls below the x-axis across it. This is because any negative value is made positive. However, the graph of f(\vert x\vert) is not so straight forward. In this case, we make the x-value positive first before we evaluate the function. This means that we reflect the right hand side of the graph across the x-axis and we effectively delete the left hand side of the graph.  See below for these two transformations. A question may also require you to sketch the original curve before performing the above transformations. See the Quadratic Example.

The original graph of y=f(x)
modulus of a function
The graph of y=|f(x)|
The graph of y=f(|x|)

Examples

Piecewise Definition Example

Give the piecewise definition of the modulus of the function f(x)=\frac{1}{2}x-7 in its simplest form and sketch the graph of \vert f(x)\vert.

Solution:

Using the piecewise definition of the modulus of a function we have:

\vert \frac{1}{2}x-7\vert=\begin{cases}\hspace{5pt}\frac{1}{2}x-7, &\text{ if }\frac{1}{2}x-7\geq 0\\-\left(\frac{1}{2}x-7\right),&\text{ if }\frac{1}{2}x-7<0\end{cases}

This simplifies to 

\vert \frac{1}{2}x-7\vert=\begin{cases}\hspace{5pt}\frac{1}{2}x-7, &\text{ if }x\geq 14\\7-\frac{1}{2}x,&\text{ if }x<14\end{cases}

We can sketch the curve from this or by reflecting the graph of y=\frac{1}{2}x-7 across the x-axis when it is negative:

modulus of a function

Inequality Example

Solve the inequality \vert 4-3x\vert >2x.

Solution:

Begin by sketching the curves of y=\vert 4-3x\vert and y=2x on the same graph. This gives us an idea of where the curves intersect and so where the inequality holds.

modulus of a function

The piecewise definition of y=|4-3x| is given by:

\vert 4-3x\vert=\begin{cases}\hspace{5pt}4-3x, &\text{ if }x\leq\frac{4}{3}\\3x-4,&\text{ if }x>\frac{4}{3}\end{cases}

To find the intersection points we solve 4-3x=2x and 3x-4=2x. It follows that the intersection points are \left(\frac{4}{5},\frac{8}{5}\right) and (4,8) respectively. The inequality is solved when y=\vert 4-3x\vert (the red line) is above y=2x (the blue line). Hence, the solution is given by x<\frac{4}{3} or x>4.

Quadratic Example

Sketch the graph of f(x)=2x^2+7x-9. On separate graphs, sketch the curves of \vert f(x)\vert and f(\vert x\vert).

Solution:

We can sketch the original quadratic by locating the roots and the y-intercept. See more on sketching quadratics.

modulus of a function

It follows that the graph of y=\vert 2x^2+7x-9\vert is:

and the graph of y=2\vert x\vert^2+7\vert x\vert-9 is:

modding x