Non-vanishing of derivative hypothesis in l'Hospital's rule I'm teaching first semester calculus and trying to find a way to explain why each hypothesis in l'Hostpial's rule is needed.
If $f$ and $g$ are real differentiable functions on an interval containing a point $c$ then there are three hypotheses one needs to check in order to apply l'Hospitals rule to compute $\lim_{x \to c} f(x)/g(x)$ :


*

*$g'(x) \neq 0$ on a neighborhood of $c$, (the wikipedia page misses this)

*$\lim_{x \to c} f'(x)/g'(x)$ exists (in the extended sense including $\pm \infty$),

*Either $\lim_{x \to c} g(x) = \pm \infty$ or $\lim_{x \to c} f(x) = \lim_{x \to c} g(x) = 0$.


What I am looking for is a pair of functions $f$ and $g$ so that 2 and 3 both hold and you can reasonably compute $\lim_{x \to c} f(x)/g(x)$ but get a different answer than computing the limit of the quotient of the derivatives. Bonus points if you can make $\lim_{x \to c} f(x) = \pm \infty$ as well in the case that $g(x) \to \pm \infty$.
I was shown an example like this a long time ago in my analysis sequence but it would be lost on the students I think:
Let $f(x) = 2x + \sin(2x)$ and let $g(x) = (2x+\sin(2x))e^{-\sin(x)}$. Then $f/g = e^{\sin x}$ on $(0,\infty)$ so $\lim_{x \to \infty} f(x)/g(x)$ does not exist. Both functions will go to $\infty$ as $x \to \infty$ and the limit of the quotients of the derivatives actually goes to zero. The issue is that $g'(x)$ has infinitely many zeros as $x \to \infty$ so you cannot use l'Hospital.
Any clue on how to make this more inviting to a freshman calculus student?
 A: Strictly speaking we cannot satisfy (2) exists limx→cf′(x)/g′(x), even in the extended sense, unless (1) g'(x) is nonzero in a (deleted) neighborhood of x = c.  That is required for f'(x)/g'(x) to be defined there (in the deleted neighborhood).
Such gaps in the definition of f'(x)/g'(x) only matter if they accumulate at x = c, since we can otherwise work around them by shrinking the neighborhood to avoid them.
We can entertain the possibility that those gaps all turn out to be removable discontinuities in f'(x)/g'(x), so that a continuous extension of f'(x)/g'(x) as x approaches c is uniquely determined.  For that to happen we would need f'(x) to have roots of equal or greater multiplicity as g'(x) at those gaps.
But this amounts to "multiplying top and bottom by the same thing", in the sense that f'(x) and g'(x) would have a common factor containing all the roots of g'(x) sufficiently near x = c.
The proposed example f(x) = 2x + sin(2x) and g(x) = f(x)e-sin(x) works out in this way.  The quotient f'(x)/g'(x) is undefined when g'(x) = 0, but:
g'(x) = [f'(x) - cos(x) f(x)] e-sin(x) 
f'(x) = 2(1 + cos(2x)) = 4 cos2(x)
A common factor containing all the roots of g'(x) for sufficiently large x is then cos(x).  If we "cancel" that factor, removing roots in the denominator, the resulting "simplified" f'(x)/g'(x) has a bounded numerator and a denominator that tends to -∞ as x grows (since f(x) tends to ∞).
Evidently we cannot blithely patch over removable singularities in f'(x)/g'(x) for the sake of l'Hopital's rule.
