Derivatives of Polynomials and Exponential Functions
Computing every derivative from the limit definition is slow. This lesson proves the first shortcut rules (constants, powers, constant multiples, sums) and finds the derivative of the natural exponential function, the one function that is its own derivative.
For a gentler first look, see Power, Sum and Constant Rules and Derivatives of Exponentials and Logs. Here we prove each rule from the definition built in The Derivative as a Function:
Constants and the power rule
Constant rule. If , the difference quotient is for every , so . A horizontal line has slope zero everywhere.
Power rule. For every positive integer , .
Proof. Expand with the binomial theorem:
Every term after the first still contains a factor , so each tends to 0 as . What remains is . ∎
The rule holds for every real exponent, (on the domain where is defined). Negative integers follow from the quotient rule in the next lesson, and the general real case from logarithmic differentiation in Derivatives of Logarithmic Functions. So and .
Constant multiples, sums and differences
If and are differentiable and is a constant:
| Rule | Statement | Why |
|---|---|---|
| Constant multiple | factors out of the difference quotient, then the limit law for constants applies | |
| Sum | the quotient splits into two quotients; the limit of a sum is the sum of limits | |
| Difference | combine the two rules above with |
Together with the power rule these differentiate every polynomial term by term:
The check below confirms a messy example in SymPy and against a central difference quotient at one point.
import sympy as sp
x = sp.symbols('x')
p = 4*x**5 - 3*x**3 + 7*x - 2 + 6*sp.sqrt(x) - 1/x**2
dp = sp.diff(p, x)
print("p'(x) =", dp)
f = sp.lambdify(x, p)
h = 1e-5
numeric = (f(2 + h) - f(2 - h)) / (2*h)
print("exact p'(2) =", sp.nsimplify(dp.subs(x, 2)), "≈", float(dp.subs(x, 2)))
print("numeric p'(2) ≈", round(numeric, 6))p'(x) = 20*x**4 - 9*x**2 + 7 + 2/x**3 + 3/sqrt(x)
exact p'(2) = 3*sqrt(2)/2 + 1165/4 ≈ 293.37132034355966
numeric p'(2) ≈ 293.37132
SymPy prints x**4 for and sqrt(x) for ; is the derivative of , and that of .
Exponential functions
Take with . The exponent law lets us pull out:
So the derivative of an exponential is proportional to the function itself, and the constant is the slope at 0, . The table below estimates numerically:
import math
for b in [2, 2.5, 2.7, 2.718281828, 2.8, 3]:
h = 1e-7
m = (b**h - 1) / h
print(f"b = {b:<12} slope at 0 ≈ {m:.6f} ln b = {math.log(b):.6f}")b = 2 slope at 0 ≈ 0.693147 ln b = 0.693147
b = 2.5 slope at 0 ≈ 0.916291 ln b = 0.916291
b = 2.7 slope at 0 ≈ 0.993252 ln b = 0.993252
b = 2.718281828 slope at 0 ≈ 1.000000 ln b = 1.000000
b = 2.8 slope at 0 ≈ 1.029619 ln b = 1.029619
b = 3 slope at 0 ≈ 1.098612 ln b = 1.098612
The slope grows with : it is below 1 for and above 1 for , so by continuity some base between them has slope exactly 1 at 0. That base is defined to be :
The numbers also show , which we prove in Derivatives of Logarithmic Functions: writing and using the chain rule gives .
Note: is the only function (up to a constant factor) that equals its own derivative. If , then , so is constant (a consequence of the Mean Value Theorem). That is why shows up whenever a rate is proportional to an amount, as in Exponential Growth and Decay.
Tangent lines and normal lines
With these rules, tangent lines are quick. For at : , , , so the tangent is . The normal line is perpendicular to the tangent, with slope ; here .
import sympy as sp
x = sp.symbols('x')
f = sp.exp(x) - 2*x
df = sp.diff(f, x)
print("f'(x) =", df)
crit = sp.solve(sp.Eq(df, 0), x)
print("horizontal tangent at x =", crit, "≈", [round(float(c), 4) for c in crit])
a = crit[0]
print("point:", (a, sp.simplify(f.subs(x, a))))f'(x) = exp(x) - 2
horizontal tangent at x = [log(2)] ≈ [0.6931]
point: (log(2), 2 - 2*log(2))
SymPy writes as log. The horizontal tangent sits where , at .
In software
- Loss curves and learning rates: a model whose error shrinks like has a rate of decrease proportional to the remaining error. Plotting turns this into a straight line of slope .
- Polynomial easing: UI animation curves such as (smoothstep) are chosen because their derivative is 0 at both ends, so motion starts and stops gently (Easing Curves).
- Autodiff: libraries like PyTorch store a derivative rule for each primitive (
pow,exp,add), exactly the table in this lesson, and combine them (Automatic Differentiation). - Compound growth: : continuously compounded money grows at a rate equal to times the balance.
Exercises
Exercise 1: Term by term
Differentiate .
Answer
Solution
Exercise 2: Where is the tangent horizontal?
Find all where has a horizontal tangent.
Answer
and
Solution
Exercise 3: Tangent to an exponential
Find the tangent line to at .
Answer
Solution
Exercise 4: Prove a fourth power
Using only the definition (no power rule), show that . Then check the expansion in SymPy.
Answer
Solution
import sympy as sp
x, h = sp.symbols('x h')
q = sp.expand(((x + h)**4 - x**4) / h)
print(q)
print(sp.limit(q, h, 0))h**3 + 4*h**2*x + 6*h*x**2 + 4*x**3
4*x**3
Exercise 5: The slope of
Write a short program that estimates at with a central difference and compares it with .
Answer
Both are about .
Solution
, so at 3 the slope is .
import math
h = 1e-5
numeric = (2**(3 + h) - 2**(3 - h)) / (2*h)
print(round(numeric, 6), round(8 * math.log(2), 6))5.545177 5.545177
Test yourself
What is the derivative of ?
Which property defines the number ?
- is the base where
- is the base whose exponential has slope 1 at
- exactly
- is the only base with
In the proof of the power rule, why do the terms after vanish?
- They are all negative
- Their binomial coefficients are zero
- Each still contains a factor of , which tends to 0
- They cancel in pairs