Trading Dev AcademyFree quant education

Free lesson · Differential calculus

Implicit and inverse differentiation: sensitivities of solved parameters

Open interactive lessonPractice calculationsExplore labs

Start with the idea

  • An equation links an observed number and a fitted number. Differentiate the relationship to see how much the fitted number moves when the observation changes.
Symbols, units & horizon
  • F: differentiable residual function
  • x: dimensionless observed input in the example
  • y: dimensionless solved parameter
  • F_x,F_y: partial derivatives holding the other coordinate fixed
  • dy/dx: parameter units per observed-input unit
  • F_y must be nonzero
  • no time horizon

When and why to use this

Use implicit differentiation for yield, implied volatility and fitted parameters defined by a solver. Compare a perturb-and-resolve check with the analytic sensitivity.

Start here · the same idea in everyday words

Technical termEveryday meaningConcrete example
ImplicitDefined by a relationship, even when the answer is not written on its own.The equation y squared equals x tells us how the two numbers are linked.
Partial derivativeA slope found while keeping the other inputs fixed.When differentiating y squared minus x with respect to x, temporarily hold y fixed.
Ill-conditionedSmall input errors can cause large output errors.Dividing by a very small slope can greatly enlarge a small quote error.

Unpack a technical sentence

Technical wording: Implicit differentiation identifies the local sensitivity of a calibrated parameter.

Read it as: An equation links an observed number and a fitted number. Differentiate the relationship to see how much the fitted number moves when the observation changes.

A slower worked example · one step at a time

  1. Choose the positive solution of y squared equals x. At x=4, the solution is y=2.
  2. A small change in y changes y squared by approximately 2 times y times the change in y. At y=2, that multiplier is 4.
  3. To make x increase by .04, divide .04 by 4. The predicted increase in y is .01, so the predicted new solution is 2.01.
  4. Solve the changed equation exactly: the square root of 4.04 is about 2.009975. The local prediction is close, with a small approximation error.
  5. At x=.0001, the positive solution is .01 and its inverse slope is 50. A small absolute observation error has a much larger effect on the fitted parameter here than at x=4. Stay on the same positive branch for the comparison: here a branch means choosing the positive solution rather than the negative solution.
Self-assessed: Does a solver finding an answer prove that the answer is stable?

No. A solver can find a root accurately while small changes in the observation still move that root a great deal. Check both the residual and sensitivity.

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

  • An implicit equation F(x,y)=0 restricts x and y to a curve. Locally y can be a differentiable function of x when F is continuously differentiable and its y partial is nonzero.
  • A simple synthetic calibration equation is y²=x with y>0. Instead of differentiating a root formula, differentiate both sides while remembering that y changes with x.
  • The same logic underlies implied-volatility sensitivity: a model-price equation defines volatility, and the inverse sensitivity divides by vega. Small vega makes the inversion poorly conditioned.
Before reading the working, evaluate 1/(2*2). Give the result in parameter units per input unit.

At x=4 the positive root is 2 and its local slope is .25. Increasing x by .01 predicts y≈2.0025; the exact root is about 2.00249844.

F(x,y(x))=0⟹Fx+Fydydx=0,dydx=−FxFy
Calculus: derivation and arithmetic

Implicit and inverse differentiation: sensitivities of solved parameters

  1. Set F(x,y)=y²−x. Holding y fixed gives F_x=−1; holding x fixed gives F_y=2y.
  2. Apply the chain rule to F(x,y(x)): −1+2y(dy/dx)=0.
  3. At x=4 and positive root y=2, solve dy/dx=1/(2×2)=.25.
Work it by hand

At x=4 the positive root is 2 and its local slope is .25. Increasing x by .01 predicts y≈2.0025; the exact root is about 2.00249844.

An analogy to remember

A contour line on a map fixes the height. Moving east requires a compensating northward move to stay on the contour.

How this becomes a building block

A solver maps an observed quote to a fitted parameter. Implicit differentiation adds a local sensitivity diagnostic to that solved value.

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 sqrt

def positive_root_sensitivity(x):
    if x <= 0: raise ValueError("Positive x required for finite sensitivity")
    y = sqrt(x)
    return y, 1/(2*y)

print(positive_root_sensitivity(4))

# 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 {
        "slope": 1/(2*2),
        "prediction": 2+.04/4,
        "actual": 4.04**.5,
        "near_zero_slope": 1/(2*.01),
    }

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

Use implicit differentiation for yield, implied volatility and fitted parameters defined by a solver. Compare a perturb-and-resolve check with the analytic sensitivity. A zero denominator, branch change or solver returning a different root defeats the local inverse argument. A converged residual does not guarantee a stable sensitivity.

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 sqrt

def positive_root_sensitivity(x):
    if x <= 0: raise ValueError("Positive x required for finite sensitivity")
    y = sqrt(x)
    return y, 1/(2*y)

print(positive_root_sensitivity(4))

# 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 {
        "slope": 1/(2*2),
        "prediction": 2+.04/4,
        "actual": 4.04**.5,
        "near_zero_slope": 1/(2*.01),
    }

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