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 : 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.
Start with a straight line: input, output and slope
- Evaluate the shifted input: .
- Subtract the original output: .
- Divide by the nonzero input change: .
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- Start with a straight line: input, output and slope
- Functions, limits and continuity
- The derivative: from an average slope to an instantaneous rate
- Core derivative rules: constants, powers and sums
- Derivative rules: powers, products, quotients and compositions
- Second derivatives, Taylor expansions and numerical error
- Stationary points, optimisation and Newton’s method
Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations