# How can we find all inverses of a multivalued function?

How can we find all inverses of a multivalued function using Mathematica?

For example, if we try to find the inverse of $x^2$, Mathematica will say something like this:

In[1]:= f[x_] := x^2

In[2]:= InverseFunction[f][x]

During evaluation of In[2]:= InverseFunction::ifun: Inverse functions are being used. Values may be lost for multivalued inverses.

Out[2]:= -Sqrt[x]

And the other inverse, $\sqrt x$, will be missed. I've found something similar here. But it would be preferable if we can get a set all solutions instead. How can we do this?

My main interest is to find all inverses of the function $\frac{2^{x-1}-1}{x}$. How can we do this?

In[1]:= g[x_] := (2^(x-1)-1)/x

In[2]:= InverseFunction[g][x]

During evaluation of In[2]:= InverseFunction::ifun: Inverse functions are being used. Values may be lost for multivalued inverses.

Out[2]:= (-Log[2]-x ProductLog[-((2^(-1-1/x) Log[2])/x)])/(x Log[2])

In[3]:= h[x_]:=InverseFunction[g][x]

In[4]:= g[5]

Out[4]= 3

In[5]:= N[h[3]]

During evaluation of In[5]:= InverseFunction::ifun: Inverse functions are being used. Values may be lost for multivalued inverses.

Out[5]= -0.18692 // Wrong answer to me, for example
• Reduce[y==x^2,x] finds both inverses. Reduce[y==(2^(x-1)-1)/x,x] finds 2*Infinity inverses. Are there more? There are design decisions made in Mathematica where it will miss individual points in some cases. – Bill May 19 '18 at 20:45
• Very interesting. Can you post this as a solution? Do you know a way to find the correct h(x) where h(3) = 5? The solutions found by mathematica were: $c_1\in \mathbb{Z}\land \left(\left(y=0\land x=1+\frac{2 i \pi c_1}{\log (2)}\right)\lor \left(x\neq 0\land y\neq 0\land x=\frac{-y W_{c_1}\left(-\frac{2^{-\frac{1}{y}-1} \log (2)}{y}\right)-\log (2)}{y \log (2)}\right)\right)$ – GarouDan May 19 '18 at 20:59

As requested

Reduce[y==x^2,x]

finds both inverses.

Reduce[y==(2^(x-1)-1)/x,x]

finds 2*Infinity inverses. Are there more?

There are design decisions made in Mathematica where it will miss individual points in some cases.

If I looked at that result and wanted to find C[1] for x==3 and y==5 I would start with

x==(-Log[2]-y*ProductLog[C[1],-((2^(-1-y^(-1))*Log[2])/y)])/(y*Log[2])/.{x->3,y->5}

and consider the available tools which might solve that for C[1]. I would not necessarily assume that C[1] would be Real. I would carefully study the details tab here ProductLog and cautiously consider which tools might help me correctly find one or perhaps even an infinite number of solutions. But it is not at all obvious to me that you should be able to choose arbitrary numbers for both x and y and find a solution in C[1], particularly since I think Reduce said that C[1] had to be an integer and looking at a handful of values for C[1] don't seem to show there is a Real solution for x==3 and y==5.