# Limit of an inverse function

If I do not go astray, given the function $f : (0,\,4) \to \mathbb{R}$ defined by $f(x) := \frac{2}{x} + \log\sqrt{x}$, it follows that \begin{aligned} \lim_{y \to 2} \frac{f^{-1}(y)-1}{\log(y-1)}\overset{H}{=} \lim_{y \to 2} \frac{\left(f^{-1}\right)'(y)}{\frac{1}{y-1}} = (2-1)\,\left(f^{-1}\right)'(2) = \frac{1}{f'(1)} = -\frac{2}{3} \end{aligned}.

On the other hand, writing:

f = 2/# + Log[Sqrt[#]] &;

Limit[(InverseFunction[f][y] - 1)/Log[y - 1], y -> 2]


I get $\infty$, while writing:

f[x_?(0 < # < 4 &)] = 2/# + Log[Sqrt[#]] &;

Limit[(InverseFunction[f][y] - 1)/Log[y - 1], y -> 2]


I do not get any results. What am I doing wrong?

I believe it is appropriate to do some 'clarity.

Given the function $f : \mathbb{R} \to \mathbb{R}$ defined by $f(x) := \frac{2}{x} + \log\sqrt{x}$, i.e. defining in MMA:

Clear[f]; f[x_] := 2/x + Log[Sqrt[x]]


it is clear that this is not an invertible function and then the following graphs are entirely bogus: Now, given the function $f : (0,\,4) \to \mathbb{R}$ defined by $f(x) := \frac{2}{x} + \log\sqrt{x}$, i.e. defining in MMA:

Clear[f]; f[x_ /; (0 < x < 4)] := 2/x + Log[Sqrt[x]]


it is clear that this is an invertible function and the following graphics correspond to those predicted by theory: In particular, by writing:

InverseFunction[f][2.]


I get $1.$ and by writing:

InverseFunction[f]'[2.]


I get $-0.666667$ confirming the results calculated above (on that there was no doubt of course, just apply the theory). Unfortunately, though, MMA seems to not be able to calculate the limit and that's why I started this thread.

• The L'Hospital's rule is not applicable in the limit under consideration because one has no indeterminacy $\frac 0 0$ as bbgodfrey explains. – user64494 Feb 14 '17 at 15:24
• You are right. Then, maybe, in this case the inverse function $f^{-1}$ is not OK in Mathematica. – user64494 Feb 14 '17 at 15:47
• @Manu I read your moderator flag. I had a little difficulty understanding it, but I took the action that seemed appropriate. Please let me know if I misunderstood you. – Mr.Wizard Feb 15 '17 at 1:31

I have a slightly different approach that might be worth considering for this problem. The solution to the given limit can be found directly by looking at the series expansion of the function around $y=2.$ Generally it is possible to find the inverse of a function's series expansion with InverseSeries. For the function in this problem the series of $f^{-1}\left(y\right)$ around $y=2$ is given by:

InverseSeries[Series[2/x + Log[Sqrt[x]], {x, 1, 4}], y]
(*1-(2 (y-2))/3+14/27 (y-2)^2-4/9 (y-2)^3+(890 (y-2)^4)/2187+O[y-2]^5*)


Now, letting $g\left(y\right) = \frac{f^{-1}\left(y\right)-1}{\log\left(y-1\right)}$, the limit, $\lim_{y \to 2} g\left(y\right)$, can be found with:

Limit[(Normal@InverseSeries[Series[2/x+Log[Sqrt[x]],{x,1,2}],y]-1)/Log[y-1],y->2]
(*-(2/3)*)


Note

• In the limit, the result is independent from the number of terms in the inverse series.

This result can be verified for some series of various orders:

Table[Limit[(Normal@InverseSeries[Series[2/x+Log[Sqrt[x]],{x,1,n}],y]-1)/Log[y-1],y->2],{n,1,10}]
(*{-(2/3),-(2/3),-(2/3),-(2/3),-(2/3),-(2/3),-(2/3),-(2/3),-(2/3),-(2/3)}*)


Diving a bit deeper into the limit shows the independence of the result from the order of the inverse series. Due to the indeterminacy of the limit as $y \to 2$, L'Hospital's is a good choice. If we differentiate the numerator of $g\left(y\right)$ we obtain:

D[InverseSeries[Series[2/x + Log[Sqrt[x]], {x, 1, 3}], y] - 1, y]
(*-(2/3)+(28 (y-2))/27-4/3 (y-2)^2+O[y-2]^3*)


Now looking at the denominator of $g\left(y\right)$ and differentiating:

D[Log[y - 1], y]
(*1/(-1 + y)*)


Putting these two results back together to assembly our new limit:

-(2/3)+(28 (y-2))/27-4/3 (y-2)^2+O[y-2]^3/(1/(1-y))
(*2/3-(10 (y-2))/27+8/27 (y-2)^2+O[y-2]^3*)


We can now take the limit directly to get the expected result:

Limit[-(2/3)+(10 (y-2))/27-8/27 (y-2)^2+O[y-2]^3,y->2]
(*-(2/3)*)


A Numerical Solution

If we are just interested in a numeric result we can directly find the limit using an InverseFunction object. Specifically, using NLimit in the NumericalCalculus package:

Needs["NumericalCalculus"]
NLimit[(InverseFunction[
ConditionalExpression[2/#1 + Log[Sqrt[#1]], 0 < #1 < 4] &][y] -
1)/Log[y - 1], y -> 2]
(*-0.666667*)


Note that in this framework we need to explicitly define the domain of InverseFunction to obtain the correct answer.

• Thank you, very interesting. I take notes and next time I will take it as an option. It would be interesting to know whether this limit can be calculated directly. – TeM Feb 14 '17 at 23:55
• Great, thanks a lot! Inspired by what you wrote, I found that you get the same result by writing: Needs["NumericalCalculus"]; f[x_ /; 0 < x < 4] := 2/x + Log[Sqrt[x]]; NLimit[(InverseFunction[f][y] - 1)/Log[y - 1], y -> 2] Personally I prefer it because it cleaner, but it's essentially the same thing. :) – TeM Feb 15 '17 at 11:34

This seems to be a bug in InverseFunction in your case. Compare the outputs of

Table[{y, FindRoot[y == 2/x + Log[Sqrt[x]], {x, 1}]}, {y, 1.5, 4,  0.1}]


{{1.5, {x -> 1.56883}}, {1.6, {x -> 1.39521}}, {1.7, {x -> 1.26332}}, {1.8, {x -> 1.15844}}, {1.9, {x -> 1.07234}}, {2., {x -> 1.}}, {2.1, {x -> 0.938111}}, {2.2, {x -> 0.884399}}, {2.3, {x -> 0.837231}}, {2.4, {x -> 0.795401}}, {2.5, {x -> 0.757995}}, {2.6, {x -> 0.724304}}, {2.7, {x -> 0.693768}}, {2.8, {x -> 0.665939}}, {2.9, {x -> 0.640453}}, {3., {x -> 0.617011}}, {3.1, {x -> 0.595364}}, {3.2, {x -> 0.575303}}, {3.3, {x -> 0.556652}}, {3.4, {x -> 0.539261}}, {3.5, {x -> 1.}}, {3.6, {x -> 0.507759}}, {3.7, {x -> 0.49344}}, {3.8, {x -> 0.479958}}, {3.9, {x -> 0.46724}}, {4., {x -> 0.455219}}}

and

Table[{y, NSolve[y == 2/x + Log[Sqrt[x]], {x}]}, {y, 1.5, 4, 0.1}]


{{1.5, {{x -> 1.56883}, {x -> 15.5229}}}, {1.6, {{x -> 1.39521}, {x -> 20.1069}}}, {1.7, {{x -> 1.26332}, {x -> 25.6351}}}, {1.8, {{x -> 1.15844}, {x -> 32.3403}}}, {1.9, {{x -> 1.07234}, {x -> 40.497}}}, {2., {{x -> 1.}, {x -> 50.4353}}}, {2.1, {{x -> 0.938111}, {x -> 62.5557}}}, {2.2, {{x -> 0.884399}, {x -> 77.3456}}}, {2.3, {{x -> 0.837231}, {x -> 95.3993}}}, {2.4, {{x -> 0.795401}, {x -> 117.442}}}, {2.5, {{x -> 0.757995}, {x -> 144.357}}}, {2.6, {{x -> 0.724304}, {x -> 177.227}}}, {2.7, {{x -> 0.693768}, {x -> 217.369}}}, {2.8, {{x -> 0.665939}, {x -> 266.396}}}, {2.9, {{x -> 0.640453}, {x -> 326.275}}}, {3., {{x -> 0.617011}, {x -> 399.409}}}, {3.1, {{x -> 0.595364}, {x -> 488.733}}}, {3.2, {{x -> 0.575303}, {x -> 597.832}}}, {3.3, {{x -> 0.556652}, {x -> 731.084}}}, {3.4, {{x -> 0.539261}, {x -> 893.838}}}, {3.5, {{x -> 0.523001}, {x -> 1092.63}}}, {3.6, {{x -> 0.507759}, {x -> 1335.42}}}, {3.7, {{x -> 0.49344}, {x -> 1631.98}}}, {3.8, {{x -> 0.479958}, {x -> 1994.19}}}, {3.9, {{x -> 0.46724}, {x -> 2436.6}}}, {4., {{x -> 0.455219}, {x -> 2976.96}}}}

Maybe, an unappropriate choose of the solution causes it. A workaround is suggested in another answer.

• I do not see any bugs. In fact, using FindRoot[] with {x, x_0} (x_0 > 4) are obtained by the other solutions. The explanation I wrote in my reply. – TeM Feb 15 '17 at 0:03

I believe it is appropriate to do some 'clarity.

1. Given the function $f : (0,\,+\infty) \to \mathbb{R}$ defined by $f(x) := \frac{2}{x} + \log\sqrt{x}$, i.e. defining in MMA:

Clear[f]; f[x_] := 2/x + Log[Sqrt[x]]


your graph is trivially the following: from which it is clear that $f$ is a continuous function but not injective and therefore even invertible in the entire domain. On the other hand, if you appropriately restricts the domain, you can consider two separate injecting and then inverse functions.

As specified in the official guide, in these cases InverseFunction[] can represent only one of the possible inverse function and that remembers him with a warning. In particular, by defining the function generally as shown above, you are obtained by the inverse for $x \ge 4$ and actually writing:

Quiet[InverseFunction[f][2.]]


I get $50.4353$ without any warning. This having been established, for $x \ge 4$ gives the following graphs: 2. Given the function $f : (0,\,4) \to \mathbb{R}$ defined by $f(x) := \frac{2}{x} + \log\sqrt{x}$, i.e. defining in MMA:

Clear[f]; f[x_ /; 0 < x < 4] := 2/x + Log[Sqrt[x]]


on the basis of what has just been said it is evident that it is a continuous function and injective in its own domain, then also invertible. In particular, by writing:

InverseFunction[f][2.]


I get $1.$ without any warning. In the latter case, the respective graphs are as follows: In this other case, also writing:

InverseFunction[f]'[2.]


I get $-0.666667$ confirming that the limit in question is actually equal to $-2/3$ (on that there was no doubt of course, just apply the theory). Unfortunately, though, MMA seems to not be able to calculate the limit and that's why I started this thread.

In light of this, I would say that there is no bug, but it is yet another confirmation that Ferrari is not enough to win a race car, but also need a good driver, which still are not and these are the biggest mistakes in where it is likely to incur. Peace.

You can use ConditionalExpression to choose the branch used by InverseFunction:

if = InverseFunction[ConditionalExpression[2/# + Log[Sqrt[#]], #<4]&];
if


1

Then, you can use Series to obtain your limit:

Series[(if[x]-1)/Log[x-1], {x, 2, 0}] //TeXForm


$-\frac{2}{3}+O\left((x-2)^1\right)$