TITLE: A function which changes sign infinitely many times, but for which L'Hôpital's rule works
QUESTION [6 upvotes]: I found a visual proof of the L'Hôpital's rule by Giorgio Goldoni which uses an additional hypothesis: $g'(x)$ (i.e. the function which is at the denominator) cannot change its sign.
My question is this: is this additional hypothesis reductive? Does it exist a function whose first derivative changes sign infinitely many times, but for which the De l'Hospital rule works?

REPLY [6 votes]: Update: As it turned out, my answer below isn't correct because $\frac{f'(x)}{g'(x)}$ fraction cannot be simply reduced, because it's not defined in points where $g(x)=0$ (see comments). However, I am not removing the post, because it's can serve as a demonstration how one can make a mistake solving problems like this.

Yes, there do exist such example, but it doesn't mean that the $g'(x)\not=0$ condition is reductive - it's a sufficient condition, but not necessary: 
Consider functions $f(x)=-x*sin(\frac{1}{x})$ and $g(x)=2*f(x)$ and assume $a=0$.
We have $\lim_{x \to 0}f(x)=0$ and $\lim_{x \to 0}g(x)=0$

From one hand, obviously, $$\lim_{x \to 0}\frac{f(x)}{g(x)}=\lim_{x \to 0}\frac{f(x)}{2*f(x)}=\frac{1}{2}$$
Now, $f'(x)=\frac{cos(\frac{1}{x})}{x}-sin(\frac{1}{x})$ and $g'(x)=2*\frac{cos(\frac{1}{x})}{x}-2*sin(\frac{1}{x})$
And here we also have $$\lim_{x \to 0}\frac{f'(x)}{g'(x)}=\lim_{x \to 0}\frac{\frac{cos(\frac{1}{x})}{x}-sin(\frac{1}{x})}{2*\frac{cos(\frac{1}{x})}{x}-2*sin(\frac{1}{x})}=\frac{1}{2}$$
Which means that De l'Hopital rule works for this function, but $g'(x)$ changes its sign infinitely many times.