# The absolute value function

The absolute value function is a function defined by parts: $$|x|=\left\{\begin{array}{rcl} x & \mbox{ if } & x \geq 0 \\ -x & \mbox{ if } & x<0 \end{array}\right.$$$Its domain $$Dom(f)=\mathbb{R}$$ and its image $$Im(f)=[0,+\infty)$$. Let's consider the function $$f(x)=|2x-1|$$. To represent it graphically, first, we will have to express it as a function defined by parts: $$f(x)=|2x-1|=\left\{\begin{array}{rcl} 2x-1 & \mbox{ if } & 2x-1 \geq 0 \\ -(2x-1) & \mbox{ if } & 2x-1 < 0 \end{array}\right.=\left\{\begin{array}{rcl}2x-1 & \mbox{ if } & \displaystyle x\geq \frac{1}{2}\\ 1-2x & \mbox{ if } & \displaystyle x<\frac{1}{2}\end{array}\right.$$$ Now we can already represent it graphically considering, for example, points $$0,\displaystyle \frac{1}{2}$$ and $$1$$:

 $$x$$ $$f(x)$$ $$0$$ $$1$$ $$\displaystyle \frac{1}{2}$$ $$0$$ $$1$$ $$1$$

Therefore the function is (let's remember that only we need two points to represent a straight line):