# L'Hôpital's rule does not apply?!

Apparently, Rogawski's Calculus for AP contains the following problem:

108. Explain why L'Hôpital's rule does not apply to

$$\lim_{x\rightarrow 0}\frac{x^2\sin\frac{1}{x}}{\sin x}$$

It seems to me that it does apply:

The L'Hôpital's rule says: if $\lim_{x\rightarrow c}f(x)=\lim_{x\rightarrow c}g(x)=0$ and both $f$ and $g$ are differentiable at $x=c$ and $g'(c)\ne 0$, then $\lim_{x\rightarrow c}\frac{f(x)}{g(x)}$ exists and is equal to $\frac{f'(c)}{g'(c)}$. (Note that nothing is assumed about differentiability of $f$ and $g$ other than at $x=c$).

1. Define the numerator $f(x)=x^2\sin\frac{1}{x}$ to be $f(0)=0$ at $x=0$. Now, both numerator $f$ and denominator $g(x)=\sin(x)$ are continuous at $x=0$ and their values are $f(0)=g(0)=0$.

2. The numerator $f$ is differentiable at $x=0$ and the derivative is $f'(0)=0$ (the derivative itself is discontinuous at 0, but that is irrelevant - even the existence of the derivative at any point other than 0 does NOT matter). One can see that from the definition of the derivative: $f'(0)=\lim_{h\rightarrow 0} \frac{h^2\sin\frac{1}{h}}{h} = \lim_{x\rightarrow 0} h\sin\frac{1}{h} = 0$ (see PS step 2 below).

3. The denominator $g$ is differentiable at $x=0$ and the derivative is $g'(0)=\cos 0=1$.

4. Thus the limit is $\frac{0}{1} = 0$.

What am I missing?

PS. Note that I am not asking why the limit is 0. That can be easily seen without L'Hôpital:

1. $\lim_{x\rightarrow 0}\frac{x}{\sin x} = 1$: this is the inverse of the standard limit $\lim_{x\rightarrow 0}\frac{\sin x}{x} = 1$.

2. $\lim_{x\rightarrow 0} x \sin\frac{1}{x} = 0$ because $\sin\frac{1}{x}$ is bounded and $\lim_{x\rightarrow 0} x = 0$, this follows from Squeeze theorem.

3. the Product Rule for Limits implies that $$\lim_{x\rightarrow 0}\frac{x^2\sin\frac{1}{x}}{\sin x} = \lim_{x\rightarrow 0}x\sin\frac{1}{x} \times \lim_{x\rightarrow 0}\frac{x}{\sin x} = 0 \times 1 = 0$$

PPS Here is the scan from the textbook:

• It does not apply because of the term $\sin(1/x)$. Commented Nov 28, 2016 at 19:44
• @AlanTuring: why does a "term" prevent a theorem from being applicable? :-) I mean, this is more or less what my daughter's teacher said, but this makes no sense. IOW, what step in my logic is wrong?
– sds
Commented Nov 28, 2016 at 19:47
• math.stackexchange.com/questions/534090/… Commented Nov 28, 2016 at 19:48
• Note that L'Hospital's rule says that $\lim\limits_{x\to 0} \frac{f(x)}{g(x)} = \lim\limits_{x\to 0} \frac{f'(x)}{g'(x)}$ if a) $f(x) = g(x) = 0$ and b) the limit of the quotients of the derivatives exists. b) isn't fulfilled here. Commented Nov 28, 2016 at 19:48
• Nope. Since $f'$ isn't continuous at $0$, the existence of $\frac{f'(0)}{g'(0)}$ doesn't imply the existence of the limit. Commented Nov 28, 2016 at 19:50

You have misstated L'Hopital's Rule. It does not say $\lim_{x\to c}{f(x)\over g(x)}={f'(c)\over g'(c)}$ (with the usual assumptions on $\lim_{x\to c}f(x)$ and $\lim_{x\to c}g(x)$). It says

$$lim_{x\to c}{f(x)\over g(x)}=\lim_{x\to c}{f'(x)\over g'(x)}$$

provided the latter limit exists. In this case

$${f'(x)\over g'(x)}={2x\sin(1/x)-\cos(1/x)\over\cos x}$$

for $x\not=0$. So even though $f'(0)=\lim_{x\to0}{f(x)-f(0)\over x}=\lim_{x\to0}x\sin(1/x)=0$ (assuming we let $f(0)=\lim_{x\to0}f(x)=0$), the hypotheses of L'Hopital's Rule are not fulfilled because $\lim_{x\to0}(f'(x)/g'(x))$ does not exist. In particular $\cos(1/x)$ has no limit as $x\to0$.

• The problem doesn't even state that $f(0)=0$ though, I think that as written, you can just say $f$ is not defined and therefore notdifferentiable at $0$, and you're done.
– Ovi
Commented Nov 29, 2016 at 1:05
• Started to write the same thing, but saw you came to the exact point about the existence.
– A.Γ.
Commented Nov 29, 2016 at 1:07
• @Ovi The function is differentiable after being defined $f(0)=0$, so it is not a problem. The very problem is that the limit of $f'/g'$ does not exist.
– A.Γ.
Commented Nov 29, 2016 at 1:09
• @A.G. I completely agree, but I don't see any indication in the problem that they expect us to assume $f(0) = 0$. It just says $\lim_{x \to 0} \dfrac {x^2 \sin \dfrac 1x}{\sin x}$
– Ovi
Commented Nov 29, 2016 at 1:11
• @Ovi The function $x^2\sin(1/x)$ is the very known example of being differentiable at the origin. It is about the same as to have $f(x)=x^2$, $x\ne 0$. There is no question how to define it at $x=0$.
– A.Γ.
Commented Nov 29, 2016 at 1:17

The proof of l'Hopital that the book uses is probably based on the extended mean value theorem, $$\frac{f(x)-f(c)}{g(x)-g(c)}=\frac{f'(\tilde x)}{g'(\tilde x)}$$ for some $\tilde x$ between $c$ and $x$. This way of replacing the limit with a limit allows to apply the theorem repeatedly. It ignores that one can also reformulate it as a quotient of difference quotients, $$\lim_{x\to c}\frac{f(x)-f(c)}{g(x)-g(c)}=\frac{\lim_{x\to c}\frac{f(x)-f(c)}{x-c}}{\lim_{x\to c}\frac{g(x)-g(c)}{x-c}}=\frac{f'(c)}{g'(c)}$$ which exists if both functions are differentiable at $x=c$ and $g'(c)\ne0$.

Now when the derivatives are not continuous, one can not conclude about the limit as the book expects. Thus the explored situation is not covered by the assumptions of the used theorem.

In general I find it often more instructive to use the mean value theorem (or Taylor expansion) than l'Hopital.

• l'Hopital does NOT require the existence of the derivatives in the neighborhood - just at the limit point.
– sds
Commented Nov 28, 2016 at 19:50
• Please explain the recent down-voting after I edited to conform to the results of the discussion in the comments to the question. Commented Nov 29, 2016 at 10:31
• I replaced my old downvote with an upvote.
– sds
Commented Nov 29, 2016 at 13:42
• @sds L'Hopital's rule does require that f'/g' to be definen on a set S=J\{a}, where J is an open interval containing a. Otherwise the limit makes no sense. Limits do not exist at isolated points.
– Ovi
Commented Nov 29, 2016 at 17:22
• @Ovi: we rehashed this yesterday.
– sds
Commented Nov 29, 2016 at 17:31

The problem is your $f(x) = x^2 \sin \dfrac 1x$ is not differentiable at $0$, because $f$ is not even defined at $0$. A definition of the derivative is $\lim_{x \to a} \dfrac {f(x) - f(a)}{x-a}$, so as you can see it is required that $f$ be defined at $a$.

• no, $f$ is differentiable everywhere (although the derivative is discontinuous at 0). Moreover, this is the canonical example of such a function.
– sds
Commented Nov 29, 2016 at 0:54
• @sds Not the way you wrote it. If you define $f(0)$ as $0$ then yes, it is differentiable at $0$. But just $x^2 \sin \dfrac 1x$ is not defined at $0$ so it can't be differentiable there.
– Ovi
Commented Nov 29, 2016 at 1:02
• What Ovi said. It's not ok to just give functions values at points outside their domains, even if those values are the "obvious" choices. Then they just become different functions..
– user307169
Commented Nov 29, 2016 at 12:34