# What is the mathematical approach of inversing a function resulting in a piece-wise solution?

I've been trying to find the inverse of $$f(x) = e^{-\left(\displaystyle \frac{x}{\sqrt{1-x^2}}\right) \displaystyle \pi }$$

Here are my steps \begin{align} x & = e^{-\left(\displaystyle \frac{y}{\sqrt{1-y^2}}\right) \displaystyle \pi }\\\\ \displaystyle \ln(x) & = \left(\displaystyle -\frac{y\pi}{\sqrt{1-y^2}}\right) \\\\ \displaystyle \left(\ln(x)\right)^2 & = \left(\displaystyle -\frac{y\pi}{\sqrt{1-y^2}}\right)^2 \\\\ \displaystyle \ln^2(x) & = \displaystyle \frac{y^2\pi^2}{1-y^2} \\\\ \displaystyle \ln^2(x) - \ln^2(x) y^2 & = y^2\pi^2 \\\\ \displaystyle \ln^2(x) & = y^2\left[\pi^2 + \ln^2(x)\right] \\\\ \displaystyle y^2 & = \frac{ \ln^2(x)} {\pi^2 + \ln^2(x)} \\\\ \displaystyle y & = \pm \sqrt{ \frac{\ln^2(x)} {\pi^2 + \ln^2(x)} }\\\\ \displaystyle f^{-1}(x) & = \pm \sqrt{ \frac{\ln^2(x)} {\pi^2 + \ln^2(x)} }\\\\ \end{align}
Now by looking into the graph that I've been made on desmos

By looking at the orange and purple line, I can conlude the result $$f^{-1}(x) = \begin{cases} \hfill \sqrt{ \frac{\ln^2(x)} {\pi^2 + \ln^2(x)} } \hfill & {\text{if}}\ 01 \\ \hfill \text{undefined}\ \hfill & \text{if else} \\ \end{cases}$$

Now, without graphical approach, how do I find the piece-wise result?

First things first: Do not use the letter $$x$$ as independent variable of both $$f$$ and $$f^{-1}$$ as long as you study $$f$$ and $$f^{-1}$$ at the same time! Write $$f^{-1}(y)=\ldots$$ instead! This recommendation has nothing to do with the definitions of functions and inverses; it is just about letters. (Unfortunately there is no clear cut notion of "variable" in analysis; but this is another matter.)
The function $$f$$ is obviously defined for $$-1. It is the composition $$f=h\circ g$$ of the functions $$g:\quad x\mapsto u={x\over\sqrt{1-x^2}}\qquad{\rm and}\qquad h:\quad u\mapsto y:=e^{-\pi u}\ .\tag{1}$$ The function $$g$$ can be viewed as $$g=\tan\circ\arcsin$$, hence is strictly increasing, and maps $$\>]{-1},1[\>$$ bijectively to $${\mathbb R}$$. The function $$h$$ is strictly decreasing, and maps $${\mathbb R}$$ bijectively to $${\mathbb R}_{>0}$$. It follows that $$f=h\circ g:\ ]{-1},1[\>\to{\mathbb R}_{>0}$$ is a decreasing bijective map, and has a well defined inverse $$f^{-1}\!:\ {\mathbb R}_{>0}\to\>]{-1},1[\>$$. No multivaluedness whatsoever will arise.
From $$u^2(1-x^2)=x^2$$ we obtain $$x^2={u^2\over1+u^2}$$, hence $$x=\pm{u\over\sqrt{1+u^2}}\ .$$ At this point we can definitively resolve the $$\pm$$-ambiguity by inspection of $$(1)$$: The variables $$x$$ and $$u$$ have the same signs at all times, since $$\sqrt{1-x^2}$$ is $$\geq0$$ by definition. It follows that $$x={u\over\sqrt{1+u^2}}\ .\tag{2}$$ On the other hand, from $$y=e^{-\pi u}$$ we immediately obtain $$u=-{1\over\pi}\log y\ .\tag{3}$$ Coupling $$(2)$$ and $$(3)$$ together we get $$x=f^{-1}(y)={-{1\over\pi}\log y\over\sqrt{1+({1\over\pi}\log y)^2}}={-\log y\over\sqrt{\pi^2+(\log y)^2}}\qquad(y>0)\ ,$$ without any cases and ambiguities.
• Why can't I use $x$ as independent variable of $f^{-1}$? It confuses me a lot. If you take a look at this graph that I've just made, it is weird. You can see the desmos in here. Also, by plugging some value, for example $f^{-1}(0.1)$ should be +0.5911 and not -0.5911. I was expecting the black lines to be the inverse function. – Unknown123 Oct 14 at 15:04
• Okay, I haven't realized that you've already edited it. Now, my last question. Could you conclude that $f(x)$ doesn't have multivalued inverse and invertible? Because, without using function composition approach, I think the result would be multivalued inverse and not invertible as I've stated in my question $$\displaystyle f^{-1}(x) = \pm \sqrt{ \frac{\ln^2(x)} {\pi^2 + \ln^2(x)} }$$ – Unknown123 Oct 15 at 3:49
• Thank you very much for your help and patience, that was clever way use of function composition. I'm impressed how can you view it directly. I've just found derivation of your view socratic.org/questions/how-do-you-solve-tan-sin-1x-x-sqrt-1-x-2 It also can be viewed as $g=\cot\circ\arccos$ Thank you once again – Unknown123 Oct 15 at 14:07