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 |x|\left\lvert x\right\rvert. For example, all of these expressions are true

|12|=12\displaystyle\left\lvert 12\right\rvert=12
|12|=12\displaystyle\left\lvert-12\right\rvert=12
|126|=|612|\displaystyle\left\lvert 12-6\right\rvert=\left\lvert 6-12\right\rvert
|x|=x\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=|(x5)2+1|y=\left\lvert-\left(x-5\right)^{2}+1\right\rvert, the graph of y=2x8y=2x-8 would look like this:

3.53.5444.54.5555.55.5666.56.5773-32-21-111xxf(x)f(x)y=(x5)2+1y=-\left(x-5\right)^{2}+1

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=4x=4 and x=6x=6. Therefore, everything to the left of 44 and to the right of 55 needs to be reflected it the xx-axis.

3.53.5444.54.5555.55.5666.56.577112233xxf(x)f(x)y=|(x5)2+1|y=\left\lvert-\left(x-5\right)^{2}+1\right\rvert

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

|x|={xx01xx<0\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 xx (the input to the modulus function) is bigger than zero, we just return xx. If xx is smaller than zero, we multiply it by 1-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 x2\sqrt{x^{2}} when we square xx, both xx and x-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.

|x|=x2\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 |x2||2x6|\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 |x|=x2\left\lvert x\right\rvert=\sqrt{x^{2}} to rewrite the inequality above as

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

Squaring both sides gives the following result

(x2)2=(2x6)2(x-2)^{2}=(2x-6)^{2} (4.76)

which can then be expanded to give

x24x+44x224x+36x^{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

03x220x+320\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).

2.22.22.42.42.62.62.82.8333.23.23.43.43.63.63.83.8444.24.24.44.44.64.64.84.855224466xxf(x)f(x)3x220x+323x^{2}-20x+32

From the graph, the inequality is true whenever xx 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 3x220x+32=03x^{2}-20x+32=0, we can use the quadratic formula, and thus obtain an equation for the values of xx.

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

Subtracting a positive number from a positive number (note that 2024(3)(32)\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 xx is 38\frac{3}{8} and the larger value of xx is 44, leaving us with two regions in which the inequality is satisfied.

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

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

||x1|5|<3\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).

(|x1|5)2<32\displaystyle(\left\lvert x-1\right\rvert-5)^{2}<3^{2} (4.79)
(x1)210(x1)2+25<9\displaystyle(x-1)^{2}-10\sqrt{(x-1)^{2}}+25<9 (4.80)
(x1)210(x1)2+16<0\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=(x1)2z=\sqrt{(x-1)^{2}} to get that

z210z+16<0\displaystyle z^{2}-10z+16<0 (4.82)
(z8)(z2)<0\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.

1.51.5222.52.5333.53.5444.54.5555.55.5666.56.5777.57.5888.58.5995-555xxf(x)f(x)z210z+16z^{2}-10z+16

From the graph, the inequality is true whenever 2<z<82<z<8 (i.e. zz is between the roots).

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

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

If we square both sides, we get that

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

Here’s a time to be careful; (x1)2(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-1 times whatever\sqrt{\text{whatever}}, and thus we need to flip the inequality.

Overall then we have these four inequalities.

x1<8\displaystyle x-1<8 (4.88)
x1>8\displaystyle x-1>-8 (4.89)
x1>2\displaystyle x-1>2 (4.90)
x1<2\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

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

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

{7<x<1}{3<x<9}\left\{-7<x<-1\right\}\cup\left\{3<x<9\right\} (4.96)

where \cup denotes the "union" operator (which means that overall we have the set of objects in either {7<x<1}\left\{-7<x<-1\right\}, {3<x<9}\left\{3<x<9\right\}, 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

|19(8t9)|=|13(2t11)|\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 |x|=x2\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

|19(8t9)|={19(8t9)19(8t9)019(8t9)19(8t9)<0\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)
|13(2t11)|={13(2t11)13(2t11)013(2t11)13(2t11)<0\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 tt where the two curves intersect would be when

(1)19(8t9)=(1)13(2t11)(-1)\cdot\frac{1}{9}\left(8t-9\right)=(-1)\cdot\frac{1}{3}(2t-11) (4.100)

this is just the same as

19(8t9)=13(2t11)\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

19(8t9)=13(2t11)-\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-1), as we can just multiply both sides by 1-1 to get from one to the other.

Thus solving Equation 4.101, we have

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

And solving Equation 4.102 we have

19(8t9)=13(2t11)\displaystyle-\frac{1}{9}\left(8t-9\right)=\frac{1}{3}(2t-11) (4.108)
(8t9)=3(2t11)\displaystyle-(8t-9)=3(2t-11) (4.109)
8t+9=6t33\displaystyle-8t+9=6t-33 (4.110)
14t=42\displaystyle-14t=-42 (4.111)
t=3\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 aa\in\mathbb{R} (that is, aa is a real number). Prove that a|a|a\leqq|a|.

We would like to show that aa 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 a0a\geqq 0 or a<0a<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 aa 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 a0a\geqq 0. First, we can consider what we know about |a||a| in this case, which is that |a|=a|a|=a. This is enough to prove the inequality as

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

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