Trading Dev AcademyFree quant education

Free lesson · Differential calculus

Logarithmic differentiation and elasticities

Open interactive lessonPractice calculationsExplore labs

Start with the idea

  • Use logs to simplify the calculation, then find how a small percentage input change affects the output.
Symbols, units & horizon
  • x: positive dimensionless input
  • y: positive dimensionless output
  • ln: natural logarithm
  • y′: derivative with respect to x
  • ε: dimensionless local elasticity
  • all sensitivities are local with no forecast horizon

When and why to use this

Use logarithmic differentiation for products and variable powers, and elasticity to compare proportional cost or demand responses across scales.

Start here · the same idea in everyday words

Technical termEveryday meaningConcrete example
Natural logarithmThe power to which the number e must be raised to get a positive number.The natural logarithm of 1 is 0 because e to the power 0 is 1.
ElasticityA local percentage response of an output to a percentage change in an input.Elasticity 2 means a small 1% input rise predicts about a 2% output rise.
DimensionlessA pure number with no physical or currency unit.A ratio of two dollar amounts has no dollar unit left.

Unpack a technical sentence

Technical wording: Logarithmic differentiation recovers proportional sensitivity from a positive function.

Read it as: Use logs to simplify the calculation, then find how a small percentage input change affects the output.

A slower worked example · one step at a time

  1. Consider a dimensionless input x and output y=x squared. At x=10, the output is 100.
  2. The slope is twice x, so it is 20 output units per input unit at this point.
  3. A 1% increase in x is .1 input units. Multiply .1 by 20 to predict an output increase of 2.
  4. Two output units out of the starting 100 is a 2% increase. The elasticity is 2.
  5. The exact new output is 10.1 squared, or 102.01. The extra .01 shows that elasticity describes a local approximation, not an exact finite change. The x-to-the-power-x example below uses logs because both its base and exponent move.
Self-assessed: Does elasticity 2 mean an increase of two dollars?

No. Elasticity compares percentage changes. Convert back to the output’s units using its starting value.

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

  • For a positive function y, differentiate ln y using the chain rule: the derivative is y′/y. After simplifying the logarithm, multiply back by y to recover the ordinary derivative.
  • Take y=x^x for positive, dimensionless x. Both the base and exponent vary, so the ordinary constant-exponent power rule does not apply.
  • Elasticity multiplies y′/y by x. It measures the approximate percentage change in output for a one-percent input change, locally. In market applications, ensure both price or cost levels are positive and the estimate is causal.
Before reading the working, evaluate 1*(0+1). Give the result in dimensionless elasticity.

At x=1, both slope and elasticity are 1. A 1% input increase gives an approximately 1% output increase locally; exact evaluation uses 1.01^1.01.

y=xx,ln⁡y=xln⁡x,y′=xx(ln⁡x+1),ε=xyy′=x(ln⁡x+1)
Calculus: derivation and arithmetic

Logarithmic differentiation and elasticities

  1. Take natural logarithms: ln y=x ln x.
  2. Differentiate with the chain and product rules: y′/y=ln x+x×(1/x)=ln x+1.
  3. At x=1, y=1 and ln 1=0, giving y′=1 and elasticity 1.
Work it by hand

At x=1, both slope and elasticity are 1. A 1% input increase gives an approximately 1% output increase locally; exact evaluation uses 1.01^1.01.

An analogy to remember

A sequence of percentage multipliers becomes a sum in a log ledger. Differentiate the sum, then convert back to the original scale.

How this becomes a building block

An elasticity can serve as a scale-free diagnostic for a positive cost model; it must be recomputed when the evaluation point changes.

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 log

def variable_power(x):
    if x <= 0: raise ValueError("x must be positive and dimensionless")
    y = x**x
    slope = y*(log(x)+1)
    return y, slope, x*slope/y

print(variable_power(1))

# 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 {
        "start": 10**2,
        "prediction": 100+20*.1,
        "actual": 10.1**2,
        "elasticity": 10/100*20,
    }

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

Use logarithmic differentiation for products and variable powers, and elasticity to compare proportional cost or demand responses across scales. Real logarithms require positive inputs. An elasticity is a local sensitivity under the fitted relationship; it does not establish a causal market response.

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 log

def variable_power(x):
    if x <= 0: raise ValueError("x must be positive and dimensionless")
    y = x**x
    slope = y*(log(x)+1)
    return y, slope, x*slope/y

print(variable_power(1))

# 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 {
        "start": 10**2,
        "prediction": 100+20*.1,
        "actual": 10.1**2,
        "elasticity": 10/100*20,
    }

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