A proviso in l'Hospital's rule

L'Hospital's Rule states that $$\lim_{x\to a}\frac{f(x)}{g(x)} = \lim_{x\to a}\frac{f'(x)}{g'(x)}$$

can be applied when:

(1) $f$, $g$ are differentiable;

(2) $g'(x) \neq 0$ for $x$ near $a$ (except possibly at $a$);

(3) $\displaystyle\lim_{x\to a}f(x) = 0 = \displaystyle\lim_{x\to a}g(x)$, or $\displaystyle\lim_{x\to a}f(x) = \pm\infty = \displaystyle\lim_{x\to a}g(x)$; and

(4) the limit on the RHS exists or it equals $\pm\infty$.

$\ $

Why is proviso (2) necessary?

Edit: This question was asked in the context of a first undergraduate calculus course. Thus, the domains of $f$ and $g$ can be assumed to include a subset of $\mathbb R$ for which $a$ is an accumulation point, that has at most two connected components. I apologise to Paramanand if this changes the question - I intended to communicate this by tagging the question calculus. I think that this setup means that the quotient $f'/g'$ will be defined on an interval near $a$ when the criteria (1)-(4) hold.


I assume that we are using the following definition of limit:

Let $f$ be defined in a certain neighborhood of $a$ and not necessarily at $a$. A number $L$ is said to be the limit of $f$ as $x \to a$ (written as $\lim\limits_{x \to a}f(x) = L$) if for every $\epsilon > 0$ it is possible to choose a $\delta > 0$ such that $|f(x) - L| < \epsilon$ whenever $0 < |x - a| < \delta$.

Note that this definition presupposes that $f$ must be defined in a deleted neighborhood of $a$ before we can talk of $\lim_{x \to a}f(x)$. Many textbook authors relax this condition and only need that $a$ should be an accumulation point of the domain of $f$. Note that this relaxed condition does not help us in case of L'Hospital's Rule because the proof of this rule is based on the use of mean value theorem which requires that we are dealing with intervals (for which $a$ is an end-point) rather than dealing with arbitrary domains (which have $a$ as an accumulation point).

Once we have taken the definition of limit mentioned above it is obvious that condition $(4)$ of L'Hospital's Rule in question automatically implies condition $(2)$. The existence of $\lim_{x \to a}f'(x)/g'(x)$ presupposes that the expression $f'(x)/g'(x)$ is defined in a certain deleted neighborhood of $a$. And this means that $g'(x) \neq 0$ in that deleted neighborhood. So the second condition is redundant.

However it is a good idea to mention this condition because it is easy to check this instead of checking $(4)$. And if this fails we are guaranteed that LHospital won't work and we don't need to check the condition that $f'(x)/g'(x)$ tends to a limit.

Further note that if we are given that $\lim_{x \to a}g(x) = 0$ and the fact that $g'(x) \neq 0$ as $x \to a$ then it follows via mean value theorem that $g(x) \neq 0$ as $x \to a$ and hence it is possible to talk about limit of $f(x)/g(x)$. The proof for L'Hospital is now easily completed via Cauchy's Mean Value Theorem.


Update: OP wants to know (via comment to this answer) about the difference between two definitions of limit $\lim_{x \to a}f(x)$ which I have mentioned in my answer. In one definition we require $f$ to be defined in a deleted neighborhood of $a$ and in another definition we require $a$ to be an accumulation point of the domain of $f$. The difference is best explained via an example where these two definitions lead to two different conclusions.

Let $$f(x) = \frac{\sin(1/x)}{\sin(1/x)}$$ then it is clear that $f$ is defined for all values of $x$ except $x = 0$ or $x = 1/n\pi$ where $n$ is a non-zero integer. Moreover $f(x) = 1$ at points where $f$ is defined. Thus the domain of $f$ is $$A = \mathbb{R} - B$$ where $$B = \{0\}\cup\{1/n\pi\mid n\text{ is a non-zero integer}\}$$ and $f(x) = 1$ for all $x \in A$.

It can be easily seen that $0$ is an accumulation point of $A$ (this statement means that every deleted neighborhood of $0$ contains a member of $A$). Also observe that $0$ is an accumulation point of $B$.

At the same time we can see that the function $f$ is not defined in a deleted neighborhood of $0$ (because every such neighborhood contains points of $B$ also).

Thus according to my definition of limit it is not possible to even talk about $\lim_{x \to 0}f(x)$ whereas according to the relaxed definition we can talk about $\lim_{x \to 0}f(x)$ because $0$ is an accumulation point of domain $A$ of $f$. Moreover according to this definition we have $\lim_{x \to 0}f(x) = 1$.

For a beginner who is studying calculus for the first time (meaning age 15-16 years) it is best to avoid terms like accumulation point, Bolzano-Weierstrass Theorem, open set, closed set etc (which are part of a course in real-analysis or point set theory/topology) and instead rely on simple definition of limit where the functions involved are defined on certain intervals except for some exceptional points of the interval where the function is not defined. The power of concept of limit is due to the fact that it can describe the behavior of a function near those exceptional points where the function is not even defined.

In fact this is ingrained in the definition of limit that limit of a function at a point $a$ has nothing to do with its value at point $a$ and has everything to do with its values near point $a$. Therefore it is a pre-requisite that the function must be defined in some neighborhood of $a$ except possibly at $a$ (and we say this compactly that $f$ must be defined in a deleted neighborhood of $a$) before we can even even talk about the limit of $f$ as $x \to a$ (or to use a different phrase, limit of $f$ at point $a$).


Just to clarify we are talking about functions defined on subsets of $\mathbb{R}$ and hence there is no need to think of complex domains.


Remember that in order to be able to speak about the limit of some function $h : D \to \Bbb R$ at a point $a$ (with $D$ an open subset), you need $a$ to be an accumulation point for $D$ (a limit point of $D$, as it is also called) - in particular, this means that $h$ must be defined in some neighbourhood $a$ (save for, possibly, in $a$ itself).

Using the above and letting $h = \frac {f'} {g'}$, you want $h$ to be defined on some neighbourhood of $a$, and this amounts to $h$ having a non-zero denominator in some neighbourhood of $a$, i.e. $g'(x) \ne 0$ for $x$ in a neighbourhood of $a$ (possibly with $a$ omitted - this one being often the case, in practice).

To conclude, the condition on the denominator has to do only with having the fraction well-defined (i.e. mathematically meaningful).