# Find the inverse of a piece-wise continuous function

I have the following piecewise continuous function:

$$f(x)=\begin{cases}3x+1,~x\gt 0\\2-x^2,~x\leq 0\end{cases}$$

and I need to find its right inverse.

Thus far I got that

$$g(x)=\begin{cases}\dfrac{x-1}{3},~x\gt 1\\ \\ \sqrt{2-x},~x\leq 2\end{cases}$$

but what can I do when I have an intersection? For example, if $x = 2$, along which branch will it go?

Therefore, I write my inverse function like this:

$$g(x)=\begin{cases}\dfrac{x-1}{3},~x\gt 1\\ \\ \sqrt{2-x},~x\leq 1\end{cases}$$

Is this approach and final function valid?

• What exactly do you mean by "right inverse"? That function is not one-to-one so it certainly does not have an inverse (over the entire range at least). Apr 18, 2015 at 18:12
• $f(x)$ looks like this. It is not injective, so it does not have an inverse function with domain $\mathbb R$. Apr 18, 2015 at 18:21
• Note that only bijective functions are invertible. Apr 19, 2015 at 7:55
• @Prasun I wasn't asking for a 2 sided inverse. I need to find the right inverse. And a function has a right inverse if and only if it's surjective (It does not have to be injective) Apr 19, 2015 at 10:26
• @KeykoYume, what exactly do you mean by "right inverse" ? Apr 19, 2015 at 13:13

Note: OPs approach is almost correct. The details below should help to clarify open aspects.

According to OPs question, we want to find a right inverse of the function $f$.

Let $u:X\rightarrow Y$ be a function. A function $w:Y\rightarrow X$ is a right inverse for $u$, if \begin{align*} u\circ w = \text{id}_Y, \qquad i.e.\qquad u(w(y))=y \quad \forall y \in Y \end{align*}

In order to obtain a right inverse the function has to be surjective.

Let's have a look at some aspects of the function $f:\mathbb{R}\rightarrow \mathbb{R}$ with \begin{align*} f(x)=\begin{cases} 3x+1&~x> 0\\ 2-x^2&~x\leq 0 \end{cases}\tag{1} \end{align*}

• domain and codomain

We have added the domain $\mathbb{R}$ and codomain $\mathbb{R}$ in order to fully specify the function $f$. This can be crucial for determination of a right inverse function, as we will see in a note at the end of the answer.

• $f$ is not injective

We see that e.g. $f(0)=2=f(\frac{1}{3})$. In $f((-1,\frac{1}{3}])$ there is more than one candidate for a right inverse function $g$.

• $f$ is not continuous at $x=0$

Since \begin{align*} \lim_{x\rightarrow 0^+}f(x)&=\lim_{x\rightarrow 0^+}(3x+1)=1\\ \lim_{x\rightarrow 0^-}f(x)&=\lim_{x\rightarrow 0^-}(2-x^2)=2\\ \\ f(0)&=2-0^2=2\\ \end{align*} we see that the left-hand limit at $x=0$ is equal to $f(0)=2$ while the right-hand limit at $x=0$ is different. So $f$ is not continuous at $0$.

Let's now determine a right inverse function $g$. We choose similarly to OP a function $g:\mathbb{R}\rightarrow\mathbb{R}$ with \begin{align*} g(x)= \begin{cases} \dfrac{x-1}{3}&~x> 1\\ \tag{2}\\ -\sqrt{2-x}&~x\leq 1 \end{cases} \end{align*}

If $x>1$ we see that $g(x)=\frac{x-1}{3}>0$. Therefore we get \begin{align*} f(g(x))=f\left(\frac{x-1}{3}\right)=3\left(\frac{x-1}{3}\right)+1=x \end{align*}

If $x\leq 1$ we see that $g(x)=-\sqrt{2-x}\leq 0$. Therefore we get \begin{align*} f(g(x))=f\left(-\sqrt{2-x}\right)=2-\left(-\sqrt{2-x}\right)^2=2-(2-x)=x\tag{3} \end{align*}

Since $f\circ g=id_\mathbb{R}$ for all $x\in \mathbb{R}$ the function $g$ is a right inverse for $f$.

We take in (3) the negative square root $-\sqrt{2-x}$. This implies that $g(x)=-\sqrt{2-x}\leq 0$ and we can use the branch $f(x)=2-x^2$.

In general the right inverse function is not unique. Since $f$ is not injective, we can select another right inverse function $h$ for $f$.

We define $h:\mathbb{R}\rightarrow\mathbb{R}$ with \begin{align*} h(x)= \begin{cases} \dfrac{x-1}{3}&~x> 2\\ \\ -\sqrt{2-x}&~x\leq 2 \end{cases} \end{align*}

If $x>2$ we see that $h(x)=\frac{x-1}{3}>0$. Therefore we get \begin{align*} f(h(x))=f\left(\frac{x-1}{3}\right)=3\left(\frac{x-1}{3}\right)+1=x \end{align*}

If $x\leq 2$ we see that $h(x)=-\sqrt{2-x}\leq 0$. Therefore we get \begin{align*} f(g(x))=f\left(-\sqrt{2-x}\right)=2-\left(-\sqrt{2-x}\right)^2=2-(2-x)=x\tag{3} \end{align*}

Since $f\circ h=id_\mathbb{R}$ for all $x\in \mathbb{R}$ the function $h$ is also a right inverse for $f$.

Since $g(2)=\frac{1}{3}$ and $h(2)=0$ the right inverse functions are not identical.

Note: It's relevant to specify domain and codomain of a function to determine a right inverse function for it. Consider the functions \begin{align*} &u:\mathbb{R}\rightarrow\mathbb{R}\qquad&v:\mathbb{R}\rightarrow[0,\infty)\\ &u(x)=x^2&v(x)=x^2 \end{align*} We see that $u(x)=v(x)=x^2$, but $u$ is not surjective as opposed to $v$. Therefore $v$ has a right inverse and $u$ has no right inverse.

• @KeykoYume: Thanks a lot for accepting the answer and granting the bounty. Best regards, May 1, 2015 at 21:16
• thank you for answering my question. I have finally managed to understand it. May 2, 2015 at 9:34