Search Knowledge

© 2026 LIBREUNI PROJECT

Calculus & Analysis / Overview

Derivatives: Rates of Change

Derivatives: Rates of Change

The derivative is the mathematical tool for measuring change. If limits are about “approaching,” derivatives are about “moving.”

1. The Instantaneous Rate of Change

We define the derivative f(x)f'(x) as the limit of the average rate of change as the interval goes to zero: f(x)=limh0f(x+h)f(x)hf'(x) = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}

Instead of jumping to rules, let’s calculate the slope of f(x)=x2f(x) = x^2 at x=1x=1 by making hh smaller and smaller. This is exactly what your computer does when it performs Numerical Differentiation.

python
1def f(x): return x**2
2 
3x_target = 1.0
4h_values = [0.1, 0.01, 0.001, 0.0001]
5 
6print(f"{'h':<10} | {'Estimated Slope':<15}")
7print("-" * 30)
8 
9for h in h_values:
10 slope = (f(x_target + h) - f(x_target)) / h
11 print(f"{h:<10} | {slope:<15.6f}")
12 
13print("-" * 30)
14print("The limit seems to be 2.0, which matches the power rule (2x).")

2. Linear Approximation

Around a point aa, we can approximate a complex function f(x)f(x) with a simple line defined by the derivative: f(x)f(a)+f(a)(xa)f(x) \approx f(a) + f'(a)(x-a)

This is why derivatives are so powerful: they turn complex, curvy problems into simple, linear ones.

python
1import numpy as np
2import matplotlib.pyplot as plt
3 
4def f(x): return np.sin(x)
5def df(x): return np.cos(x) # Derivative of sin is cos
6 
7a = 1.0 # Point of approximation
8x_range = np.linspace(0, 2, 100)
9 
10# Linear approx: L(x) = f(a) + f'(a)(x-a)
11linear_approx = f(a) + df(a) * (x_range - a)
12 
13plt.plot(x_range, f(x_range), label='True sin(x)', linewidth=2)
14plt.plot(x_range, linear_approx, '--', label='Linear Approx', color='r')
15plt.scatter([a], [f(a)], color='black', zorder=5)
16plt.title("Linear Approximation (Tangent Line) at x=1")
17plt.legend()
18plt.show()

3. The Rules of Calculus

To avoid numerical limits, we use rules. The Chain Rule is particularly vital for modern AI, as it powers backpropagation. ddxf(g(x))=f(g(x))g(x)\frac{d}{dx} f(g(x)) = f'(g(x)) \cdot g'(x)

What is the derivative of f(x) = sin(x^2)?

4. Optimization: Finding Extremes

If a smooth function reaches a peak or valley, its slope must be zero. These are Critical Points.

python
1import numpy as np
2import matplotlib.pyplot as plt
3 
4# f(x) = x^4 - 4x^2
5def f(x): return x**4 - 4*x**2
6def df(x): return 4*x**3 - 8*x # 4x(x^2 - 2) = 0 => x=0, x=±sqrt(2)
7 
8x = np.linspace(-2.5, 2.5, 500)
9plt.plot(x, f(x))
10plt.axhline(0, color='k', alpha=0.3)
11plt.title("Find the valleys: f'(x) = 0")
12plt.show()

5. Summary Check

If f'(x) > 0 on an interval, the function is:

Previous Module Complex Analysis