# Is the absolute value function a linear function?

I’m inclined to say yes, as it doesn’t involve exponentiation, roots, logarithmic or trigonometric functions, but I watched a video where the teacher said that the absolute value function is “clearly non-linear”. Why would he say that? Is he wrong?

Wikipedia’s graph for abs:

#### Solutions Collecting From Web of "Is the absolute value function a linear function?"

Linear functions in analytic geometry are functions of the form $f(x)=a\cdot x+b$ for $a,b \in \mathbb{R}$.

Now try to write $\text{abs}(x)$ in such a form.

Another way to see it: linear functions are “straight lines” in the coordinate system (excluding vertical lines), this clearly excludes having a “sharp edge” in the graph of the function like $\text{abs}(x)$ has it for $x=0$.

In linear algebra (and this is the more common definition) linear functions denote ones of the form $f(x)=a\cdot x$ which is equivalent to require $b=0$ in the above definition. As $\text{abs}(x)$ is not linear with the first, weaker definition it cannot be linear either with this definition.

A function $f(x)$ is linear if it satisfies the property
$$f(ax+y) = af(x) + f(y).$$
Let’s try $a=-1$, $x=1$, $y=0$:
\begin{align*} |ax+y| = |-1| &= 1\\ -1\ |1|+|0| &= -1\end{align*},
so $f(x) = |x|$ is not linear.

Sometimes (especially in geometry) “linear” is understood to mean affine. A function $f(x)$ is affine if it satisfies the property
$$f[ax + (1-a)y] = af(x) + (1-a)f(y).$$
Once again let’s try $a=-1$, $x=1$, $y=0$:
\begin{align*} |ax+(1-a)y| = |-1| &= 1\\ af(x)+(1-a)f(y) = -1\ |1| + 2\cdot 0 &= -1,\end{align*}
so $|x|$ isn’t affine either.

I would simply define a linear function as always having the same slope (and, more technically, it must be continuous).

Clearly, the absolute value function has a negative slope for values < 0 and positive slope for values > 0. So it’s not linear.

Think of the definition of absolute value. It is a piecewise defined function.
|x| = x, if x>=0 and -x if x<0. In other words, the graph of y=|x| is formed by two pieces of two lines. For the part of the domain where x-values are less than zero, the graph corresponds to the graph of y=-x. For parts of the domain where x-values are greater than or equal to zero, the graph corresponds to the graph of y=x. While the absolute value function does not satisfy the above definitions for linear functions, it is actually “parts” of two linear functions.