TExcelTAD
Home › Calculus in Depth › Derivatives of Polynomials and Exponential Functions

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:

f′(x)=lim⁡h→0f(x+h)−f(x)hf'(x) = \lim_{h \to 0} \frac{f(x + h) - f(x)}{h}

Constants and the power rule

Constant rule. If f(x)=cf(x) = c, the difference quotient is (c−c)/h=0(c - c)/h = 0 for every h≠0h \ne 0, so f′(x)=0f'(x) = 0. A horizontal line has slope zero everywhere.

Power rule. For every positive integer nn, ddxxn=n⋅xn−1\frac{d}{dx} x^n = n \cdot x^{n-1}.

Proof. Expand (x+h)n(x + h)^n with the binomial theorem:

(x+h)n=xn+n⋅xn−1⋅h+C(n,2)⋅xn−2⋅h2+…+hn(x+h)n−xnh=n⋅xn−1+C(n,2)⋅xn−2⋅h+…+hn−1\begin{aligned} (x + h)^n &= x^n + n \cdot x^{n-1} \cdot h + C(n,2) \cdot x^{n-2} \cdot h^2 + \ldots + h^n \\[1ex] \frac{(x + h)^n - x^n}{h} &= n \cdot x^{n-1} + C(n,2) \cdot x^{n-2} \cdot h + \ldots + h^{n-1} \end{aligned}

Every term after the first still contains a factor hh, so each tends to 0 as h→0h \to 0. What remains is n⋅xn−1n \cdot x^{n-1}. ∎

The rule holds for every real exponent, ddxxr=r⋅xr−1\frac{d}{dx} x^r = r \cdot x^{r-1} (on the domain where xrx^r 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 ddxx=ddxx1/2=12x\frac{d}{dx} \sqrt{x} = \frac{d}{dx} x^{1/2} = \frac{1}{2\sqrt{x}} and ddx1x3=−3x−4\frac{d}{dx} \frac{1}{x^3} = -3x^{-4}.

Constant multiples, sums and differences

If ff and gg are differentiable and cc is a constant:

Rule Statement Why
Constant multiple (c⋅f)′=c⋅f′(c \cdot f)' = c \cdot f' cc factors out of the difference quotient, then the limit law for constants applies
Sum (f+g)′=f′+g′(f + g)' = f' + g' the quotient splits into two quotients; the limit of a sum is the sum of limits
Difference (f−g)′=f′−g′(f - g)' = f' - g' combine the two rules above with c=−1c = -1

Together with the power rule these differentiate every polynomial term by term:

p(x)=4x5−3x3+7x−2p′(x)=20x4−9x2+7\begin{aligned} p(x) &= 4x^5 - 3x^3 + 7x - 2 \\ p'(x) &= 20x^4 - 9x^2 + 7 \end{aligned}

The check below confirms a messy example in SymPy and against a central difference quotient at one point.

python · try it yourself
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 x4x^4 and sqrt(x) for x\sqrt{x}; 3/x3/\sqrt{x} is the derivative of 6x6\sqrt{x}, and 2/x32/x^3 that of −x−2-x^{-2}.

Exponential functions

Take f(x)=bxf(x) = b^x with b>0b > 0. The exponent law bx+h=bx⋅bhb^{x+h} = b^x \cdot b^h lets us pull bxb^x out:

f′(x)=lim⁡h→0bx⋅bh−bxh=bx⋅lim⁡h→0bh−1h=bx⋅f′(0)f'(x) = \lim_{h \to 0} \frac{b^x \cdot b^h - b^x}{h} = b^x \cdot \lim_{h \to 0} \frac{b^h - 1}{h} = b^x \cdot f'(0)

So the derivative of an exponential is proportional to the function itself, and the constant is the slope at 0, m(b)=lim⁡bh−1hm(b) = \lim \frac{b^h - 1}{h}. The table below estimates m(b)m(b) numerically:

python · try it yourself
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 bb: it is below 1 for b=2b = 2 and above 1 for b=3b = 3, so by continuity some base between them has slope exactly 1 at 0. That base is defined to be e≈2.71828e \approx 2.71828:

e is the unique number with lim⁡h→0eh−1h=1,and thenddxex=exe \text{ is the unique number with } \lim_{h \to 0} \frac{e^h - 1}{h} = 1, \quad\text{and then}\quad \frac{d}{dx} e^x = e^x

The numbers also show m(b)=ln⁡bm(b) = \ln b, which we prove in Derivatives of Logarithmic Functions: writing bx=exln⁡bb^x = e^{x \ln b} and using the chain rule gives ddxbx=bx⋅ln⁡b\frac{d}{dx} b^x = b^x \cdot \ln b.

Note: exe^x is the only function (up to a constant factor) that equals its own derivative. If y′=yy' = y, then (y⋅e−x)′=y′e−x−ye−x=0(y \cdot e^{-x})' = y'e^{-x} - ye^{-x} = 0, so y⋅e−xy \cdot e^{-x} is constant (a consequence of the Mean Value Theorem). That is why ee 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 f(x)=ex−2xf(x) = e^x - 2x at x=0x = 0: f(0)=1f(0) = 1, f′(x)=ex−2f'(x) = e^x - 2, f′(0)=−1f'(0) = -1, so the tangent is y=1−xy = 1 - x. The normal line is perpendicular to the tangent, with slope −1/f′(a)-1/f'(a); here y=1+xy = 1 + x.

python · try it yourself
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 ln⁡\ln as log. The horizontal tangent sits where ex=2e^x = 2, at x=ln⁡2x = \ln 2.

In software

  • Loss curves and learning rates: a model whose error shrinks like C⋅e−ktC \cdot e^{-kt} has a rate of decrease proportional to the remaining error. Plotting log⁡(loss)\log(\text{loss}) turns this into a straight line of slope −k-k.
  • Polynomial easing: UI animation curves such as 3t2−2t33t^2 - 2t^3 (smoothstep) are chosen because their derivative 6t−6t26t - 6t^2 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: ddtPert=r⋅Pert\frac{d}{dt} Pe^{rt} = r \cdot Pe^{rt}: continuously compounded money grows at a rate equal to rr times the balance.

Exercises

Exercise 1: Term by term

Differentiate f(x)=3x4−5x2+8/x+2xf(x) = 3x^4 - 5x^2 + 8/x + 2\sqrt{x}.

Answer

f′(x)=12x3−10x−8/x2+1/xf'(x) = 12x^3 - 10x - 8/x^2 + 1/\sqrt{x}

Solution
3x4→12x3−5x2→−10x8x−1→−8x−2=−8/x22x1/2→2⋅12x−1/2=1/x\begin{aligned} 3x^4 &\to 12x^3 \\ -5x^2 &\to -10x \\ 8x^{-1} &\to -8x^{-2} = -8/x^2 \\ 2x^{1/2} &\to 2 \cdot \tfrac{1}{2} x^{-1/2} = 1/\sqrt{x} \end{aligned}

Exercise 2: Where is the tangent horizontal?

Find all xx where g(x)=x3−6x2+9x+1g(x) = x^3 - 6x^2 + 9x + 1 has a horizontal tangent.

Answer

x=1x = 1 and x=3x = 3

Solution
g′(x)=3x2−12x+9=3(x2−4x+3)=3(x−1)(x−3)g′(x)=0  ⟺  x=1 or x=3\begin{aligned} &g'(x) = 3x^2 - 12x + 9 = 3(x^2 - 4x + 3) = 3(x - 1)(x - 3) \\ &g'(x) = 0 \iff x = 1 \text{ or } x = 3 \end{aligned}

Exercise 3: Tangent to an exponential

Find the tangent line to y=4ex−x2y = 4e^x - x^2 at x=0x = 0.

Answer

y=4x+4y = 4x + 4

Solution
y(0)=4⋅1−0=4y′=4ex−2x,y′(0)=4tangent: y−4=4(x−0)→y=4x+4\begin{aligned} &y(0) = 4 \cdot 1 - 0 = 4 \\ &y' = 4e^x - 2x, \quad y'(0) = 4 \\ &\text{tangent: } y - 4 = 4(x - 0) \to y = 4x + 4 \end{aligned}

Exercise 4: Prove a fourth power

Using only the definition (no power rule), show that ddxx4=4x3\frac{d}{dx} x^4 = 4x^3. Then check the expansion in SymPy.

Answer

(x+h)4−x4h=4x3+6x2h+4xh2+h3→4x3\frac{(x + h)^4 - x^4}{h} = 4x^3 + 6x^2h + 4xh^2 + h^3 \to 4x^3

Solution
(x+h)4=x4+4x3h+6x2h2+4xh3+h4subtract x4, divide by h:4x3+6x2h+4xh2+h3let h→0:4x3\begin{aligned} &(x + h)^4 = x^4 + 4x^3h + 6x^2h^2 + 4xh^3 + h^4 \\ &\text{subtract } x^4, \text{ divide by } h{:} \quad 4x^3 + 6x^2h + 4xh^2 + h^3 \\ &\text{let } h \to 0{:} \quad 4x^3 \end{aligned}
python · try it yourself
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 2x2^x

Write a short program that estimates ddx2x\frac{d}{dx} 2^x at x=3x = 3 with a central difference and compares it with 23⋅ln⁡22^3 \cdot \ln 2.

Answer

Both are about 5.5451775.545177.

Solution

ddx2x=2x⋅ln⁡2\frac{d}{dx} 2^x = 2^x \cdot \ln 2, so at 3 the slope is 8⋅ln⁡2≈5.5451778 \cdot \ln 2 \approx 5.545177.

python · try it yourself
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 x−2x^{-2} ?

  1. −2x−3-2x^{-3}
  2. −2x−1-2x^{-1}
  3. 2x−32x^{-3}
  4. −x−3-x^{-3}

Which property defines the number ee?

  1. ee is the base where (eh−1)/h→0(e^h - 1)/h \to 0
  2. ee is the base whose exponential has slope 1 at x=0x = 0
  3. e=2.7e = 2.7 exactly
  4. ee is the only base with ex>0e^x > 0

In the proof of the power rule, why do the terms after n⋅xn−1n \cdot x^{n-1} vanish?

  1. They are all negative
  2. Their binomial coefficients are zero
  3. Each still contains a factor of hh, which tends to 0
  4. They cancel in pairs