---
title: Higher derivatives and concavity
heading: The rate of change of the rate of change
eyebrow: A5 · Lesson 24 · Higher derivatives
xp: 40
---

::: hook
Velocity is the rate of change of position; acceleration is the rate of change of velocity. In an LC circuit, the inductor's voltage depends on the rate of change of current, which depends on the rate of change of the capacitor's voltage, so the capacitor's voltage is governed by its **second** derivative. And when an amplifier's transfer curve bends, its second derivative is what creates harmonic distortion. The second derivative tells you which way, and how sharply, a curve bends.
:::

::: play
- The curve is $f(x) = x^3 - 3x$. The lower trace is $f''(x) = 6x$.
- Where is $f''$ positive, and what does the curve look like there? Where is it negative?
- Find the point where the bending changes direction.
:::
:::

```sim plot
view: graph
x: x = -2.5..2.5
y: y = -8..8
slider: a = -2.5..2.5 step 0.05 = 1
plot: x^3 - 3*x | label: f(x)
plot: 6*x | dashed | color: ch2 | label: f''(x)
plot: (a^3 - 3*a) + (3*a^2 - 3)*(x - a) | color: ch3 | label: tangent
point: a, a^3 - 3*a
readout: f''(a) = 6*a | digits: 3
```

::: predict
## A position is $x(t) = 4t^2 - t^3$. What is the acceleration at $t = 1$?

- [ ] 5
- [x] 2
- [ ] 8
- [ ] −6

::: reveal
2. Velocity is $x' = 8t - 3t^2$, and acceleration is $x'' = 8 - 6t$, which is 2 at $t = 1$. Differentiate twice, then substitute.
:::
:::

::: nameit
## Second and higher derivatives

The derivative of $f'$ is the **second derivative**, $f''$ or $\frac{d^2y}{dx^2}$; then $f'''$, and so on. Each measures the rate of change of the one before.

| Quantity | First derivative | Second derivative |
|---|---|---|
| position $x(t)$ | velocity | acceleration |
| charge $q(t)$ | current | rate of change of current |
| $\sin\omega t$ | $\omega\cos\omega t$ | $-\omega^2\sin\omega t$ |
| $e^{-t/\tau}$ | $-\frac{1}{\tau}e^{-t/\tau}$ | $\frac{1}{\tau^2}e^{-t/\tau}$ |

Sinusoids have a special property: $f'' = -\omega^2 f$. That's the equation of every oscillator. In an LC circuit, $v_L = L\frac{di}{dt}$ and $i = C\frac{dv}{dt}$ combine to $\frac{d^2v}{dt^2} = -\frac{1}{LC}v$, whose solutions are sinusoids at $\omega = 1/\sqrt{LC}$.

## Concavity

- $f'' > 0$: the slope is increasing; the curve bends upward (**concave up**), lying above its tangent lines.
- $f'' < 0$: the curve bends downward (**concave down**), below its tangents.
- An **inflection point** is where the concavity changes, usually where $f'' = 0$ (and changes sign).

The second derivative test (lesson 27) uses this: at a point where $f' = 0$, $f'' > 0$ means a minimum and $f'' < 0$ a maximum.

## Curvature and distortion

An amplifier's output for a small input $x$ around its bias point is approximately

$$y \approx y_0 + y'x + \tfrac{1}{2}y''x^2$$

The $x^2$ term turns a sine input into a sine plus a component at twice the frequency, since $\sin^2\omega t = \frac{1}{2}(1 - \cos 2\omega t)$. So the curvature $y''$ sets the second-harmonic distortion. A perfectly straight transfer curve, $y'' = 0$, produces none.
:::

::: example
## Find the inflection point of $f(x) = x^3 - 6x^2 + 4$, and say where it's concave up.

::: solution
1. **First and second derivatives.**
   $$f' = 3x^2 - 12x, \quad f'' = 6x - 12$$
2. **Where $f''$ changes sign.** $f''$ is zero at $x = 2$ and changes sign there, so the inflection point is
   $$(2, f(2)) = (2, -12)$$
3. **Concavity.** The curve is concave down for $x < 2$ ($f'' < 0$) and concave up for $x > 2$.

**Answer:** the inflection point is $(2, -12)$, and the curve is concave up for $x > 2$.
:::
:::

::: example
## Show that $v = 5\cos(1000t)$ satisfies $v'' = -\omega^2 v$, and find $\omega$ for an LC circuit with $L$ = 10 mH and $C$ = 100 µF.

::: solution
1. **Differentiate twice.**
   $$v' = -5000\sin(1000t)$$
   $$\begin{aligned} v'' &= -5{,}000{,}000\cos(1000t) \\ &= -10^6 v \end{aligned}$$
2. **Read off $\omega$.** So $\omega^2 = 10^6$ and $\omega = 1000$.
3. **The LC circuit.**
   $$\begin{aligned} \omega &= \frac{1}{\sqrt{LC}} \\ &= \frac{1}{\sqrt{0.01 \times 10^{-4}}} \\ &= \frac{1}{\sqrt{10^{-6}}} \\ &= 1000\ \text{rad/s} \end{aligned}$$
4. **Compare.** So this $v$ is exactly that circuit's natural oscillation, at $1000/2\pi = 159$ Hz.

**Answer:** $v'' = -10^6 v$, so $\omega = 1000$ rad/s, the same as the LC circuit's $1/\sqrt{LC}$ (159 Hz).
:::
:::

::: example
## A part's position is $s(t) = t^3 - 6t^2 + 9t$. Find its velocity and acceleration, and say when it's speeding up.

::: solution
1. **Velocity.**
   $$\begin{aligned} v &= s' \\ &= 3t^2 - 12t + 9 \\ &= 3(t - 1)(t - 3) \end{aligned}$$
2. **Acceleration.**
   $$\begin{aligned} a &= v' \\ &= 6t - 12 \end{aligned}$$
3. **Compare signs.** It speeds up when $v$ and $a$ have the same sign.
4. **From $t = 1$ to $t = 2$.** $v < 0$ and $a < 0$, so it speeds up moving backward.
5. **From $t = 2$ to $t = 3$.** It's slowing down.
6. **After $t = 3$.** Both are positive.

**Answer:** $v = 3t^2 - 12t + 9$ and $a = 6t - 12$; the part speeds up between $t = 1$ and $t = 2$ and after $t = 3$.
:::
:::

::: check
given: a = 2 | 3 | 5; b = 1 | 4; t = 1 | 2
answer: 2*a - 6*b*t

## A position is $x(t) = \given{a}t^2 - \given{b}t^3$. What is the acceleration at $t$ = {t}?

::: right
Right. $x'' = 2 \cdot \given{a} - 6 \cdot \given{b}t$ = {answer}.
:::

::: misses
- [2*a*t - 3*b*t^2] That's the velocity. Differentiate once more.
- [2*a - 3*b*t] The second derivative of $t^3$ is $6t$.
- [any] Not yet. Differentiate twice, then substitute $t$ = {t}.
:::
:::

::: check
given: A = 2 | 5; w = 100 | 377 | 1000
answer: A*w^2

## What is the largest value of $\left|\dfrac{d^2}{dt^2}\given{A}\sin(\given{w}t)\right|$?

::: right
Right. The second derivative is $-\given{A}\omega^2\sin(\omega t)$, peaking at $A\omega^2$ = {answer}.
:::

::: misses
- [A*w] That's the first derivative's peak. Each derivative brings another factor of $\omega$.
- [A*w*w*w] Two derivatives, so $\omega^2$.
- [any] Not yet. Differentiate twice: each time multiplies by $\omega$.
:::
:::

::: check
given: b = 3 | 6 | 9; c = 2 | 5
answer: b/3

## Where is the inflection point of $f(x) = x^3 - \given{b}x^2 + \given{c}x$? Give $x$.

::: right
Right. $f'' = 6x - 2 \cdot \given{b}$, zero at $x = \given{b}/3$ = {answer}.
:::

::: misses
- [2*b/3] Solve $6x - 2b = 0$: $x = b/3$.
- [b/6] $f'' = 6x - 2b$, so $x = 2b/6 = b/3$.
- [any] Not yet. Set $f''(x) = 0$.
:::
:::

::: check
given: L = 1 | 10 | 100; C = 1 | 10 | 100
answer: 1/sqrt(L*1e-3*C*1e-6)
unit: rad/s

## An LC circuit's capacitor voltage obeys $v'' = -\frac{1}{LC}v$. With $L$ = {L} mH and $C$ = {C} µF, what angular frequency does it oscillate at?

::: right
Right. $\omega^2 = 1/(LC)$, so $\omega$ = {answer}.
:::

::: misses
- [1/(L*1e-3*C*1e-6)] That's $\omega^2$. Take the square root.
- [1/(2*pi*sqrt(L*1e-3*C*1e-6))] That's in hertz. The question asks for rad/s.
- [any] Not yet. Compare with $v'' = -\omega^2 v$.
:::
:::

::: check
kind: choice

## An amplifier's transfer curve $y(x)$ has $y'' > 0$ at its bias point. A small sine goes in. What appears at the output besides the amplified sine?

- [x] A component at twice the frequency, from the curvature
- [ ] Nothing: small signals are always linear
- [ ] A component at half the frequency
- [ ] Only a DC shift, with no new frequency

::: right
Right. The $\frac{1}{2}y''x^2$ term squares the sine, and $\sin^2\omega t = \frac{1}{2} - \frac{1}{2}\cos 2\omega t$: a DC shift and a second harmonic.
:::

::: misses
- [4] The squared sine gives a DC part and a $\cos 2\omega t$ part.
- [any] Square a sine with the identity $\sin^2 u = \frac{1}{2}(1 - \cos 2u)$.
:::
:::

::: check
kind: parts
given: A = 2 | 5; w = 100 | 1000; t = 1 | 2

## $v = \given{A}\sin(\given{w}t)$, with $t$ in seconds. Evaluate at $t$ = {t} ms.

::: part
answer: -A*w^2*sin(w*t*1e-3)
tolerance: 0.5%

### What is $v''$?

::: misses
- [A*w^2*sin(w*t*1e-3)] Two derivatives of a sine bring a minus sign.
- [any] $v'' = -A\omega^2\sin\omega t$.
:::
:::

::: part
answer: -w^2
tolerance: 0.5%

### What is $v''/v$?

::: misses
- [any] Divide the two: everything but $-\omega^2$ cancels.
:::
:::

::: part
answer: -A*w^3*cos(w*t*1e-3)
tolerance: 0.5%

### What is $v'''$?

::: misses
- [A*w^3*cos(w*t*1e-3)] Differentiate $-A\omega^2\sin\omega t$ once more: the minus sign stays.
- [any] Differentiate $v''$.
:::
:::
:::

::: check
kind: derivation
vars: a = -2..2, x = -1..1

## Find the derivatives of $f(x) = e^{ax}$ and its $n$th derivative at 0.

::: step
answer: a*exp(a*x)

### What is $f'(x)$?
:::

::: step
answer: a^2*exp(a*x)

### What is $f''(x)$?
:::

::: step
answer: a^3*exp(a*x)

### What is $f'''(x)$? (The pattern continues: $f^{(n)}(0) = a^n$.)
:::

::: right
Right. Each derivative multiplies by $a$, which is why exponentials turn differential equations into algebra.
:::
:::

::: explain
## What does the sign of the second derivative tell you about a curve, and why?

::: model
The second derivative is the rate of change of the slope. If it's positive, the slope is increasing as you move right, so the curve keeps turning upward and bends like a cup, lying above its tangent lines. If it's negative, the slope is decreasing, so the curve turns downward like a cap and lies below its tangents. Where the second derivative changes sign, the bending changes direction: an inflection point.
:::
:::

::: practice

::: check
kind: expression
given: k = 2..7 int
answer: k^2*exp(k*x)
vars: x = -1..1

## Find the second derivative of $e^{\given{k}x}$.

::: misses
- [k*exp(k*x)] That's the first derivative.
- [any] Each derivative multiplies by {k}.
:::
:::

::: check
given: a = 1 | 4; x0 = 1 | 2
answer: 12*a*x0^2

## Find $f''(\given{x0})$ for $f(x) = \given{a}x^4$.

::: misses
- [4*a*x0^3] That's $f'$.
- [any] $f'' = 12ax^2$.
:::
:::

::: check
given: w = 2..50 int
answer: -w^2

## If $f = \cos(\given{w}t)$, then $f'' = kf$. What is $k$?

::: misses
- [w^2] The second derivative of cosine brings a minus sign.
- [-w] Two derivatives: $\omega^2$.
- [any] $f'' = -\omega^2 f$.
:::
:::
:::
