# Limits of functions that can't be attacked by Taylor series or L'hopital's rule

Often on this site there is posed a question about a limit which is hard to resolve using l'Hopital. (I don't mean probelms asking to find a limit without using 'Lhopital, I mean problems where using l'Hopital leads to roadblocks or subtleties.)

I always attack those posed problems using Taylor series. For limit problems involving functions (as opposed to infinite sums or products) this pretty much always allows the limit to be found -- for the problems people pose here.

I'm interested now in problems of the form "find $\lim_{x\to a}f(x)$" that resist solution by l'Hopital's rule and also by Taylor series methods. I have a fairly contrived example:

$$\lim_{x\to 0}\frac{1-\cos\left(\frac{2}{x+e^{-1/x^2}} \right)}{\sin^2\left(\frac{1}{x}\right)}$$ The combination of the topologist's sin curve in the denominator and the infinitely differentiable but non-analytic $e^{-1/x^2}$ as part of the numerator makes this poison to Taylor series methods, and differentiating the numerator or denominator only makes the behavior worse. Yet the answer for this case is fairly obvious.

My question is, can you find that limit (and prove the value you find is indeed the limit).

And can anybody come up with a less contrived function whose limit resists Tayler series, yet can be found by a different technique?

• $f(x)=\begin{cases}x^2 & x\in\mathbb{Q}\\ 0 & \text{otherwise}\end{cases}$ – vadim123 Sep 12 '16 at 21:33
• By the way, this function utterly defeats Mathematica. – Mark Fischler Sep 12 '16 at 21:35
• Oh goodness, don't break my dream that L'Hospital and Taylor's theorem will solve all my limits! – Simply Beautiful Art Sep 12 '16 at 21:37
• I guess you could tackle it with squeeze theorem if that's possible. – Simply Beautiful Art Sep 12 '16 at 21:45
• I have one technique that sometimes comes in handy for limits with $x\to 0$ or $x \to \infty$. That is to say $y = \frac 1x$ and if $x$ is going to $0$ then $y$ is going to infinity, or vice versa. – Doug M Sep 12 '16 at 22:06

## 3 Answers

You want $\lim_{x\to 0}\frac{1-\cos\left(\frac{2}{x+e^{-1/x^2}} \right)}{\sin^2\left(\frac{1}{x}\right)}$.

First, $e^{-1/x^2} \to 0$ extremely quickly (since $e^z > z^m/m!$ for any $z > 0$ and $m > 0$ from the power series, $e^{-1/x^2} =\frac1{e^{1/x^2}} < m!x^{2m} = O(x^{2m})$ for any $m > 0$), so it can be ignored, giving us $\lim_{x\to 0}\frac{1-\cos\left(\frac{2}{x } \right)}{\sin^2\left(\frac{1}{x}\right)}$.

Since $\sin^2(z) =\frac12(1-\cos(2z))$, this becomes $\lim_{x\to 0}\frac{1-\cos\left(\frac{2}{x } \right)}{\frac12\left(1-\cos\left(\frac{2}{x}\right)\right)} =2$.

And we are done.

• The part about $e^{-1/x^2}$. Could you be more precise, because I could just as easily say $x\to0$ quickly, and so it can also be ignored. Please be more rigorous on that one part please and thank you. – Simply Beautiful Art Sep 12 '16 at 21:58
• I'll add more rigor. – marty cohen Sep 12 '16 at 22:28
• $\sin^2 (1/x) =0$ for $x=1/n \pi$ ($\; n\in N$) so the denominator is $0$ for infinitely many $x$ in any nbhd of $0$. I can also show that for all but finitely many of these $x$, the numerator is not $0$. – DanielWainfleet Sep 12 '16 at 23:05
• The very small $e^{-1/x^2}$ is what causes the massive nonexistence of a limit in this problem. See my answer below. – zhw. Sep 19 '16 at 21:05

There is no hope for a limit in this problem. First, to get rid of the obvious obstacle, we consider the expression only for $x\in A = \mathbb R \setminus \pi\mathbb Z.$ Then we have a bona-fide function $f(x)$ on $A.$ At the endpoints of the intervals $(1/((n+1)\pi), 1/(n\pi))$ we have $f \to \infty.$ Thus $f$ is unbounded in $A\cap (0,\delta)$ for each $\delta > 0.$ This already shows $f$ can't have a finite limit. Could the limit be $\infty?$ No, because for each $n$ there is a unique $x_n> 0$ such that $x_n+e^{-1/x_n^2} = 1/(n\pi).$ By the intermediate value theorem, it follows that for every $\delta > 0,$ $f(A \cap (0, \delta)) =[0,\infty).$

• Thanks a lot man! +1 You found the subtle mistake which I was unable to spot. See my updated answer. – Paramanand Singh Sep 20 '16 at 4:55
• You're welcome. As you pointed out earlier, I had a computational error in my first answer. I edited the answer, and it should be OK now. – zhw. Sep 20 '16 at 14:19

This problem has a certain flaw in it. Suppose the definition of limit is as follows:

Let $f$ be defined in a certain neighborhood of $a$ except possibly at $a$. A number $L$ is said to be the limit of $f$ at $a$ (written $\lim_{x \to a}f(x) = L$) if for any given $\epsilon > 0$ there is a $\delta > 0$ such that $|f(x) - L| < \epsilon$ whenever $0 < |x - a| < \delta$.

Then the function $f$ in question does not possess a limit at $x = 0$ because the function is not defined in any neighborhood of $0$ (think of points $x = 1/n\pi$ where $n$ is non-zero integer).

Suppose the definition of limit is as follows:

Let $A$ be a non-empty subset of $\mathbb{R}$ and let $f:A \to \mathbb{R}$ be a function and further let $a$ be a limit point of $A$. A number $L$ is said to be the limit of $f$ at $a$ (written $\lim_{x \to a}f(x) = L$) if for any given $\epsilon > 0$ there is a $\delta > 0$ such that $|f(x) - L| < \epsilon$ whenever $x \neq a, x \in A, |x - a| < \delta$.

Then the function $f$ in question has a limit at $x = 0$ and the limit is clearly equal to $2$ as explained in the very nice answer from user @marty cohen.

Update: Thanks to the user @zhw who pointed out the flaw in the answer given by marty cohen (which I was unable to detect from a cursory glance of his answer). This incident goes on to show the kind of subtle mistakes which can be made if we are not observant enough. The given function does not tend to a limit even if we take into account the second definition of limit.

The fact that $e^{-1/x^{2}} \to 0$ as $x \to 0$ much faster than any power of $x$ does not imply that it tends to $0$ much faster than any function of $x$. We can see that the given function can be written as $$f(x) = 2\cdot\frac{\sin^{2}(1/(x + e^{-1/x^{2}}))}{\sin^{2}(1/x)}$$ and let's put $z = e^{-1/x^{2}}$ so that $$f(x) = 2\frac{\sin^{2}(1/(x + z))}{\sin^{2}(1/x)}$$ Then $$f(x) - 2 = 2\cdot\frac{\sin^{2}(1/(x + z)) - \sin^{2}(1/x)}{\sin^{2}(1/x)} = -2\frac{z}{x(x + z)}\cdot\frac{\sin 2c}{\sin^{2}(1/x)}$$ (via MVT) where $c$ lies between $1/x$ and $1/(x + z)$. Now note that the factor $\sin 2c$ oscillates between $-1$ and $1$.

The factor $$g(x) = \frac{z}{x(x + z)}\cdot\operatorname{cosec}^{2}(1/x)$$ does not tend to $0$ as it might appear from the presence of $z = e^{-1/x^{2}}$. The reason is that function $h(x)$ which is reciprocal of $g(x)$ is continuous everywhere except $x = 0$. And we can see that $$h(x) = \frac{1}{g(x)} = x(x + z)e^{1/x^{2}}\sin^{2}(1/x)$$ and $h(x)$ vanishes at points $x = 1/n\pi$ and by continuity takes arbitrary small values as $x \to 0$. Hence the function $g(x)$ is unbounded as $x \to 0$ and because of the term $\sin^{2}(1/x)$ it oscillates infinitely. It follows that the overall expression $f(x) - 2$ oscillates infinitely as $x \to 0$.

What we learn from the above is that although $e^{1/x^{2}} \to \infty$ much faster than any power of $1/x$ as $x \to 0$, its growth can be substantially reduced by adding a factor $\sin^{2}(1/x)$ because this factor vanishes many times as $x \to 0$ and it is continuous. And therefore the expression $e^{-1/x^{2}}\operatorname{cosec}^{2}(1/x)$ (which is crucial to this question) is unbounded as $x \to 0$ and oscillates infinitely.

BTW you don't need to construct such complicated examples to get to a function where Taylor series and L'Hospital's rule are not applicable. A simple limit $\lim_{x \to 0}x\sin(1/x)$ also defeats these techniques and is handled very simply via Squeeze theorem.

• Yes, I had in mind the 2nd definition of limit. And I like your simpler example. – Mark Fischler Sep 19 '16 at 2:35
• The limit fails to exist even if we are careful about restricting the expression to an appropriate $A.$ See my answer today. – zhw. Sep 19 '16 at 21:08