practicecalculus
Limits and Continuity

L'Hôpital's Rule: When and How to Use It, With Examples

Learn L'Hôpital's rule for 0/0 and ∞/∞ limits, how to handle 0·∞, ∞ − ∞ and 1^∞ forms, worked examples, and when the rule does not apply.

By the PracticeCalculus team Published 7 min read

On this page
  1. What L'Hôpital's rule says
  2. How to apply L'Hôpital's rule step by step
  3. Worked example 1: a 0/0 limit
  4. Worked example 2: applying the rule twice
  5. Worked example 3: an ∞/∞ limit
  6. Other indeterminate forms
  7. When not to use L'Hôpital's rule
  8. Common mistakes with L'Hôpital's rule
  9. Quick reference
  10. Practice until the form check is automatic

Some limits refuse to give in to algebra. You cannot factor \frac{e^x - 1}{x}, and there is no conjugate that tames \frac{x^2}{e^x}. L'Hôpital's rule handles these in a few lines by trading the original fraction for a fraction of derivatives. It is powerful, but it has strict conditions, and using it at the wrong moment produces confidently wrong answers.

What L'Hôpital's rule says

Suppose f and g are differentiable near a (except possibly at a), with g'(x) \neq 0 near a. If

\lim_{x \to a} \frac{f(x)}{g(x)} \text{ has the form } \frac{0}{0} \text{ or } \frac{\infty}{\infty}

then

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

as long as the limit on the right exists (or is \pm\infty). The same rule holds for one-sided limits and for x \to \pm\infty.

In plain language: when the top and bottom are both heading to 0, or both blowing up, the limit is decided by how fast each one is changing. That is exactly what the derivatives measure.

Tip: differentiate the numerator and denominator separately. You are not differentiating the fraction, so the quotient rule has nothing to do with it.

Why it works

Near x = a, a differentiable function is almost a straight line: f(x) \approx f(a) + f'(a)(x - a). In the \frac{0}{0} case f(a) = g(a) = 0, so

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

The factors of (x - a) cancel, leaving the ratio of slopes. The full proof uses the Cauchy mean value theorem, but this picture explains the idea.

How to apply L'Hôpital's rule step by step

  1. Substitute to identify the form. If it is not \frac{0}{0} or \frac{\infty}{\infty}, stop: the rule does not apply.
  2. Differentiate the top and the bottom separately.
  3. Take the limit of the new fraction. Simplify first if you can.
  4. If the new limit is again \frac{0}{0} or \frac{\infty}{\infty}, apply the rule again. Otherwise you have your answer.

Worked example 1: a 0/0 limit

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

Step 1. Check the form. \frac{e^0 - 1}{0} = \frac{0}{0}. The rule applies.

Step 2. Differentiate top and bottom. \frac{d}{dx}(e^x - 1) = e^x and \frac{d}{dx}(x) = 1.

Step 3. Take the new limit.

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

Worked example 2: applying the rule twice

Evaluate \lim_{x \to 0} \frac{1 - \cos x}{x^2}.

Step 1. Check the form. \frac{1 - 1}{0} = \frac{0}{0}.

Step 2. First application.

\lim_{x \to 0} \frac{1 - \cos x}{x^2} = \lim_{x \to 0} \frac{\sin x}{2x}

Step 3. Check the form again. \frac{\sin 0}{0} = \frac{0}{0}. Still indeterminate, so apply the rule again.

Step 4. Second application.

\lim_{x \to 0} \frac{\sin x}{2x} = \lim_{x \to 0} \frac{\cos x}{2} = \frac{1}{2}

Worked example 3: an ∞/∞ limit

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

Step 1. Check the form. Both x^2 and e^x grow without bound: \frac{\infty}{\infty}.

Step 2. First application. \lim_{x \to \infty} \frac{2x}{e^x}, which is still \frac{\infty}{\infty}.

Step 3. Second application. \lim_{x \to \infty} \frac{2}{e^x}. Now the top is constant and the bottom grows without bound.

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

The same argument, repeated n times, shows that \frac{x^n}{e^x} \to 0 for every power n. Exponentials beat polynomials, which is why the graph below rises at first but is eventually crushed toward 0.

Graph of y = x²/eˣ rising to a peak at x = 2 and then decaying to 0
Two applications of L'Hôpital's rule show \lim_{x \to \infty} \frac{x^2}{e^x} = 0. The peak is at \left(2, \frac{4}{e^2}\right) \approx (2, 0.54).

Other indeterminate forms

L'Hôpital's rule works only on fractions. The other indeterminate forms must be rewritten as \frac{0}{0} or \frac{\infty}{\infty} first.

Form Example How to rewrite
0 \cdot \infty x \ln x as x \to 0^+ Move one factor to the bottom: \frac{\ln x}{1/x}
\infty - \infty \frac{1}{x} - \frac{1}{e^x - 1} as x \to 0^+ Combine into a single fraction
1^\infty \left(1 + \frac{1}{x}\right)^x as x \to \infty Take \ln, then rewrite as a fraction
0^0 x^x as x \to 0^+ Take \ln, then rewrite as a fraction
\infty^0 x^{1/x} as x \to \infty Take \ln, then rewrite as a fraction

Worked example 4: the 0 · ∞ form

Evaluate \lim_{x \to 0^+} x \ln x.

Step 1. Identify the form. x \to 0 and \ln x \to -\infty: this is 0 \cdot \infty.

Step 2. Rewrite as a fraction. Divide by the reciprocal of x:

x \ln x = \frac{\ln x}{1/x}

which has the form \frac{-\infty}{\infty}.

Step 3. Apply the rule.

\lim_{x \to 0^+} \frac{\ln x}{1/x} = \lim_{x \to 0^+} \frac{1/x}{-1/x^2} = \lim_{x \to 0^+} (-x) = 0

So x \ln x \to 0. The x shrinks faster than \ln x blows up.

Graph of y = x ln(x) for x > 0, approaching 0 as x approaches 0 from the right
Rewriting x \ln x as \frac{\ln x}{1/x} and applying L'Hôpital's rule shows \lim_{x \to 0^+} x \ln x = 0.

Worked example 5: the ∞ − ∞ form

Evaluate \lim_{x \to 0^+} \left(\frac{1}{x} - \frac{1}{e^x - 1}\right).

Step 1. Combine into one fraction.

\frac{1}{x} - \frac{1}{e^x - 1} = \frac{e^x - 1 - x}{x(e^x - 1)}

At x = 0 this is \frac{0}{0}.

Step 2. First application. The derivative of the bottom x e^x - x is e^x + x e^x - 1:

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

still \frac{0}{0}.

Step 3. Second application.

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

Worked example 6: the 1^∞ form

Evaluate \lim_{x \to \infty} \left(1 + \frac{1}{x}\right)^x.

Step 1. Identify the form. The base goes to 1 and the exponent to \infty. This is 1^\infty, which is not automatically 1.

Step 2. Take the natural log. Let y = \left(1 + \frac{1}{x}\right)^x. Then

\ln y = x \ln\left(1 + \frac{1}{x}\right) = \frac{\ln\left(1 + \frac{1}{x}\right)}{1/x}

which has the form \frac{0}{0}.

Step 3. Apply the rule. The derivative of the top is \frac{1}{1 + \frac{1}{x}} \cdot \left(-\frac{1}{x^2}\right) and the derivative of the bottom is -\frac{1}{x^2}. They share the factor -\frac{1}{x^2}, so

\lim_{x \to \infty} \ln y = \lim_{x \to \infty} \frac{1}{1 + \frac{1}{x}} = 1

Step 4. Undo the log. Since \ln y \to 1, we get y \to e^1:

\lim_{x \to \infty} \left(1 + \frac{1}{x}\right)^x = e

This is one of the classic definitions of e. The same method gives \lim_{x \to \infty}\left(1 + \frac{k}{x}\right)^x = e^k, and \lim_{x \to 0^+} x^x = e^0 = 1.

When not to use L'Hôpital's rule

When the limit is not indeterminate

Consider \lim_{x \to 0} \frac{x + 1}{x + 2}. Direct substitution gives \frac{1}{2}, and that is the answer. If you wrongly apply the rule anyway you get \frac{1}{1} = 1, which is false. Always check the form first.

When the derivatives go in circles

For \lim_{x \to \infty} \frac{\sqrt{x^2 + 1}}{x}, one application gives \frac{x/\sqrt{x^2+1}}{1} = \frac{x}{\sqrt{x^2 + 1}}, the original fraction upside down. A second application flips it back. Algebra is the way out: divide top and bottom by x to get \sqrt{1 + \frac{1}{x^2}} \to 1.

When the new limit does not exist

For \lim_{x \to \infty} \frac{x + \sin x}{x}, the rule gives \lim (1 + \cos x), which oscillates and does not exist. That does not mean the original limit fails. Dividing by x gives 1 + \frac{\sin x}{x} \to 1. The rule only promises an answer when the new limit exists.

When algebra is simpler

\lim_{x \to 3} \frac{x^2 - 9}{x - 3} is faster by factoring, and limits of rational functions at infinity are faster with the degree rules. L'Hôpital's rule is a tool, not a reflex.

Common mistakes with L'Hôpital's rule

  1. Using the quotient rule. Differentiate top and bottom separately.
  2. Skipping the form check. Applying the rule to a determinate limit gives a wrong answer.
  3. Applying it to products, differences or powers directly. Rewrite 0 \cdot \infty, \infty - \infty, 1^\infty, 0^0 and \infty^0 as fractions first.
  4. Forgetting to exponentiate. With the log method, the limit of \ln y is not the final answer. Raise e to it.
  5. Assuming 1^\infty = 1. It can equal any positive number, as e^k shows.

Quick reference

Limit Form Result
\lim_{x \to 0} \frac{e^x - 1}{x} \frac{0}{0} 1
\lim_{x \to 0} \frac{1 - \cos x}{x^2} \frac{0}{0} \frac{1}{2}
\lim_{x \to \infty} \frac{x^2}{e^x} \frac{\infty}{\infty} 0
\lim_{x \to \infty} \frac{\ln x}{x} \frac{\infty}{\infty} 0
\lim_{x \to 0^+} x \ln x 0 \cdot \infty 0
\lim_{x \to \infty} \left(1 + \frac{1}{x}\right)^x 1^\infty e
\lim_{x \to 0^+} x^x 0^0 1

Practice until the form check is automatic

The hard part of L'Hôpital's rule is not the derivatives. It is recognizing the form, rewriting it correctly, and knowing when to stop. The interactive lesson below gives you a mix of indeterminate forms, checks each step instantly, and points out exactly where a form check or a log was missed.

Practice it now

L'Hôpital's rule

Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.

Practice this lesson

Frequently asked questions

What is L'Hôpital's rule in simple terms?

When a limit of a fraction gives \frac{0}{0} or \frac{\infty}{\infty}, you can replace the top and bottom with their derivatives and take the limit again. The new limit, if it exists, equals the original one.

Do you use the quotient rule with L'Hôpital's rule?

No. You differentiate the numerator and the denominator separately, giving \frac{f'(x)}{g'(x)}. Using the quotient rule on the whole fraction is the most common mistake with this rule.

Can you use L'Hôpital's rule more than once?

Yes, as long as the new limit is still \frac{0}{0} or \frac{\infty}{\infty}. Check the form each time. For example, \lim_{x \to \infty} \frac{x^2}{e^x} needs two applications and equals 0.

How do you use L'Hôpital's rule for 1 to the infinity?

Set y equal to the expression, take the natural log so the exponent comes down, and evaluate \lim \ln y as a fraction with L'Hôpital's rule. If \lim \ln y = L, then the original limit is e^L.

When can you not use L'Hôpital's rule?

You cannot use it when the limit is not an indeterminate form, such as \frac{1}{2} or \frac{5}{0}. It also fails to help when the derivatives cycle back to the same expression, or when the limit of \frac{f'}{g'} does not exist.

Written by the PracticeCalculus team

We build interactive calculus lessons and write every page to be clear and correct. Spotted something off? Tell us and we will fix it.