TITLE: Conditions for l'Hôpital's rule
QUESTION [5 upvotes]: According to l'Hôpital's rule, given functions $f,g$ which are differentiable around $a\in \mathbb R$, such that --

$\lim_{x\to a} f(x)=\lim_{x\to a}g(x)=0$
$g'(x)\neq 0$ on some deleted neighborhood of $a$.
$\lim_{x\to a} {\frac {f'(x)}{g'(x)} }$ exists (widely).

Then  $\ \ \lim_{x\to a} {\frac {f(x)}{g(x)} } = \lim_{x\to a} {\frac {f'(x)}{g'(x)} }$.
Condition 2 is necessary for the proof, but I can't find a counterexample for the theorem without it. Could you give an example of differentiable functions $f,g$ aroud $a$, such that conditions 1,3 hold, but 
$\ \ \lim_{x\to a} {\frac {f(x)}{g(x)} } \neq \lim_{x\to a} {\frac {f'(x)}{g'(x)} }$?

REPLY [4 votes]: Condition (2) is present not simply to ensure existence of $\lim f'(x)/g'(x).$  
One can construct counterexamples where condition (2) is violated but $f'(x)$ and $g'(x)$ share a common factor -- such that $\lim f'(x)/g'(x)$ exists but $\lim f(x)/g(x)$ fails to exist.
Stolz produced such a counterexample for the case where $f(x), g(x) \to \infty$ as $x \to a = \infty$. Specifically,
$$f(x) = \int_0^x \cos^2(t) \, dt \\ g(x) = f(x)\exp ( \sin x).$$