In short

L'Hopital's rule says: if \lim_{x \to a} \frac{f(x)}{g(x)} gives \frac{0}{0} or \frac{\infty}{\infty}, then \lim_{x \to a} \frac{f(x)}{g(x)} = \lim_{x \to a} \frac{f'(x)}{g'(x)}, provided the right-hand limit exists. You replace the functions by their derivatives and try the limit again. The rule can be applied repeatedly if the indeterminate form persists.

Consider this limit:

\lim_{x \to 0} \frac{\sin x}{x}

You know the answer is 1 -- you have seen it derived geometrically, with the squeeze theorem, and through numerical tables. But suppose you meet a harder version of the same pattern:

\lim_{x \to 0} \frac{e^x - 1 - x}{x^2}

Plugging in x = 0 gives \frac{0}{0}. You cannot factor it. The squeeze theorem does not obviously apply. The standard limits do not match this shape directly.

Build a table to see what is happening:

x e^x - 1 - x x^2 ratio
0.1 0.00517 0.01 0.517
0.01 0.0000502 0.0001 0.502
0.001 5.0002 \times 10^{-7} 10^{-6} 0.5000

The ratio is clearly heading toward 0.5 = 1/2. But how do you prove this? Is there a general-purpose machine for problems like this?

There is. The idea is almost unreasonably simple: differentiate the numerator and the denominator separately, and take the limit of the new fraction. For the limit above:

\frac{d}{dx}(e^x - 1 - x) = e^x - 1, \qquad \frac{d}{dx}(x^2) = 2x

So the rule says the original limit equals

\lim_{x \to 0} \frac{e^x - 1}{2x}

Still 0/0. Apply the rule again:

\frac{d}{dx}(e^x - 1) = e^x, \qquad \frac{d}{dx}(2x) = 2
\lim_{x \to 0} \frac{e^x}{2} = \frac{1}{2}

Two applications of differentiation, and the limit falls out. No clever algebraic tricks, no series expansions -- just derivatives.

This is L'Hopital's rule, and it is the single most powerful tool for evaluating indeterminate limits.

Why it should be true

Before stating the rule formally, here is the intuition for why differentiating top and bottom should give the same limit.

When f(a) = 0 and g(a) = 0, both functions are zero at the point a. Near a, each function behaves approximately like a straight line through the origin:

f(x) \approx f'(a)(x - a), \qquad g(x) \approx g'(a)(x - a)

These are the tangent-line approximations. So the ratio becomes

\frac{f(x)}{g(x)} \approx \frac{f'(a)(x-a)}{g'(a)(x-a)} = \frac{f'(a)}{g'(a)}

The (x-a) factors cancel, and the limit is the ratio of the derivatives at a. That is exactly what L'Hopital's rule says.

Two functions and their tangent lines at a common zeroTwo curves, f(x) and g(x), both passing through zero at a point a. Their tangent lines at that point are drawn. The ratio f(x)/g(x) near a equals the ratio of the slopes of these tangent lines, which is f prime of a over g prime of a. A draggable point on one curve lets you see how the ratio of function values approaches the ratio of slopes. x y a f(x) g(x) drag the red point
Two functions that are both zero at the point $a$. Near $a$, each function looks like its tangent line. The ratio $f(x)/g(x)$ approaches $f'(a)/g'(a)$ -- the ratio of the slopes. This is the geometric heart of L'Hopital's rule.

The formal statement

L'Hopital's Rule (0/0 form)

Suppose f and g are differentiable near x = a (except possibly at a itself), and

  1. \lim_{x \to a} f(x) = 0 and \lim_{x \to a} g(x) = 0, and
  2. g'(x) \neq 0 near a (except possibly at a), and
  3. \lim_{x \to a} \frac{f'(x)}{g'(x)} exists (or is \pm\infty).

Then

\lim_{x \to a} \frac{f(x)}{g(x)} = \lim_{x \to a} \frac{f'(x)}{g'(x)}

Reading the definition. Condition 1 says the original limit is 0/0. Condition 2 says the denominator is not flat near a (otherwise you would be dividing by zero in the derivative ratio). Condition 3 is the critical one: the rule only applies when the derivative ratio has a limit. If the derivative ratio oscillates or does something strange, the rule gives no information.

The rule also works when a is replaced by \infty (the limit at infinity) and when the limits are one-sided.

L'Hopital's Rule ($\infty/\infty$ form)

The same statement holds when condition 1 is replaced by

1'. \lim_{x \to a} |f(x)| = \infty and \lim_{x \to a} |g(x)| = \infty.

The \infty/\infty form is not just a corollary of the 0/0 form -- it requires a separate (and slightly harder) proof -- but the use is identical. If the limit gives \infty/\infty, differentiate top and bottom and try again.

One common source of confusion: the rule says "\lim f'(x)/g'(x) exists." It does not say "apply L'Hopital to f'/g' recursively until something works." Each application of the rule is a separate decision -- you must check the conditions (especially the form being 0/0 or \infty/\infty) afresh before each application.

Proof sketch for the 0/0 case

Here is a clean proof when f and g are continuous at a and g'(a) \neq 0, using the mean value theorem.

Since f(a) = g(a) = 0, write

\frac{f(x)}{g(x)} = \frac{f(x) - f(a)}{g(x) - g(a)}

By the Cauchy mean value theorem (a generalisation of the ordinary mean value theorem), there exists a point c between a and x such that

\frac{f(x) - f(a)}{g(x) - g(a)} = \frac{f'(c)}{g'(c)}

As x \to a, the point c is squeezed between a and x, so c \to a as well. Therefore

\lim_{x \to a} \frac{f(x)}{g(x)} = \lim_{c \to a} \frac{f'(c)}{g'(c)} = \lim_{x \to a} \frac{f'(x)}{g'(x)}

That is the entire proof. The Cauchy mean value theorem provides the bridge: it says that the ratio of the differences equals the ratio of the derivatives at some intermediate point, and that intermediate point is forced toward a as x approaches a.

The full proof without the assumption that f and g are continuous at a is more delicate and uses the extended mean value theorem directly on intervals not containing a. The conclusion is the same.

The Cauchy mean value theorem in actionA diagram showing the interval from a to x on a number line, with the intermediate point c marked between them. Arrows indicate that as x approaches a, c is squeezed toward a as well. The ratio f prime of c over g prime of c equals the ratio of the differences. a c x x → a c → a $\frac{f(x) - f(a)}{g(x) - g(a)} = \frac{f'(c)}{g'(c)}$ As x → a, c is squeezed toward a
The Cauchy mean value theorem guarantees a point $c$ between $a$ and $x$ where the ratio of derivatives equals the ratio of differences. As $x \to a$, the point $c$ is trapped between them and is forced toward $a$ too, so $f'(c)/g'(c) \to f'(a)/g'(a)$.

A first worked example

Example 1: A trigonometric limit

Evaluate \displaystyle\lim_{x \to 0} \frac{\tan x - x}{x - \sin x}.

Step 1. Check the form. At x = 0: \tan 0 - 0 = 0 and 0 - \sin 0 = 0. This is 0/0.

Why: confirming 0/0 is mandatory before applying L'Hopital. The rule does not apply to limits that are not indeterminate.

Step 2. Differentiate the numerator and denominator.

\frac{d}{dx}(\tan x - x) = \sec^2 x - 1, \qquad \frac{d}{dx}(x - \sin x) = 1 - \cos x

Why: the derivative of \tan x is \sec^2 x, and the derivative of \sin x is \cos x. Each differentiation is applied separately to the top and bottom -- not as a quotient rule.

Step 3. Check the new limit. At x = 0: \sec^2 0 - 1 = 0 and 1 - \cos 0 = 0. Still 0/0. Apply the rule again.

\frac{d}{dx}(\sec^2 x - 1) = 2\sec^2 x \tan x, \qquad \frac{d}{dx}(1 - \cos x) = \sin x

Why: the first application did not resolve the indeterminacy. L'Hopital allows repeated application as long as conditions are met.

Step 4. Check again. At x = 0: 2\sec^2 0 \cdot \tan 0 = 0 and \sin 0 = 0. Still 0/0. One more round.

\frac{d}{dx}(2\sec^2 x \tan x) = 2(2\sec^2 x \tan^2 x + \sec^4 x), \qquad \frac{d}{dx}(\sin x) = \cos x

At x = 0: the numerator gives 2(0 + 1) = 2 and the denominator gives 1.

\lim_{x \to 0} \frac{2\sec^4 x + 4\sec^2 x \tan^2 x}{\cos x} = \frac{2}{1} = 2

Why: after three applications, the derivatives finally produce nonzero values at x = 0, and the limit can be evaluated by direct substitution.

Result: \displaystyle\lim_{x \to 0} \frac{\tan x - x}{x - \sin x} = 2

The graph of $\frac{\tan x - x}{x - \sin x}$. The function is undefined at $x = 0$, but the curve approaches $2$ from both sides. Three rounds of L'Hopital were needed because $\tan x - x$ and $x - \sin x$ both vanish to third order (their leading terms are $x^3/3$ and $x^3/6$, whose ratio is $2$).

The fact that three rounds of L'Hopital were needed is itself informative. Each application of L'Hopital "peels off" one power of x from the numerator and denominator. Since both \tan x - x and x - \sin x start at order x^3, three applications are needed to get past the zeros. The expansion method would have found the answer in one step: \frac{x^3/3 + \cdots}{x^3/6 + \cdots} = \frac{1/3}{1/6} = 2.

A second example: the \infty/\infty form

Example 2: Polynomial vs exponential growth

Evaluate \displaystyle\lim_{x \to \infty} \frac{x^3}{e^x}.

Step 1. Check the form. As x \to \infty: x^3 \to \infty and e^x \to \infty. This is \infty/\infty.

Why: L'Hopital applies to \infty/\infty just as it does to 0/0.

Step 2. Differentiate top and bottom.

\frac{d}{dx}(x^3) = 3x^2, \qquad \frac{d}{dx}(e^x) = e^x

Still \infty/\infty. Apply again.

\frac{d}{dx}(3x^2) = 6x, \qquad \frac{d}{dx}(e^x) = e^x

Why: the exponential e^x is its own derivative, so the denominator never changes. But the polynomial degree drops by 1 each time.

Step 3. Still \infty/\infty. One more.

\frac{d}{dx}(6x) = 6, \qquad \frac{d}{dx}(e^x) = e^x

Now the numerator is the constant 6 and the denominator is e^x \to \infty.

\lim_{x \to \infty} \frac{6}{e^x} = 0

Why: a constant divided by something that grows without bound goes to 0. After three differentiations, the polynomial has been reduced to a constant, but the exponential is still growing.

Result: \displaystyle\lim_{x \to \infty} \frac{x^3}{e^x} = 0

The graph of $x^3/e^x$. The function rises initially (the polynomial dominates for small $x$) but then falls toward zero as the exponential takes over. The exponential *always* wins against any polynomial -- the limit is $0$ no matter how high the power of $x$.

This is a general principle: \lim_{x \to \infty} \frac{x^n}{e^x} = 0 for any positive integer n. Each application of L'Hopital reduces the polynomial degree by one, but the exponential stays unchanged. After n applications, the polynomial becomes a constant, and the constant divided by e^x goes to zero. Exponential growth beats polynomial growth, always.

Common confusions

Going deeper

If you came here to learn how to use L'Hopital's rule for limits, you have it. The rest of this section covers the cases where the rule fails, the subtlety of condition 3, and some traps.

When L'Hopital fails: the rule's blind spot

The most important subtlety in L'Hopital's rule is condition 3: \lim f'(x)/g'(x) must exist. If the derivative ratio does not converge, the rule says nothing -- but that does not mean the original limit fails to exist.

The standard counterexample:

\lim_{x \to \infty} \frac{x + \sin x}{x}

This is \infty/\infty. Direct simplification gives 1 + \frac{\sin x}{x} \to 1 + 0 = 1. The limit exists and equals 1.

But applying L'Hopital:

\lim_{x \to \infty} \frac{1 + \cos x}{1}

This limit does not exist, because \cos x oscillates between -1 and 1 forever. L'Hopital gives no answer -- not because the original limit doesn't exist, but because the derivative ratio doesn't settle down.

Comparison of (x + sin x)/x and its derivative ratio (1 + cos x)/1Two graphs stacked conceptually. The function (x + sin x)/x approaches 1 smoothly as x grows, showing that the original limit is 1. But the derivative ratio 1 + cos x oscillates between 0 and 2 forever and has no limit. This shows that L'Hopital's rule can fail even when the original limit exists. x y 1 2 0 original → 1 derivative ratio
The original function $(x + \sin x)/x$ (black curve) settles smoothly toward $1$. But the derivative ratio $1 + \cos x$ (red curve) oscillates between $0$ and $2$ forever. L'Hopital says nothing here -- yet the original limit is perfectly well-defined. The moral: when L'Hopital gives no answer, try a different method.

The lesson: L'Hopital's rule is a sufficient condition, not a necessary one. If \lim f'/g' exists, you get the answer. If it does not, you need a different approach -- algebra, expansion, or the squeeze theorem.

Another failure mode: cycling

Sometimes L'Hopital does not oscillate but instead cycles. Consider

\lim_{x \to \infty} \frac{e^x + e^{-x}}{e^x - e^{-x}}

This is \infty/\infty. Apply L'Hopital:

\lim_{x \to \infty} \frac{e^x - e^{-x}}{e^x + e^{-x}}

Apply again:

\lim_{x \to \infty} \frac{e^x + e^{-x}}{e^x - e^{-x}}

You are back where you started. L'Hopital is cycling without making progress.

The fix is algebra: divide numerator and denominator by e^x:

\frac{e^x + e^{-x}}{e^x - e^{-x}} = \frac{1 + e^{-2x}}{1 - e^{-2x}} \to \frac{1 + 0}{1 - 0} = 1

When L'Hopital cycles, it is a signal that the expressions have a structure that differentiation cannot simplify. Algebraic manipulation usually resolves it.

The trap of circular reasoning

A common trap in textbooks: "Prove that \lim_{x \to 0} \frac{\sin x}{x} = 1 using L'Hopital's rule."

Applying L'Hopital gives \lim \frac{\cos x}{1} = 1. Correct? The algebra is fine. But there is a problem: the derivative of \sin x is \cos x only because \lim_{x \to 0} \frac{\sin x}{x} = 1. That limit is used in the derivation of the derivative formula. So using L'Hopital to prove this limit is circular reasoning -- you are assuming the answer to derive the answer.

This does not mean L'Hopital gives the wrong answer. It gives the right answer. It just cannot serve as the proof of this particular limit. The proof must come from the geometric squeeze argument, which does not use derivatives.

The general principle: you cannot use L'Hopital to prove any limit that was itself used to derive the differentiation formulas. The basic limits \frac{\sin x}{x}, \frac{e^x - 1}{x}, and \frac{\ln(1+x)}{x} must be established independently.

Converting other forms to 0/0 or \infty/\infty

L'Hopital directly handles only 0/0 and \infty/\infty. But many other indeterminate forms can be converted into one of these two:

0 \cdot \infty: If f(x) \to 0 and g(x) \to \infty, rewrite f \cdot g as \frac{f}{1/g} (which is 0/0) or \frac{g}{1/f} (which is \infty/\infty). Choose whichever is easier to differentiate.

\infty - \infty: If f(x) \to \infty and g(x) \to \infty, compute f - g algebraically (find a common denominator, rationalise, factor) to convert it into a 0/0 or \infty/\infty quotient.

1^\infty, 0^0, \infty^0: Take the logarithm. This converts f^g into g \ln f, which is a product, and then use the 0 \cdot \infty technique. The full treatment is in the article on Special Limit Forms.

Repeated application and when to stop

L'Hopital can be applied as many times as needed, as long as each intermediate step produces 0/0 or \infty/\infty. In Example 1, three rounds were needed. In principle, you might need four, five, or more.

But if the form changes after differentiation -- say, the numerator is no longer zero or the denominator is no longer infinite -- you must stop and evaluate directly. Applying L'Hopital to a non-indeterminate form gives a wrong answer.

A practical rule: if after two or three rounds the limit is still 0/0 and the expressions are getting more complicated, switch to the expansion method. Series expansion reveals the answer in one step regardless of the order of vanishing.

L'Hopital at infinity

The rule works seamlessly for limits as x \to \infty. The formal statement is identical, with "x \to a" replaced by "x \to \infty." The proof uses a substitution t = 1/x to convert it to a limit at 0.

For example: \lim_{x \to \infty} \frac{\ln x}{x}. This is \infty/\infty.

\lim_{x \to \infty} \frac{1/x}{1} = \lim_{x \to \infty} \frac{1}{x} = 0

Logarithms grow slower than any positive power of x. More generally, \lim_{x \to \infty} \frac{\ln x}{x^p} = 0 for any p > 0 -- a single application of L'Hopital gives \frac{1/(px^p)}{1} \to 0.

The graph of $\frac{\ln x}{x}$. The function peaks at $x = e$ (where the derivative is zero) and then falls toward $0$. No matter how slowly, the denominator $x$ eventually overpowers $\ln x$. L'Hopital confirms this in one step.

The hierarchy of growth rates

L'Hopital's rule, applied repeatedly, reveals a fundamental hierarchy:

\text{logarithms} \ll \text{polynomials} \ll \text{exponentials} \ll \text{factorials}

Each function in this list grows faster than every function to its left. Specifically:

Each of these is an \infty/\infty limit that L'Hopital resolves. The hierarchy is one of the most important qualitative facts in analysis, and it governs everything from the convergence of series to the running time of algorithms.

Where this leads next

L'Hopital's rule is one tool in a toolkit. The most natural next steps: