Trading Dev AcademyFree quant education

Free lesson · Integral calculus

Integration by parts: transfer a derivative

Open interactive lessonPractice calculationsExplore labs

Start with the idea

  • Integration by parts moves the differentiation from one factor to another. Keep the end-minus-start term as well as the remaining integral.
Symbols, units & horizon
  • u,v: differentiable factors of the same integration variable
  • du,dv: their differentials
  • a,b: lower and upper bounds
  • [uv]_a^b: u(b)v(b)−u(a)v(a)
  • x: dimensionless input
  • e: exponential base
  • the example has no time horizon

When and why to use this

Use integration by parts for moments of continuous distributions, discounted time-weighted cash flows and analytic benchmarks for numerical integration.

Start here · the same idea in everyday words

Technical termEveryday meaningConcrete example
AntiderivativeA function whose derivative returns the original integrand.An antiderivative of 2x is x squared; differentiating x squared gives 2x.
Boundary termAn expression evaluated at the end minus its value at the start.For x times exp(x) from 0 to 1, the product at the bounds gives e minus zero.
RearrangeMove terms to isolate the part you want, while preserving equality.Subtract the other integral from both sides of the integrated product rule.

Unpack a technical sentence

Technical wording: Retain the boundary contribution when transferring the derivative.

Read it as: Integration by parts moves the differentiation from one factor to another. Keep the end-minus-start term as well as the remaining integral.

A slower worked example · one step at a time

  1. Integrate x times exp(x) from 0 to 1, using dimensionless values.
  2. Choose the factor x to differentiate: its derivative is 1. Choose exp(x) to integrate: its antiderivative is exp(x).
  3. The product at the upper bound is 1 times e. At the lower bound it is 0 times 1. Their difference is e.
  4. The remaining integral of exp(x) from 0 to 1 is e minus 1. Subtract it from the boundary term.
  5. You get e minus (e minus 1), which is 1. The parentheses matter: subtracting the whole quantity changes both signs.
Self-assessed: Why is the answer not just the boundary term e?

The rearranged product rule also contains a remaining integral. Omitting it changes the result.

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

  • Write one factor as u and the other as dv, then find du and an antiderivative v. This is a choice of roles, not a substitution of variables.
  • Integrate the product rule for uv and rearrange. For definite integrals, the boundary term is evaluated at both endpoints.
  • Polynomial times exponential is a useful first case: differentiating the polynomial reduces its degree. Repeated integration by parts handles higher powers.
Before reading the working, evaluate 1. Give the result in dimensionless area.

The exact area is 1. Keeping only the boundary term e would overstate the result by e−1.

∫abudv=[uv]ab−∫abvdu,∫01xexdx=[xex]01−∫01exdx=1
Calculus: derivation and arithmetic

Integration by parts: transfer a derivative

  1. Choose u=x, dv=exp(x) dx, so du=dx and v=exp(x).
  2. The boundary term is 1×e−0×1=e. The remaining integral is e−1.
  3. Subtract e−(e−1)=1. The antiderivative (x−1)exp(x) differentiates back to x exp(x).
Work it by hand

The exact area is 1. Keeping only the boundary term e would overstate the result by e−1.

An analogy to remember

Transfer one task between two factors: differentiating a polynomial makes it simpler, while integrating an exponential leaves it familiar.

How this becomes a building block

An analytic moment or discounted-flow integral can become a reference case for a numerical pricing engine.

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 exp

def polynomial_exponential_integral(a,b):
    # Dimensionless bounds; signed integral when b < a.
    def primitive(x): return (x-1)*exp(x)
    return primitive(b)-primitive(a)

print(polynomial_exponential_integral(0,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 {
        "boundary": e,
        "remaining": e-1,
        "answer": e-(e-1),
    }

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

Use integration by parts for moments of continuous distributions, discounted time-weighted cash flows and analytic benchmarks for numerical integration. Boundary terms matter. On an infinite domain, justify their limiting values and convergence before discarding them.

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

Research sources, review dates and limitations

Extend the research question

Distinguish accumulated realized funding from extrapolating the most recent quoted rate. Build a time ledger before annualizing an observed return.

Continue with the connected research module →

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 exp

def polynomial_exponential_integral(a,b):
    # Dimensionless bounds; signed integral when b < a.
    def primitive(x): return (x-1)*exp(x)
    return primitive(b)-primitive(a)

print(polynomial_exponential_integral(0,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 {
        "boundary": e,
        "remaining": e-1,
        "answer": e-(e-1),
    }

print(plain_language_example())

Continue learning

Integral Calculus: Accumulation & Area — all lessons
  1. Start with rectangles: rate × time = amount
  2. Definite integrals: adding many small contributions
  3. Core integral rules: undo a derivative, then check
  4. Antiderivatives and the fundamental theorem
  5. Integration techniques: substitution and integration by parts
  6. Improper integrals, densities and continuous expectations
  7. Numerical integration and a continuous cash-flow building block
  8. Substitution: reverse the chain rule without losing the bounds
  9. Integration by parts: transfer a derivative

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