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".
L'Hopital iterations
Final step
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.
- Check the form: sin(0)/0 = 0/0, indeterminate.
- Differentiate numerator: d/dx[sin(x)] = cos(x).
- Differentiate denominator: d/dx[x] = 1.
- New ratio: cos(x)/1. Substitute x = 0: cos(0)/1 = 1.
- 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.
- Round 1: (1-cos(0))/0² = 0/0. Differentiate: sin(x)/(2x).
- Check round 1's result at x=0: sin(0)/(2·0) = 0/0, still indeterminate.
- Round 2: differentiate again: cos(x)/2.
- Substitute x = 0: cos(0)/2 = 1/2.
- 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.
- 0/0 and ∞/∞: L'Hopital's rule applies directly.
- 1/0 or a finite number over 0: this is an infinite limit or a vertical asymptote, not covered by L'Hopital's rule, evaluate it directly instead.
- 0 × ∞: rewrite as a fraction first (multiply by 1/(1/g) to turn a product into 0/0 or ∞/∞), then apply the rule.
- ∞ - ∞: combine into a single fraction first (a common denominator, typically), then check if the result is 0/0 or ∞/∞.
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?
Can I apply L'Hopital's rule more than once?
Do I differentiate the whole fraction with the quotient rule?
What if L'Hopital's rule gives 0/0 again after differentiating?
Does this calculator work for limits at infinity as well as finite points?
Not an indeterminate form?
Use the general limit calculator for direct substitution, factoring, and limits at infinity.
Go to the limit calculatorFree. No sign-up.