# 4.9 The modulus function

The modulus function is a very happy function1414 14 Sorry.. This is because it’s always positive, and never takes on any negative values!

We can write it as $\left\lvert x\right\rvert$. For example, all of these expressions are true

 $\displaystyle\left\lvert 12\right\rvert=12$ $\displaystyle\left\lvert-12\right\rvert=12$ $\displaystyle\left\lvert 12-6\right\rvert=\left\lvert 6-12\right\rvert$ $\displaystyle\left\lvert-x\right\rvert=x$

## 4.9.1 Graphically

When graphing a value inside a modulus function, it is often helpful to first sketch the function without the modulus. For example, when graphing $y=\left\lvert-\left(x-5\right)^{2}+1\right\rvert$, the graph of $y=2x-8$ would look like this:

As the modulus function must never be unhappy (i.e. take a negative value), we need to turn that frown upside down!1515 15 Ok, I’ll stop, I promise. Using the quadratic formula to find the roots, we get that they are at $x=4$ and $x=6$. Therefore, everything to the left of $4$ and to the right of $5$ needs to be reflected it the $x$-axis.

## 4.9.2 As a function

One way to define the modulus function is, well, as a function. As the function always needs to be positive, we can write that

$\left\lvert x\right\rvert=\begin{cases}x&x\geqq 0\\ -1\cdot x&x<0\end{cases}$ (4.73)

What this means is that in the case where $x$ (the input to the modulus function) is bigger than zero, we just return $x$. If $x$ is smaller than zero, we multiply it by $-1$ in order to make it positive.

## 4.9.3 Algebraically

To write the modulus function as an algebraic expression, we’re interested in functions which are always positive. The one which (probably?) springs to mind is squaring. Using this, we can define the modulus function as 1616 16 Note that this is just the square root of the magnitude. It is also important to never give into the temptation to say ”oh this is just the square root of a square number, it’s just the original number.” This is wrong. In the expression $\sqrt{x^{2}}$ when we square $x$, both $x$ and $-x$ are mapped to the same value, so stating that the square root of the square is just the original value is not true for negative numbers.

$\left\lvert x\right\rvert=\sqrt{x^{2}}$ (4.74)

This is really helpful for solving some equations.

## 4.9.4 Some examples

###### Example 4.9.1

Find the complete set of values satisfying the equation $\left\lvert x-2\right\rvert\leqq\left\lvert 2x-6\right\rvert$. 1717 17 This question came from the OCR A June 2019 Single Maths Pure and Mechanics Paper

Solution: We can use the definition $\left\lvert x\right\rvert=\sqrt{x^{2}}$ to rewrite the inequality above as

$\sqrt{(x-2)^{2}}\leqq\sqrt{(2x-6)^{2}}$ (4.75)

Squaring both sides gives the following result

$(x-2)^{2}=(2x-6)^{2}$ (4.76)

which can then be expanded to give

$x^{2}-4x+4\leqq 4x^{2}-24x+36$ (4.77)

and then, being careful not to subtract anything incorrectly (which I always do) the equation can be reduced to this quadratic

$0\leqq 3x^{2}-20x+32$ (4.78)

We can then sketch this to work out when it would be greater than zero (or zero would be less than the curve).

From the graph, the inequality is true whenever $x$ is less than the first time it is zero, and whenever the inequality is greater than the second time it is zero. To find when $3x^{2}-20x+32=0$, we can use the quadratic formula, and thus obtain an equation for the values of $x$.

$x=\frac{20\pm\sqrt{20^{2}-4(3)(32)}}{2(3)}$

Subtracting a positive number from a positive number (note that $\sqrt{20^{2}-4(3)(32)}$ is a positive number) gives a smaller value than adding something to a positive number. Therefore, we can deduce (with aid from a calculator) that the smaller value of $x$ is $\frac{3}{8}$ and the larger value of $x$ is $4$, leaving us with two regions in which the inequality is satisfied.

$x\leqq\frac{3}{8}\text{ and }x\geqq 4$

A slightly harder example: Find the complete set of values satisfying the inequality

$\left\lvert\left\lvert x-1\right\rvert-5\right\rvert<3$
1818 18 This question came from https://madasmaths.com

Solution: This question is a bit fiddly. The first step is to square both sides (which is fine, because the values we’re taking square roots of are always positive).

 $\displaystyle(\left\lvert x-1\right\rvert-5)^{2}<3^{2}$ (4.79) $\displaystyle(x-1)^{2}-10\sqrt{(x-1)^{2}}+25<9$ (4.80) $\displaystyle(x-1)^{2}-10\sqrt{(x-1)^{2}}+16<0$ (4.81)

This is just a quadratic 1919 19 Review the section on hidden quadratics if you’re not sure what this is. TODO: write this section, and we can substitute $z=\sqrt{(x-1)^{2}}$ to get that

 $\displaystyle z^{2}-10z+16<0$ (4.82) $\displaystyle(z-8)(z-2)<0$ (4.83)

We can sketch this graph to work out where the inequality is true 2020 20 The other way to do this is to think about where one of the brackets is positive, and the other negative, but in my experience it’s a more error-prone method.

From the graph, the inequality is true whenever $2 (i.e. $z$ is between the roots).

Thus we have $2<\sqrt{(x-1)^{2}}<8$. This means that both of these inequalities are true:

 $\displaystyle\sqrt{(x-1)^{2}}<8$ (4.84) $\displaystyle\sqrt{(x-1)^{2}}>2$ (4.85)

If we square both sides, we get that

 $\displaystyle(x-1)^{2}<64$ (4.86) $\displaystyle(x-1)^{2}>4$ (4.87)

Here’s a time to be careful; $(x-1)^{2}$ is always positive. When we take the square root, however, we can have either the positive or negative square root. Note that the negative square root is just $-1$ times $\sqrt{\text{whatever}}$, and thus we need to flip the inequality.

Overall then we have these four inequalities.

 $\displaystyle x-1<8$ (4.88) $\displaystyle x-1>-8$ (4.89) $\displaystyle x-1>2$ (4.90) $\displaystyle x-1<-2$ (4.91)

Which can all be arranged to obtain that the following four inequalities must all be true for the inequality to hold

 $\displaystyle x<9$ (4.92) $\displaystyle x>-7$ (4.93) $\displaystyle x>3$ (4.94) $\displaystyle x<-1$ (4.95)

Examining these, it is clear that there are two regions in which this is true: $-7 and $3. This is the complete set of regions which satisfy the inequality. We can write it using set theory notation as

$\left\{-7 (4.96)

where $\cup$ denotes the "union" operator (which means that overall we have the set of objects in either $\left\{-7, $\left\{3, or in both of them - which in this case is nothing, as the two ranges don’t overlap).

###### Example 4.9.2

Solve the equation

$\left\lvert\frac{1}{9}(8t-9)\right\rvert=\left\lvert\frac{1}{3}(2t-11)\right\rvert$ (4.97)

Solution: this can be solved by using the fact that $\left\lvert x\right\rvert=\sqrt{x^{2}}$, but the numbers are not nice, and I made so many arithmetic errors (it was painful). The other way is to think about the definition of the modulus function.

Instead, we can think about the definition of the modulus function. For each side of the equation we have

$\left\lvert\frac{1}{9}\left(8t-9\right)\right\rvert=\begin{cases}\frac{1}{9}% \left(8t-9\right)&\frac{1}{9}\left(8t-9\right)\geqq 0\\ -\frac{1}{9}\left(8t-9\right)&\frac{1}{9}\left(8t-9\right)<0\end{cases}$ (4.98)
$\left\lvert\frac{1}{3}(2t-11)\right\rvert=\begin{cases}\frac{1}{3}(2t-11)&% \frac{1}{3}(2t-11)\geqq 0\\ -\frac{1}{3}(2t-11)&\frac{1}{3}(2t-11)<0\end{cases}$ (4.99)

Thinking about the cases, the graphs can intersect either

• Where the argument to the modulus function is less than zero, and thus has been multiplied by negative one, for both functions.

• Where the argument of one of the functions is less than zero, and the other is greater than zero.

• Where the argument of both functions is greater than zero.

In the first case, the values of $t$ where the two curves intersect would be when

$(-1)\cdot\frac{1}{9}\left(8t-9\right)=(-1)\cdot\frac{1}{3}(2t-11)$ (4.100)

this is just the same as

$\frac{1}{9}\left(8t-9\right)=\frac{1}{3}(2t-11)$ (4.101)

Which is the same equation as for case three.

The only other case is when

$-\frac{1}{9}\left(8t-9\right)=\frac{1}{3}(2t-11)$ (4.102)

Note that it doesn’t matter which one is less than zero (and has thus been multiplied by $-1$), as we can just multiply both sides by $-1$ to get from one to the other.

Thus solving Equation 4.101, we have

 $\displaystyle\frac{1}{9}\left(8t-9\right)=\frac{1}{3}(2t-11)$ (4.103) $\displaystyle 8t-9=3(2t-11)$ (4.104) $\displaystyle 8t-9=6t-33$ (4.105) $\displaystyle 2t=-24$ (4.106) $\displaystyle t=-12$ (4.107)

And solving Equation 4.102 we have

 $\displaystyle-\frac{1}{9}\left(8t-9\right)=\frac{1}{3}(2t-11)$ (4.108) $\displaystyle-(8t-9)=3(2t-11)$ (4.109) $\displaystyle-8t+9=6t-33$ (4.110) $\displaystyle-14t=-42$ (4.111) $\displaystyle t=3$ (4.112)

## 4.9.5 Proof that a value is not greater than its modulus

This is not the most exciting proof, but it helps to illustrate a general principle when proving things about the modulus function: consider the positive and negative cases separately.

###### Example 4.9.3

Let $a\in\mathbb{R}$ (that is, $a$ is a real number). Prove that $a\leqq|a|$.

We would like to show that $a$ is less than or equal to its modulus. Here we can find two exhaustive cases by the law of the excluded middle (see Section 23.4 for details, but it just means that \sayeither something is true, or it is false), that is that either $a\geqq 0$ or $a<0$. If these cases suspiciously mirror the definition2121 21 See Section 4.9.2 if you can’t remember the definition. of the modulus function, that’s because they do.

Why are these cases useful? Because they allow us to assume more about the structure of the modulus function. This comes at a cost - that we have lost generality (that is, we now know more about $a$ but only in specific cases, so we must proceed case-by-case to prove this in general).

We can begin with the first case - the one where $a\geqq 0$. First, we can consider what we know about $|a|$ in this case, which is that $|a|=a$. This is enough to prove the inequality as

 $\displaystyle a$ $\displaystyle\leqq a$ As $a=a$ it is certainly less than or equal to the value of $a$ (4.113) $\displaystyle=|a|$ Which is what we wanted to prove! (4.114)

We must then consider the other case, i.e. when $a<0$ in this case $|a|=-a$, that is $|a|>0$, therefore in this case $a<0<|a|$ which implies that $a<|a|$ and thus that $a\leqq|a|$