Calculus, Linear Algebra & Discrete Math Limits, Sequences & Series L'Hôpital's rule (Cauchy mean value theorem)

L'Hôpital's Rule Calculator

Enter a numerator, a denominator and the point being approached, and this calculator checks whether the quotient is genuinely indeterminate, then applies L'Hôpital's rule as many times as it takes. It reports the limit, how many differentiations were needed, and the derivative pair that finally resolved it. Every derivative is computed by a Richardson-extrapolated central difference, and an independent numerical estimate of the limit is shown alongside so you can see the two methods agree.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Numerator f(x)Use x as the variable. Available: + - * / ^, sin, cos, tan, exp, ln, sqrt, abs, sinh, cosh, pi, e.sin(x)
Denominator g(x)The denominator of the quotient whose limit you want.x
Approach point aThe finite value x tends to. For a limit at infinity, substitute x = 1/t and take t → 0.0
Direction of approachChoose one side when the function is only defined there, as with ln(x) at 0.Two-sided — x → a
Maximum applications of the ruleHow many times the rule may be applied before the calculator gives up.4

It returns

  • Limit — The value the quotient approaches, obtained from the resolving derivative pair.
  • Applications of the rule — Zero means the quotient was never indeterminate and the limit follows by substitution.
  • Numerator derivative at the resolving order
  • Denominator derivative at the resolving order
  • Independent numerical estimate — Richardson extrapolation of the quotient sampled near a — no differentiation involved.
  • Disagreement between the two methods

The formula

limxaf(x)g(x)=limxaf(x)g(x)
limxaf(x)g(x)=f(k)(a)g(k)(a)

In plain text: If f(a) = g(a) = 0 and g'(x) ≠ 0 near a, then lim(x→a) f(x)/g(x) = lim(x→a) f'(x)/g'(x)

  • f, gNumerator and denominator of the quotient
  • aThe point being approached
  • f', g'Their derivatives — differentiated separately, never as a quotient rule
  • kThe number of times the rule has been applied

The rule also holds for one-sided limits, for a = ±∞, and for the ∞/∞ form. It does not hold for any other combination of values.

Updated Category Limits, Sequences & Series Verified against published test cases Reading time 11 min

What makes a limit indeterminate

A quotient f(x)/g(x) whose numerator and denominator both tend to zero is called indeterminate because the value of the limit is not decided by that fact alone. Compare three examples at x → 0: x/x → 1, x²/x → 0, and x/x² → ∞. All three are of the form 0/0 and all three behave differently. What settles the answer is the rate at which each part approaches zero, and rate is exactly what a derivative measures.

That is the whole content of L'Hôpital's rule. If both functions vanish at a, then near a they are approximated by f(a) + f'(a)(x−a) and g(a) + g'(a)(x−a), and with both constant terms zero the quotient reduces to f'(a)/g'(a). When that ratio is itself 0/0, both first-order terms vanish too and you go one order deeper. The rule is a systematic way of comparing Taylor expansions without writing them out.

Two other forms are genuinely indeterminate and covered by the same rule: ∞/∞, and the closely related family 0·∞, ∞−∞, 0⁰, 1^∞ and ∞⁰, which are first rewritten as a quotient or handled by taking logarithms. Everything else — including 1/0, 0/1 and ∞+∞ — is not indeterminate and must not be passed through the rule.

This calculator works at a finite approach point. For a limit at infinity, substitute x = 1/t and take t → 0⁺: for example lim(x→∞) x/eˣ becomes lim(t→0⁺) (1/t)/e^(1/t), which is easier to reason about but still needs care. The rule itself is valid at infinity; it is only this page's numerical machinery that needs a finite point.

The rule, its hypotheses, and how this page applies it

The precise statement is: if f and g are differentiable on an interval around a (except possibly at a itself), if g'(x) ≠ 0 there, and if f(x) → 0 and g(x) → 0 as x → a, then lim f/g = lim f'/g' provided the second limit exists. Every clause matters. The rule is proved from the Cauchy mean value theorem, which is why it needs differentiability on a whole neighbourhood rather than just at the point.

The last clause is the one people forget. The rule says the limit of the derivative quotient, if it exists, equals the original limit — not the converse. For lim(x→∞) (x + sin x)/x, the derivative quotient (1 + cos x)/1 has no limit, but the original limit is plainly 1. A failure of the rule is not evidence that the original limit fails to exist.

The calculator applies the rule as a chain on derivative values at the point. It first tests whether the form is genuinely 0/0, using a threshold scaled to the size of each function nearby, so a value that is zero only to rounding is treated as zero. If it is indeterminate, it computes f⁽ᵏ⁾(a) and g⁽ᵏ⁾(a) for k = 1, 2, 3, … by central differences with Richardson extrapolation, and stops at the first order where the denominator derivative is non-zero. The limit is then that ratio.

Alongside it, the page computes the limit a second way, with no differentiation at all: it samples the quotient at two or three decreasing offsets from a and extrapolates the sequence. The two methods have completely different failure modes, so agreement between them is real evidence. Disagreement is flagged, and it usually means a high-order derivative has lost precision — the fourth numerical derivative of a function is a fragile object.

Worked example: lim(x→0) (1 − cos x)/x²

Do it by hand and follow the table above.

  1. Check the form. At x = 0, the numerator is 1 − cos 0 = 1 − 1 = 0 and the denominator is 0² = 0. This is 0/0, so the rule applies.
  2. Differentiate separately. f'(x) = sin x and g'(x) = 2x. Do not use the quotient rule — the rule differentiates the two functions independently.
  3. Test again. At x = 0, f'(0) = sin 0 = 0 and g'(0) = 0. Still 0/0, so apply the rule a second time.
  4. Differentiate again. f''(x) = cos x and g''(x) = 2.
  5. Evaluate. f''(0) = 1 and g''(0) = 2, and 2 is not zero, so the chain stops. The limit is 1/2 = 0.5.
  6. Cross-check with the series. cos x = 1 − x²/2 + x⁴/24 − …, so 1 − cos x = x²/2 − x⁴/24 + … and the quotient is 1/2 − x²/24 + …, which tends to 1/2. It also tells you the approach is from below, at a rate proportional to .

The series cross-check is worth doing every time you can. Sample the quotient directly to see it: at x = 0.1 the value is (1 − 0.995004165)/0.01 = 0.4995835, and at x = 0.05 it is 0.4998958. The gap from 0.5 shrinks from 0.0004165 to 0.0001042 — a factor of four for a halving of x, exactly the x²/24 behaviour the series predicts: 0.01/24 = 0.0004167. Two independent routes to the same number is what confidence in a limit looks like.

Reading the output

The first thing to read is the number of applications. Zero means the quotient was never indeterminate — the denominator did not vanish — and the limit came from substitution. That is a correct answer, and it also means using L'Hôpital's rule on that problem would have produced a different and wrong number. Applying the rule to a determinate form is the most common misuse of it, and it is what the warning on that case is there to prevent.

One application is the ordinary case. Two or three are common for problems built from even functions or from series whose leading terms cancel. Four or more should make you suspicious: it may be genuine, but every extra order costs numerical accuracy, and by the fourth derivative the difference formula is working with function values that agree in most of their digits.

Then compare the limit with the independent estimate. The gap between them is reported; on the worked example it is below 10⁻⁹. A gap comparable with the limit itself means one of the two methods has failed, and the table of orders usually shows which — a derivative pair that both look like small multiples of rounding noise is the tell.

Finally read the chart. It plots the quotient itself on both sides of a, so a limit that exists appears as a curve running smoothly into a single height from both directions. A jump between the two sides means the two one-sided limits differ and the two-sided limit does not exist, in which case you should re-run with a direction selected. A curve that runs off the top means the quotient is unbounded and there is no finite limit at all.

Reference: standard indeterminate limits

Each is resolvable by the rule; the applications column is the number of differentiations required.
LimitFormApplicationsValue
sin x / x, x → 00/011
(eˣ − 1) / x, x → 00/011
ln x / (x − 1), x → 10/011
(1 − cos x) / x², x → 00/021/2
(eˣ − 1 − x) / x², x → 00/021/2
(x − sin x) / x³, x → 00/031/6
tan x / x, x → 00/011
(x² − 4) / (x − 2), x → 20/014

Every value in this table is also the leading Taylor coefficient ratio. For (x − sin x)/x³, the series x³/6 − x⁵/120 + … over x³ gives 1/6 directly, which is why three applications are needed: the first two orders both vanish.

Mistakes that produce wrong limits

  • Using the quotient rule instead of the rule. L'Hôpital differentiates numerator and denominator separately. Differentiating f/g as a single expression is a different calculation and gives a different, wrong answer.
  • Applying it to a determinate form. lim(x→0) sin x/(x+1) is 0/1 = 0 by substitution. Differentiating gives cos x/1 → 1, which is wrong. Always verify the form first.
  • Continuing after the form resolves. Once the denominator derivative is non-zero, stop. Another application changes the answer.
  • Forgetting that the rule can fail without the limit failing. If f'/g' has no limit, you learn nothing about f/g; find another method.
  • Ignoring the direction. ln x exists only for x > 0, so any limit involving it at 0 is one-sided. A two-sided request there has no answer.
  • Using the rule where a factorisation is faster. (x² − 4)/(x − 2) is x + 2 for x ≠ 2, so the limit is 4 in one line without any calculus.
  • Trusting a fourth-order numerical derivative. Each extra order costs several significant figures. Cross-check against the series or against the independent estimate.

Rewriting the other indeterminate forms

0·∞: write f·g as f/(1/g) to make it 0/0, or g/(1/f) to make it ∞/∞ — pick whichever gives derivatives you can handle. ∞−∞: combine over a common denominator. 1^∞, 0⁰ and ∞⁰: take logarithms, so y = f^g becomes ln y = g·ln f, resolve that as a 0·∞ form, and exponentiate at the end. That last route is how lim(x→0⁺) xˣ = 1 is established. To see how quickly a series representation converges once you have one, the radius of convergence calculator tells you where it is valid at all.

Alternatives to the rule, and where it sits

Taylor series are the more powerful tool for most 0/0 limits, and often the faster one. Expand numerator and denominator to a few terms, cancel the common power, and read off the ratio of the leading coefficients — that is the same answer L'Hôpital produces, obtained in one step instead of k. It also tells you how fast the quotient approaches its limit, which the rule does not. Where a series is valid is a separate question, answered by the radius and interval of convergence calculator.

Algebra beats both when it applies. Factorising, rationalising a surd by multiplying by its conjugate, or dividing through by the highest power are all exact and instant. Reach for the rule when those fail.

The derivatives the rule needs are the same ones the numerical derivative calculator computes, and its discussion of step size and cancellation explains directly why the chain here becomes unreliable at high order: round-off in a k-th difference grows like ε/hᵏ. Where the limit you are chasing is the derivative itself — the difference quotient at a point — the two pages are computing the same object from opposite directions.

Finally, limits of this kind are how continuous extensions are built. A function such as sin(x)/x, undefined at the origin, becomes continuous everywhere once you define its value there to be the limit 1. That extension is what lets you integrate it — the Riemann sum calculator will happily sample the extended function — and what makes the sinc function a well-behaved object in signal processing.

Frequently asked questions

When can I use L'Hôpital's rule?

Only when the quotient is of the form 0/0 or ∞/∞ at the point you are approaching, both functions are differentiable in a neighbourhood of that point, and the denominator derivative is non-zero nearby. If any of those fails, the rule does not apply and using it will usually give a wrong answer. This calculator tests the form before applying anything.

Do I differentiate the whole fraction with the quotient rule?

No — that is the single most common error. You differentiate the numerator and the denominator separately, producing f'(x)/g'(x), not (f/g)'. For sin x / x the rule gives cos x / 1 → 1; the quotient rule would give (x cos x − sin x)/x², which is a different function entirely and still 0/0 at the origin.

How many times can I apply the rule?

As many times as the form stays indeterminate, with no theoretical limit. In practice, more than three or four applications on a numerical calculator is a warning sign, because each extra order of differencing loses several significant figures. If a problem genuinely needs five applications, expand both functions as Taylor series instead — the answer is the ratio of the leading coefficients.

What if the rule gives an answer that never resolves?

Some quotients cycle. eˣ/eˣ reproduces itself at every order, and any number of applications leaves you where you started. In that situation simplify algebraically before differentiating, or use series. The calculator stops after the maximum you set and tells you the chain did not resolve; the independent numerical estimate is usually still trustworthy.

Can I use it for a limit at infinity?

The rule itself is valid as x → ±∞, but this page needs a finite point. Substitute x = 1/t and take t → 0⁺, which converts any limit at +∞ into a right-hand limit at the origin. For example, lim(x→∞) ln x/x becomes lim(t→0⁺) (−ln t)·t, which is a 0·∞ form and goes to 0.

Why does the calculator sometimes say the form is not indeterminate?

Because the denominator does not vanish at the approach point, so the limit is simply f(a)/g(a). That is a complete and correct answer. The message exists because applying the rule anyway is a real and common error: for sin x/(x+1) at 0 the true limit is 0, while a careless application of the rule gives 1.

What does the independent numerical estimate add?

It computes the limit by sampling the quotient at points approaching a and extrapolating, with no derivatives involved at all. Because it fails in different circumstances than the derivative chain, agreement between the two is meaningful evidence. A large gap between them means one method has broken down — usually a high-order derivative that has lost precision to cancellation.

Does the rule work for one-sided limits?

Yes, with the identical statement and the identical derivatives, applied on the relevant side only. Choose a direction when the functions are defined on only one side of the point, as for ln x at 0, or when the two sides behave differently. The derivative chain is the same either way; the direction changes only the sampled estimate and the plotted curve.

Is 0/0 always equal to something?

No. Indeterminate means the form alone does not decide the answer, not that an answer always exists. x/x² at 0 is a 0/0 form whose quotient grows without bound, so there is no finite limit. sin(1/x)·x/x oscillates and has no limit either. The rule resolves many 0/0 forms; it does not promise that every one of them converges.

References

  • Calculus, Volume 1 (§4.8 L'Hôpital's Rule)OpenStax, Rice University
  • Principles of Mathematical Analysis, 3rd edition (Theorem 5.13, L'Hôpital's rule from the Cauchy mean value theorem) — Walter Rudin, McGraw-Hill
  • Numerical Recipes: The Art of Scientific Computing, 3rd edition (§5.7, accuracy limits of numerical derivatives) — Cambridge University Press