Example for why L'Hospital's rule demands that the denominator is locally not $0$. We're looking at the limit of a function $f(x):=\frac{g(x)}{h(x)}$ for $x \rightarrow x_0$. Since L'hospital's Rule demands that the denominator function $h(x) \neq 0$ for a neighbourhood of $x_0$, I've been wondering if there's an example where this requirement isn't met and the rule thus cannot be applied successfully.
Thanks in advance!
 A: The basic premise of limit questions is that we have a function $f(x)$ defined on some region around $x_0$ but not including $x_0$ (technically, we just need $x_0$ to be a point of accumulation of the domain of definition). Then we ask for what value (if any) $L$ would the function extended by setting $f(x_0) = L$.
So to even ask the question what is $\lim_{x\to x_0} \frac{g(x)}{h(x)}$ we need $g(x)/h(x)$ to be defined on neighborhood of $x_0$ possibly not including $x_0$. And for this, we need $h(x) \neq 0$ on that region. Similarly, to apply L'Hospital's rule we need ask what the limit $g'/h'$ is , so we need $h'(x)$ locally non-zero (it was pointed out that this is the more common explicit requirement so I include it here)
A: Assuming you actually mean that $g'(x) \neq 0$ in a punctured neighbourhood of the point you are approaching: Here's one example. Let
$$
f(x) = \int_0^x \cos^2 t\,dt
$$
and
$$
g(x) = f(x)e^{\sin x}.
$$
Then, clearly
$$
\lim_{x\to\infty} \frac{f(x)}{g(x)} = \lim_{x\to\infty} e^{-\sin x}
$$
does not exist (but is of the type $\infty/\infty$).
On the other hand, if we try to apply l'Hospital, we get
\begin{align}
\lim_{x\to\infty} \frac{f'(x)}{g'(x)} &=
\lim_{x\to\infty} \frac{\cos^2 x}{\cos^2 x e^{\sin x} + f(x)e^{\sin x}\cos x} \\
&= \lim_{x\to\infty} \frac{\cos x}{\cos x e^{\sin x} + f(x)e^{\sin x}}.
\end{align}
Here, the numerator is bounded, so is the first term in the denominator. The second term tends to $\infty$, so the quotient tends to $0$ as $x\to\infty$.
It's possible to have a similar example (but it will be more complicated to write down) when we approach a finite point instead.
A: As other people have pointed out, L'Hospital's rule does not explicitly require that $h$ be locally nonzero at $x_0$.  However, in practice, if $h$ has zeroes in every deleted neighborhood of $x_0$, then either


*

*The function $h$ is not differentiable in any deleted neighborhood of $x_0$, or

*The derivative $h'$ has zeroes in every deleted neighborhood of $x_0$ (using the mean value theorem and assuming that $h$ is differentiable in some deleted neighborhood of $x_0$).


Both situations can lead to a failure of L'Hospital's rule.  In the first case, define
$$h(x) = \frac{1}{\lfloor x \rfloor} - \left|x - \lfloor x \rfloor - \frac{1}{2}\right|$$
$$g(x) = \begin{cases}
\frac{1}{\lfloor x \rfloor} & x -\lfloor x \rfloor = \frac{1}{2}\\
0 & \mbox{else}
\end{cases}$$
Where $\lfloor \cdot \rfloor$ is the floor function.We have that $h(x), g(x) \to 0$ as $x \to +\infty$, so we might try to apply L'Hospital's rule.  Wherever they are defined, $h(x) = \pm \frac{1}{2n}$ and $g'(x) = 0$, so
$$\lim_{x \to +\infty}\frac{g'(x)}{h'(x)} = 0.$$
However, $\frac{g(n+\frac{1}{2})}{h(n+\frac{1}{2})} = 1$ for all integer $n>0$, so we certainly cannot have
$\lim_{x\to+\infty} \frac{g(x)}{h(x)} = 0$ (it isn't hard to verify that the limit does not exist).
In the second case, let
$$h'(x) = \begin{cases}
\frac{1}{n} - \frac{2}{n}\left|x - \frac{1}{2}-3n\right| & 3n \le x < 3n+1\\
0 & 3n+1 \le x < 3n+2\\
\left|x-\frac{1}{2}-3n-2\right| - \frac{1}{n} & 3n+2 \le x < 3n+3
\end{cases}$$
$$g'(x) = \begin{cases}
0 & 3n\le x < 3n+1\\
\frac{2}{n}- \left|x - 3n -\frac{5}{4}\right| & 3n+1 \le x < 3n+\frac{3}{2}\\
\left|x - 3n -\frac{7}{4}\right| - \frac{2}{n} & 3n+\frac{3}{2} \le x < 3n+2\\
0 &  3n+2 \le x < 3n+3
\end{cases}$$
With $h(0) = g(0) = 0$.
Then, $h(3n) = g(3n) = 0$ for every $n \in \Bbb{Z}$.  We also have (at least for $x \ge 0$) that $0 \le h(x), g(x) \le \frac{1}{2n}$, where $n$ is an integer such that $3n \le x < 3n+3$.  Thus, $h(x), g(x) \to 0$ as $x \to +\infty$, so we might try applying L'Hospital's rule to find
$$\lim_{x \to +\infty}\frac{g'(x)}{h'(x)} = 0$$
(since $g' \equiv 0$ wherever $\frac{g'}{h'}$ is defined).
However, that
$g(3n+\frac{3}{2}) = h(3n+\frac{3}{2}) = \frac{1}{2n}$
so it cannot be the case that $\lim_{x\to +\infty} \frac{g(x)}{h(x)} = 0$.  (In fact, the limit is undefined.)
