Trading Dev AcademyFree quant education

Free lesson · Differential calculus

Derivative rules: powers, products, quotients and compositions

Open interactive lessonPractice calculationsExplore labs

Start with the idea

  • Derivative rules let you reuse a few results rather than expand every limit from scratch.
  • Addition handles independent pieces; product and quotient rules handle interactions; the chain rule handles an output passing through another function.
Symbols, units & horizon
  • f,g: differentiable functions of x
  • f′,g′: their derivatives evaluated at x unless an argument is shown
  • g(x): inner function in the composition
  • f′(g(x)): outer derivative evaluated at the inner value
  • d/dx: differentiate with respect to x
  • g²: square of the denominator, which must be nonzero
  • a,b: constants in the linearity rule
  • n: power exponent
  • e: exponential base, approximately 2.71828
  • ln: natural logarithm
  • u: inner-variable shorthand
  • y: resulting composed output

When and why to use this

Use these rules to assemble sensitivities for composite functions without memorising one formula for every application. Check a symbolic result with a finite-difference calculation at a well-behaved point.

Start with two simple functions

  • First compute u=2x+1. Then square that output to obtain y=u².
  • The inner function changes u by 2 units per unit of x. The outer function changes y locally by 2u units per unit of u.
  • Multiply these local rates. At x=1, u=3, so the combined slope is 6 times 2, or 12.
  • The graph below lets you move x. Watch the intermediate value and the combined slope change together.
u=2x+1,y=u2,dydx=dydududx=2u⋅2=4(2x+1)
Chain rule · small worked example

Follow the input through both functions

  1. Differentiate the inner function: dudx=2.
  2. Differentiate the outer function with respect to u: dydu=2u.
  3. Multiply and substitute u: dydx=2u⋅2=4(2x+1).
  4. At x=1, this gives 12. The derivative predicts a local change, not an exact finite jump.
Work it by hand

Moving x from 1 to 1.01 moves y from 9 to 9.1204. The local linear estimate predicts a change of .12; the actual change is .1204.

  • Linearity means the derivative of af+bg is af′+bg′ for constant a and b.
  • The derivative of a constant is zero.
  • The power rule gives nxⁿ⁻¹ wherever the real-valued power is differentiable.
  • The exponential eˣ differentiates to itself; ln x differentiates to 1/x for positive x.
  • For a composition, identify an inner variable before differentiating.
  • “Differentiate the outside, keep the inside, then multiply by the inside derivative” is a memory aid for a precise limit-based rule.
  • It is not optional to include the inner derivative.
(fg)′=f′g+fg′,(fg)′=f′g−fg′g2,ddxf(g(x))=f′(g(x))g′(x)
Calculus: derivation and arithmetic

Derivative rules: powers, products, quotients and compositions

  1. For the product increment, add and subtract f(x+h)g(x). This splits the change into f(x+h)[g(x+h)−g(x)]+g(x)[f(x+h)−f(x)]. Divide by h and take limits to obtain fg′+gf′.
  2. Write f/g as f·g⁻¹. The chain rule gives (g⁻¹)′=−g⁻²g′. Apply the product rule and combine denominators.
  3. For a composition, the outer change is locally f′(g(x)) times the inner change, while the inner change is locally g′(x)h. Divide by h and take the differentiable limit.
  4. For positive integer n, expand (x+h)ⁿ with the binomial theorem: xⁿ+nxⁿ⁻¹h plus terms containing h² or higher. Subtract xⁿ, divide by h and take the limit to get nxⁿ⁻¹. Extension to other real powers requires their domain and differentiability assumptions.
  5. For y=(3x²+1)⁴, use inner u=3x²+1 and outer u⁴. Then y′=4u³·6x=24x(3x²+1)³.
Work it by hand

At x=1, u=4 and y′=24×1×4³=1536. For y=x²eˣ, the product rule gives y′=eˣ(2x+x²), which is 3e at x=1.

An analogy to remember

If each turn of a handle rotates one gear three times and that gear rotates the next four times, the combined rate is twelve. The chain rule tracks these successive rate multipliers.

How this becomes a building block

The chain rule is the core of backpropagation and automatic differentiation. In calibration, model price depends on parameters, and error depends on model price; their derivatives multiply along that dependency chain. Product rules also appear when both quantity and price vary with a common input.

Textbook context · checked 12 September 2026: OpenStax: derivatives as rates of change.

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.

from math import exp, log

def product_derivative(f, df, g, dg, x):
    return df(x)*g(x)+f(x)*dg(x)

def quotient_derivative(f, df, g, dg, x):
    if g(x)==0: raise ValueError("Zero denominator")
    return (df(x)*g(x)-f(x)*dg(x))/g(x)**2

def composite_derivative(outer_derivative, inner, inner_derivative, x):
    return outer_derivative(inner(x))*inner_derivative(x)

def elementary_derivatives(x):
    if x<=0: raise ValueError("Logarithm derivative domain: x>0")
    return {"exp":exp(x),"log":1/x}

print(composite_derivative(lambda u:4*u**3,lambda x:3*x*x+1,lambda x:6*x,1))

def simple_chain(x):
    inner = 2*x + 1
    output = inner**2
    slope = 4*inner
    return inner, output, slope

print(simple_chain(1))

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. Second derivatives, Taylor expansions and numerical error
  7. Stationary points, optimisation and Newton’s method

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