L'Hopital's rule conditions I have seen easy geometrical argument why L'Hopital's rule ($\lim_{x \to a} \frac{f(x)}{g(x)} = \lim_{x \to a} \frac{f'(x)}{g'(x)}$) works (local linearization). But, I still don't understand this:

*

*why is rule defined just when limit is in form $\frac{0}{0}$ or $\pm \frac{\infty}{\infty}$?

*Why must be $f(a) = g(a) = 0$ ?

*why must be $g'(a) \neq 0$?

Counterexample for 1: $\lim_{x \to 0} \frac{e^x}{x^2 + x + 1} = \frac{1}{1}$ but is also $\lim_{x \to 0} \frac{(e^x)'}{(x^2 + x + 1)'} = \lim_{x \to 0} \frac{e^x}{2x + 1} = \frac{1}{1}.$ So, L'Hopital's rule works here but $\frac{1}{1} \neq \frac{0}{0}$!
Also, I read that there is another condition:
4. $\frac{f'(x)}{g'(x)}$ must exist

*

*does condition 3 implies this?

*can you give example when original limit exist but $\frac{f'}{g'}$ does not and how is this possible if functions $f, g$ are differentiable?

 A: 1.: The rule can also be applied in the case of $\frac{a}{\infty}$ and even when the limit of $f$ does not exist (but the limit of $g$ is $\infty$); but it's rarely told. To see why does it fail otherwise, you need to look at the proof. The most general case, when $g \to \infty$ can be proven with the Mean Value theorem and Stolz-Cesaro theorem and the $\frac{0}{0}$ is a consequence of this case. The problem comes from the Stolz-Cesaro theorem: the theorem requires the denominator to diverge to infinity.
2.: As I pointed it out on 1., they don't need to be zero; just their limits need to be "critical", i.e. $\frac{0}{0}$ or $\frac{\infty}{\infty}$ or just $g\to \infty$.
3.: The proper requirement is $g' \neq 0$ around $a$. This is needed because the Mean Value Theorem would not be applicable in the proof otherwise.
4.: No, condition 3 does not imply that.
A: You can easily come up with counterexamples for applying L'Hôpital's rule when the limit is not of the form $0/0$ or $\infty/\infty$. For any $a\in\mathbb{R}$:
$$\lim_{x\to a}\frac{x}{1+x}=\frac{a}{1+a}\neq1=\lim_{x\to1}\frac{1}{1}=\lim_{x\to1}\frac{(x)'}{(1+x)'}.$$
The limit is never of the form $0/0$ or $\infty/\infty$ and clearly L'Hôpital's rule does not work on this example. To see why the rule does work for limits of the $0/0$ or $\infty/\infty$ form, see any analysis textbook for a proof (for example, Rudin's Principles of Mathematical Analysis).
We don't strictly need $g'(a)\neq0$. For example:
$$\lim_{x\to0}\frac{x^2}{x^2+x^3}=\lim_{x\to0}\frac{2x}{2x+3x^2}=\lim_{x\to0}\frac{2}{2+6x}=1,$$
where we applied L'Hôpital's rule twice, but the second limit still is of the form $0/0$.
The limit $f'/g'$ may fail to exist even when the conditions for L'Hôpital's rule are satisfied and the limit $f/g$ exists; the classic example is:
$$\lim_{x\to\infty}\frac{x+\sin(x)}{x}=1,$$
but upon applying L'Hôpital's rule we obtain:
$$\lim_{x\to\infty}1+\cos(x),$$
for which the limit does not exist.
