02.06 Lesson 6 of 12
1 hDerivatives & Rates of Change
Understand a derivative as the local rate of change and use basic differentiation rules to reason about how a function responds to its input.
By the end of this lesson
You will be able to
- Explain average versus instantaneous rate of change.
- Interpret a derivative as the slope of a tangent.
- Apply the power rule to simple functions.
- Use a finite difference to approximate a derivative.
The derivative is a local slope
The average rate of change between two points is (f(x + h) - f(x)) / h. The derivative is the limit as the step h approaches zero. Geometrically, it is the slope of the tangent line at a point. A positive derivative means the function is increasing locally; a negative derivative means it is decreasing locally.
def f(x):
return x ** 2
x = 3.0
h = 1e-5
numerical = (f(x + h) - f(x)) / h
print(numerical) # approximately 6 Use the power rule
For f(x) = xⁿ, the power rule gives f'(x) = n xⁿ⁻¹. Constants differentiate to zero, and a constant multiplier stays outside the derivative. For example, if f(x) = 3x² + 2x + 5, then f'(x) = 6x + 2. This derivative tells you the local change in output for a small change in the input.
# f(x) = 3x^2 + 2x + 5
# f'(x) = 6x + 2
x = 4
derivative = 6 * x + 2
print(derivative) # 26 Apply what you learned
ExerciseCheck a derivative with a finite difference
Compare an analytic derivative with a numerical approximation at several points.
- Define
f(x) = 3x**2 + 2x + 5. - Write its derivative as a separate Python function.
- Approximate the derivative using a small positive
h. - Compare analytic and numerical results at
x = -1,0and4. - Try a much larger step and explain why the approximation changes.
The numerical estimate approaches the analytic derivative as h becomes small, while you can explain that a finite step is an approximation rather than the exact limit.
Free references
Study resources
- 01 Derivative formulas through geometry | Chapter 3 Video
Watch the single chapter for the geometric meaning of a derivative and the basic rules.
Check your understanding
Self-test
-
Question 1
What does
f'(x) = 0tell you?The tangent is horizontal at that point. It may be a local maximum, minimum or another stationary point; zero alone does not identify which. -
Question 2
What does the power rule give for
f(x) = 5x⁴?f'(x) = 20x³.
Completion check
Move on when
You can differentiate a basic polynomial and verify its local slope with a finite-difference approximation.