Skip to content

Calculus tool

L'Hopital's Rule Calculator

Enter a numerator f(x), a denominator g(x), and the value x approaches. This calculator checks whether the ratio is an indeterminate 0/0 or infinity/infinity form at that point, and if it is, differentiates the numerator and denominator separately, symbolically, and tries substitution again, repeating up to four times if the new ratio is still indeterminate. Every iteration is shown, including the exact derivative computed at each step, so you can follow the algebra instead of just reading a final number.

Use a number, "pi", "-infinity" or "infinity".

Try:
limx→0 f(x)/g(x) =
Was this tool helpful?
Give feedback

What L'Hopital's rule actually says

If limx→a f(x)/g(x) is an indeterminate form of type 0/0 or ∞/∞, and both f and g are differentiable near a (with g'(x) ≠ 0 near a, except possibly at a itself), then limx→a f(x)/g(x) = limx→a f'(x)/g'(x), provided the second limit exists. In plain terms: when direct substitution into a ratio gives you an indeterminate form instead of an answer, differentiate the top and bottom separately (never the whole fraction with the quotient rule; that would defeat the point) and try substitution again on the new ratio.

Worked example: sin(x)/x at x → 0

Direct substitution gives sin(0)/0 = 0/0, an indeterminate form, so L'Hopital's rule applies. Differentiating the numerator gives cos(x); differentiating the denominator gives 1. The new ratio is cos(x)/1, and substituting x = 0 gives cos(0)/1 = 1. This is exactly the special trigonometric limit calculus students memorize early on, now derived mechanically rather than proven with the squeeze theorem.

  1. Check the form: sin(0)/0 = 0/0, indeterminate.
  2. Differentiate numerator: d/dx[sin(x)] = cos(x).
  3. Differentiate denominator: d/dx[x] = 1.
  4. New ratio: cos(x)/1. Substitute x = 0: cos(0)/1 = 1.
  5. Conclusion: the limit is 1.

Worked example: a limit needing two rounds of differentiation

Consider limx→0 (1 - cos(x)) / x². Direct substitution gives (1 - 1)/0 = 0/0. Differentiating once gives sin(x)/(2x), and substituting x = 0 gives 0/0 again: still indeterminate, so the rule is applied a second time. Differentiating sin(x) gives cos(x), and differentiating 2x gives 2, so the new ratio is cos(x)/2, and substituting x = 0 gives 1/2. Some limits resolve after one round of L'Hopital's rule, others need two or more; the calculator keeps applying the rule automatically (up to four rounds) as long as the ratio keeps coming back indeterminate.

  1. Round 1: (1-cos(0))/0² = 0/0. Differentiate: sin(x)/(2x).
  2. Check round 1's result at x=0: sin(0)/(2·0) = 0/0, still indeterminate.
  3. Round 2: differentiate again: cos(x)/2.
  4. Substitute x = 0: cos(0)/2 = 1/2.
  5. Conclusion: the limit is 1/2.

When L'Hopital's rule does not apply

The rule only applies to a genuine 0/0 or ∞/∞ form. A very common mistake is reaching for L'Hopital's rule on a ratio that direct substitution already answers, or on a form like 1/0 (which is an infinite limit or a vertical asymptote, not an indeterminate form) or 0 × ∞ or ∞ - ∞ (which need to be algebraically rewritten as a fraction first, before the rule can apply at all). This calculator checks the actual form at every step before differentiating, and if the starting ratio is not indeterminate, it says so directly and reports the ordinary limit instead of misapplying the rule.

Why symbolic differentiation, not a numerical shortcut

This calculator differentiates your exact expression using the standard differentiation rules (power rule, product rule, quotient rule, chain rule, and the derivatives of sin, cos, exp, ln, and the other supported functions), the same way you would by hand, rather than approximating a derivative numerically. That matters because a numerical derivative estimate can introduce its own rounding error right when you need the most precision: exactly at an indeterminate point. Showing the exact symbolic derivative at each iteration also makes the working genuinely checkable against your own hand calculation, not just a black-box number.

Related tools

For a limit that is not an indeterminate 0/0 or ∞/∞ ratio, the general-purpose limit calculator covers direct substitution, factoring, and infinity-limit degree comparison in one tool, and includes a dedicated limit at infinity calculator walkthrough for x → ∞ problems specifically. For a limit of a function of two variables, see the separate multivariable limit calculator, which tests several approach paths instead of differentiating.

Frequently asked questions

What counts as an indeterminate form?
The two forms L'Hopital's rule directly covers are 0/0 and ∞/∞. Related forms (0 × ∞, ∞ - ∞, 0⁰, 1^∞, ∞⁰) are also called indeterminate, but each needs to be algebraically rewritten into a 0/0 or ∞/∞ ratio before the rule can be applied to it.
Can I apply L'Hopital's rule more than once?
Yes, as many times as needed, as long as each new ratio, after differentiating, is still an indeterminate 0/0 or ∞/∞ form. This calculator applies it automatically up to four times per problem, which covers essentially every textbook example; a limit that is still indeterminate after four rounds is unusual enough that a numerical check is the more practical next step.
Do I differentiate the whole fraction with the quotient rule?
No. L'Hopital's rule differentiates the numerator and denominator completely separately, as two independent functions, and forms a brand-new ratio f'(x)/g'(x). Applying the quotient rule to the original fraction instead is the single most common mistake with this rule, and it does not simplify anything.
What if L'Hopital's rule gives 0/0 again after differentiating?
Apply it again: differentiate the new numerator and new denominator separately, and check the ratio at the target value once more. This calculator keeps doing that automatically, and shows every intermediate ratio in the iteration list so you can see exactly where it stopped being indeterminate.
Does this calculator work for limits at infinity as well as finite points?
Yes. Type "infinity" or "-infinity" in the target field. An ∞/∞ form at infinity (for example x²/eˣ) is handled the same way as a 0/0 form at a finite point: differentiate top and bottom, substitute again, repeat if still indeterminate.

Not an indeterminate form?

Use the general limit calculator for direct substitution, factoring, and limits at infinity.

Go to the limit calculator

Free. No sign-up.