Trading Dev AcademyFree quant education

Free lesson · Differential calculus

L’Hôpital’s rule: resolve indeterminate ratios carefully

Open interactive lessonPractice calculationsExplore labs

Start with the idea

  • For certain zero-over-zero or infinity-over-infinity limits, comparing the rates of change of the top and bottom can reveal the original limit.
Symbols, units & horizon
  • x: dimensionless input tending to zero
  • e: exponential base
  • lim: limit from both sides in this example
  • e^x−1: numerator tending to zero
  • x: denominator tending to zero with derivative 1
  • no time horizon

When and why to use this

Use limiting analysis to implement model formulas near removable singularities, including small-rate discounting expressions. Derive the limit before selecting a numerical special case.

Start here · the same idea in everyday words

Technical termEveryday meaningConcrete example
Indeterminate formA substitution result that does not tell us the limit.Zero divided by zero is not an answer; the nearby ratio needs more analysis.
One-sided limitThe value approached from only one side.Approach zero using positive values, then separately using negative values.
HypothesesThe conditions that must hold for a theorem to apply.Check the limiting form and derivatives before using L’Hôpital’s rule.

Unpack a technical sentence

Technical wording: A qualifying indeterminate ratio may be resolved by the derivative ratio.

Read it as: For certain zero-over-zero or infinity-over-infinity limits, comparing the rates of change of the top and bottom can reveal the original limit.

A slower worked example · one step at a time

  1. Take the ratio x squared divided by x for nonzero, dimensionless x. Substituting zero would give zero divided by zero.
  2. At x=.1, the ratio is .01/.1=.1. At x=.01, it is .0001/.01=.01.
  3. Cancel the nonzero x to see that the ratio equals x, so the limit is zero. These algebra steps prove the result without L’Hôpital.
  4. L’Hôpital also works here: the numerator derivative is 2x, the denominator derivative is 1, and their ratio approaches zero.
  5. Compare with (x+1)/(x+2). At zero this is 1/2, not an indeterminate form. Differentiating its top and bottom would give 1 and would be the wrong procedure.
Self-assessed: Why check the form before differentiating the top and bottom?

Because the theorem applies only under its conditions. An ordinary ratio that already has a defined limit does not qualify.

Study loop: predict the result, work through the arithmetic, run the Python, then explain which assumption would make the result unreliable.

  • First simplify algebraically when possible and identify the limiting form. L’Hôpital applies to 0/0 or infinity/infinity forms, not arbitrary quotients. A product or difference may first need a valid rewrite.
  • For a one-sided approach on an interval, assume numerator and denominator are differentiable away from the endpoint, the denominator derivative is nonzero, and the derivative ratio has a finite or infinite limit. If the original ratio has a qualifying indeterminate form, the limits agree. The two-sided result needs agreement from both sides.
  • The rule is a theorem about limits; it is not a formula for the derivative of a quotient. It can be applied repeatedly only after checking the hypotheses again.
Before reading the working, evaluate 1. Give the result in dimensionless limiting ratio.

The limiting ratio is exactly 1. At x=.01 it is about 1.0050167; numerical nearby values are checks, not a proof.

limx→0⁡ex−1x=limx→0⁡ex1=1
Calculus: derivation and arithmetic

L’Hôpital’s rule: resolve indeterminate ratios carefully

  1. Direct substitution gives 0/0, an indeterminate form rather than a value. Both functions are differentiable near zero and the denominator derivative is 1.
  2. Differentiate the numerator to exp(x) and denominator to 1. Their ratio has limit exp(0)=1 from each side.
  3. The theorem therefore gives the original limit 1. For x=.01, the original ratio is approximately 1.0050167, consistent with but not proving the limit.
Work it by hand

The limiting ratio is exactly 1. At x=.01 it is about 1.0050167; numerical nearby values are checks, not a proof.

An analogy to remember

Two measurements can both shrink to zero while their ratio approaches a stable value. Compare their shrinking rates only when the theorem allows it.

How this becomes a building block

A derived limit provides a benchmark for a stable numerical implementation near a removable singularity.

Python · run and reuse

Architecture pseudocode

# Python 3.10+; standard library only unless NumPy is imported.
# Synthetic teaching inputs; no historical performance claim.
from math import expm1

def exponential_ratio(x):
    # Dimensionless x; continuous extension at the removable hole.
    # expm1 computes exp(x)-1 accurately for small x.
    if x == 0: return 1.0
    return expm1(x)/x

print(exponential_ratio(0), exponential_ratio(.01))

# Replay the slower, synthetic example above. Units are stated in its steps.
def plain_language_example():
    from math import exp, e  # Standard library; no extra dependency.
    return {
        "first": .1**2/.1,
        "second": .01**2/.01,
        "counterexample": (0+1)/(0+2),
    }

print(plain_language_example())
Self-assessed: explain the calculation, its output units, and one condition under which it fails.

Use limiting analysis to implement model formulas near removable singularities, including small-rate discounting expressions. Derive the limit before selecting a numerical special case. If the form or differentiability conditions fail, differentiating the numerator and denominator can give a wrong answer. For example, (x+1)/(x+2) tends to 1/2 at zero, not the derivative ratio 1.

For current applications and implementation limits, see the research checkpoint in Differential Equations.

Research sources, review dates and limitations

Extend the research question

Translate a local derivative into an option hedge and compare a small move with a large move. Explain why the local approximation changes when other risk factors move.

Continue with the connected research module →

Connect the ideas: Sensitivity and approximation

Retrieve: A local sensitivity describes how a model responds near a specified input.

Check the change: The input, its units and what is held fixed differ across slope, duration and option sensitivities.

Partial derivatives → Rates, credit & macro → Stochastic calc → Options → Volatility

Explain it yourself: What must you check before using a small-move approximation for a large scenario?

Self-assessed. Write your explanation before opening this comparison.

Check the expansion point, units, held-fixed inputs, curvature and model domain; compare with a full repricing under the same scenario.

Python implementation

Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.

# Python 3.10+; standard library only unless NumPy is imported.
# Synthetic teaching inputs; no historical performance claim.
from math import expm1

def exponential_ratio(x):
    # Dimensionless x; continuous extension at the removable hole.
    # expm1 computes exp(x)-1 accurately for small x.
    if x == 0: return 1.0
    return expm1(x)/x

print(exponential_ratio(0), exponential_ratio(.01))

# Replay the slower, synthetic example above. Units are stated in its steps.
def plain_language_example():
    from math import exp, e  # Standard library; no extra dependency.
    return {
        "first": .1**2/.1,
        "second": .01**2/.01,
        "counterexample": (0+1)/(0+2),
    }

print(plain_language_example())

Continue learning

Differential Calculus: Limits & Derivatives — all lessons
  1. Start with a straight line: input, output and slope
  2. Functions, limits and continuity
  3. The derivative: from an average slope to an instantaneous rate
  4. Core derivative rules: constants, powers and sums
  5. Derivative rules: powers, products, quotients and compositions
  6. Chain rule workshop: nested functions and backpropagation
  7. Second derivatives, Taylor expansions and numerical error
  8. Stationary points, optimisation and Newton’s method
  9. Implicit and inverse differentiation: sensitivities of solved parameters
  10. Logarithmic differentiation and elasticities
  11. L’Hôpital’s rule: resolve indeterminate ratios carefully

Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations