# Finding the inverse of $f(x)=|x|-2$

How would I find the inverse of the function $f(x)=|x|-2$? I have swapped $x$ and $y$, and tried to isolate $y$, reaching up to $x+2=|y|$

Whenever I see absolute values, I always break the problem up into cases.

Case $1$: $y\ge 0$, $|y|=y$

$y=x+2$

Case $2$: $y<0$, $|y|=-y$

$-y=x+2$
$\implies y=-x-2$

It doesn't seem right that I get two answers... Am I supposed to combine the two into one piecewise function like:

$$f^{-1}(x)=\begin{cases}x+2, \ x\ge 0 \\ -x-2, \ x<0 \\ \end{cases}$$

Any hints on how to do this?

Also, just to clarify, my homework assignment asks me to "Graph the inverse of $f(x)=|x|-2$"

• You'll have to specify the domain more precisely: Since $f(2) = 0 = f(-2)$, the function is not invertible. – user61527 May 16 '14 at 5:49
• The thing is, the function isn't invertible per se. For instance, both $x=1$ and $x=-1$ produce the same value for $f(x)$, so given $y$, it's impossible to find a single value for $f^{-1}(x)$ (unless $x=0$). – Maroon May 16 '14 at 5:50
• If you want to graph it, you can reflect it across the $y=x$ line. Technically you would then have a function of $y$. – Maroon May 16 '14 at 5:52

A function is defined on a domain, or a set of inputs. When you talk about a function, you have to talk about its domain and its codomain, or the set the function outputs come from. If we have a function $f$, and sets $A$ and $B$, we write the function $f$ from $A$ to $B$ as

$$f:A\to B$$

where $f(x)=|x|-2$.

In this case, the implied domain of your original function is $\mathbf{R}$, or the set of all real numbers. We would write that as

$$f:\mathbf{R}\to \mathbf{R}$$

This function, as Sam said, is not one-to-one, which means that there are outputs which are values at more than one input. As Sam said, this means the function is noninvertible on this domain.

However, as you noticed, if you look at two domains separately ($x \geq 0$ and $x<0$), you can easily find an inverse. Let's define a function g as follows:

$$g:[0,\infty)\to [-2,\infty)$$

where $g(x)=f(x)$ for all $x\in [0,\infty)$. While $f$ was noninvertible, as you figured out, $g$ is invertible, and

$$g^{-1}:[-2,\infty)\to [0,\infty)$$

is given by $g^{-1}(x)=x+2$. We can do a similar thing for the rest of the domain.

$y=|x|-2$ is not one-to-one and hence not invertible. You can easily see this by comparing the values of the function at $-1$ and $1$ or simply drawing its graph: it doesn't pass the horizontal line test.

Another way of inverting functions containing absolute values is to write $|x|=\sqrt{x^2}$.

So you have the function

$$y=f(x)=|x|-2=\sqrt{x^2}-2.$$

If you try to invert it, you get

$$x=\sqrt{y^2}-2\\ \implies x+2=\sqrt{y^2}\\ \implies y^2=(x+2)^2\\ \implies y=\pm\sqrt{(x+2)^2}=\pm|x+2|.$$

Since there are two values of $y$ for each value of $x$, this is not a legitimate function. Also, beware that this manner of inversion has also thrown in some extraneous points not at all associated with the original function. Since the range of the function we started with only incudes real numbers greater than or equal to $-2$, we should restrict the domain of the inverse relation accordingly: $$(x,y=\pm|x+2|)~~~\forall x\geq -2.$$

Maybe your homework is asking to reflect the graph of $|x|-2$ in $y=x$. This won't be a function but it will do the job. Can you guess which graph(s) you want?

• Why would you assume something that is not what the homework is asking? – Thanos Darkadakis May 16 '14 at 12:31
• @ThanosDarkadakis Once you have this, you can manipulate it however to make it a function and find in what domain it is invertible etc. – evil999man May 16 '14 at 19:06