Trading Dev AcademyFree quant education

Free lesson · Differential calculus

Start with a straight line: input, output and slope

Open interactive lessonPractice calculationsExplore labs

Start with the idea

  • First calculate outputs.
  • Then compare two outputs.
  • A slope is output change divided by input change.
Symbols, units & horizon
  • x: starting input, dimensionless here
  • f(x): output, dimensionless here
  • h: nonzero input change
  • f(x+h): output after that change
  • /: divide the output change by the input change

When and why to use this

Use a slope to understand a sensitivity. For a fixed holding, value changes linearly with price; the slope is the quantity held.

  • Function: a rule that maps an input to an output.
  • Read f(x) as “the output of f at input x.”
  • Use f(x)=2x+1: multiply x by 2, then add 1.
  • Input 1 gives output 3. Input 2 gives output 5.
  • Slope: rise divided by run.
  • A straight line has the same slope over every nonzero interval.
f(x)=2x+1,f(x+h)−f(x)h=2(h≠0)
Core rule · definition and worked arithmetic

Start with a straight line: input, output and slope

  1. Evaluate the shifted input: f(x+h)=2x+2h+1.
  2. Subtract the original output: f(x+h)−f(x)=2h.
  3. Divide by the nonzero input change: 2hh=2.
Work it by hand

From x=1 to x=2, slope=(5−3)/(2−1)=2. From x=1 to x=1.1, slope=(3.2−3)/.1=2.

Use the rule

  • Name the inputs and units.
  • Work the small example by hand.
  • Check the result before continuing to the next lesson.

Before moving on

Explain the core rule in one sentence, reproduce the worked calculation and solve both practice variations.

Further reading: OpenStax · Differentiation rules · textbook checked 12 September 2026 ↗

Research sources, review dates and limitations

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.

def line(x):
    return 2*x+1

def line_slope(x, h):
    if h == 0: raise ValueError("Nonzero input change required")
    return (line(x+h)-line(x))/h

print(line(1), line(2), line_slope(1,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