# InverseFunction fails to invert $e^{-x/2}-e^{x/2}$

I need to invert a function. I want to isolate the x basically. By the looks of the graphic I plotted, the function seems to be invertible, however when I call InverseFunction it doesn't return an output.

Here is my code:

g[x_] := E^(-x/2) - E^(x/2)
Plot[g[x], {x, -100, 100}, PlotRange -> All]
InverseFunction[g[x]]


InverseFunction operates on an abstract function, yielding an abstract, anonymous function. g[x] is not a function, but a formula. Just leave out [x].

On 11.3, MacOS:

InverseFunction[g]
(* 2 Log[1/2 (-#1 - Sqrt[4 + #1^2])] & *)


Unfortunately, although it's an inverse, this doesn't appear to be the branch you want.

More:

You can get @Henrik Schumacher's answer mindlessly by manipulating the defining expression for g (using = to evaluate before defining):

g[x_] = E^(-x/2) - E^(x/2) // ExpToTrig
(* -2 Sinh[x/2] *)


This coaxes InverseFunction onto the branch you probably want:

InverseFunction[g]
(* -2 ArcSinh[#1/2] & *)

• Hello John, using this code the return I obtain is just g^(-1).
– MarV
Jul 21, 2018 at 13:04
• Hello John, can you send me your full code? For the first branch you calculated.
– MarV
Jul 21, 2018 at 13:26
• In a fresh kernel, g[x_] := E^(-x/2) - E^(x/2); ginv=InverseFunction[g]. g[ginv[y]] // FullSimplify yields y, but ginv[g[y]] winds up on the wrong branch. Jul 21, 2018 at 13:49
• Thank you! I solved it manually and then it became clearer in the code. Now it works!
– MarV
Jul 30, 2018 at 13:56

Your function g is equal to -2 Sinh[x/2]:

g[x_] := E^(-x/2) - E^(x/2);
FullSimplify[-2 Sinh[x/2] == g[x]]


True

So you are looking for

ginv[y_] := -2 ArcSinh[y/2]

• Hello Henrik! That is a life saver, how did you figure that out? Is there any principle or rule? If possible do you have time to explain how -2 Sinh[x/2] == g[x]?
– MarV
Jul 21, 2018 at 13:01
• No principle behind that. Basically, Sinh[x] == (E^x - E^-x)/2 is the definition of the sinus hyperbolicus. Jul 21, 2018 at 13:04
• g[x] // ExpToTrig Jul 21, 2018 at 13:10

Here's another way to get the correct inverse function using Solve, which allows me to specify that the function is defined on the real axis:

Clear[x, y];
g[x_] := E^(-x/2) - E^(x/2)

gInverse[y_] = ExpToTrig[x /. First@Solve[g[x] == y, x, Reals]]

(* ==> -2 ArcSinh[y/2] *)