# Understanding the counterexamples to L'Hopital's Rule

Wiki provides a counterexample limit that fails with L'Hopital's Rule, because it doesn't satisfy the $$g'(x) \ne 0$$ rule they provide earlier.

Let $$f(x)=x+\sin x \cos x$$ and $$g(x)=f(x)e^{\sin x}.$$ Then there is no limit for $$f(x)/g(x)$$ as $$x\to\infty$$ However,

\begin{align} \frac{f'(x)}{g'(x)} &= \frac{2\cos^2 x}{(2 \cos^2 x) e^{\sin x} + (x+\sin x \cos x) e^{\sin x} \cos x} \\[4pt] &= \frac{2\cos x}{2 \cos x +x+\sin x \cos x} e^{-\sin x}, \end{align}

which tends to 0 as $$x\to\infty$$.

My question: is it possible to construct a counterexample where $$x$$ goes to a real number, rather than infinity? Or does approaching a real number protect you from failing in the $$g'(x) = 0$$ case.

• Maybe $\dfrac{x^2\sin(1/x)}{\sin(x)}$ when $x\to0$. Commented Jan 12, 2022 at 6:25
• @Mikasa $\lim_{x\to 0} \frac{f'(x)}{g'(x)}$ doesn't exist, so it isn't a counterexample (which demonstrates why $g'(x)\ne 0$ is necessary).
– Snaw
Commented Jan 12, 2022 at 7:03

Consider $$f_1(x)\equiv f\circ h(x)\\ g_1(x)\equiv g\circ h(x)\\ h(x)\equiv (x-a)^{-2},a\in\mathbb R,$$ where $$f$$ and $$g$$ are defined as in your counterexample. Then there is no limit for $$f_1(x)/g_1(x)$$ as $$x\rightarrow a$$ but L'Hopital's rule imputes a limit of zero.