---
title: Curve sketching from derivatives
heading: Reading the shape before you plot it
eyebrow: A5 · Lesson 29 · Curve sketching
xp: 40
---

::: hook
A plotting tool draws any function instantly, so why sketch by hand? Because the sketch tells you *why* the curve looks the way it does: where it peaks, where it turns over, what it does far away. That's how you sanity-check a simulator's output, predict a filter's response before building it, or spot that a formula you've derived can't be right. The first and second derivatives, plus the limits at the edges, give you the whole shape.
:::

::: play
- The curve is $f(x) = \dfrac{x}{1 + x^2}$, with $f'$ and $f''$ as faint traces.
- Find where $f'$ crosses zero and match it to the curve's peaks.
- Find where $f''$ crosses zero and match it to where the curve's bending changes.
:::
:::

```sim plot
view: graph
x: x = -5..5
y: y = -1.5..1.5
plot: x/(1 + x^2) | label: f(x)
plot: (1 - x^2)/(1 + x^2)^2 | dashed | color: ch2 | label: f′(x)
plot: 2*x*(x^2 - 3)/(1 + x^2)^3 | dashed | color: ch3 | label: f″(x)
point: 1, 0.5 | label: max
point: -1, -0.5 | label: min
```

::: predict
## Where does $f(x) = \dfrac{x}{1 + x^2}$ reach its maximum?

- [ ] At $x = 0$
- [x] At $x = 1$, with value $\frac{1}{2}$
- [ ] It keeps growing as $x$ grows
- [ ] At $x = \sqrt{3}$

::: reveal
At $x = 1$. $f'(x) = \frac{1 - x^2}{(1 + x^2)^2}$, zero at $x = \pm 1$; the function rises before 1 and falls after, and $f(1) = \frac{1}{2}$. For large $x$ it dies away like $1/x$. This shape, rising to a peak and falling back, is the magnitude of a band-pass filter's response against $\omega$, once you factor out the constants.
:::
:::

::: nameit
## A checklist

1. **Domain:** where is $f$ defined? Any vertical asymptotes?
2. **Intercepts:** $f(0)$, and the roots of $f(x) = 0$ if they're easy.
3. **Symmetry:** even ($f(-x) = f(x)$, mirror in the $y$ axis) or odd ($f(-x) = -f(x)$, symmetric through the origin)?
4. **End behavior:** $\lim_{x \to \pm\infty} f(x)$; horizontal asymptotes.
5. **First derivative:** where $f' > 0$, $f$ rises; where $f' < 0$, it falls. Zeros of $f'$ are candidates for peaks and valleys.
6. **Second derivative:** where $f'' > 0$, concave up; $f'' < 0$, concave down. Sign changes are inflection points.
7. **Plot the key points** and join them with the shapes the signs dictate.

## A worked shape

For $f(x) = \frac{x}{1 + x^2}$:
- defined everywhere, $f(0) = 0$, odd;
- $f \to 0$ as $x \to \pm\infty$ (horizontal asymptote $y = 0$);
- $f' = \frac{1 - x^2}{(1 + x^2)^2}$: rising on $(-1, 1)$, falling outside; maximum $\frac{1}{2}$ at $x = 1$, minimum $-\frac{1}{2}$ at $x = -1$;
- $f'' = \frac{2x(x^2 - 3)}{(1 + x^2)^3}$: inflection points at $x = 0$ and $x = \pm\sqrt3$.

## Why engineers sketch

A sketch shows structure a plot hides: that the peak is at exactly $x = 1$ whatever you scale it by, that the decay is like $1/x$, that the curve is symmetric. Those facts carry straight over to real circuits: the band-pass peak is at the resonant frequency, and its skirts fall at 20 dB per decade.
:::

::: example
## Sketch $f(x) = x^4 - 4x^3$.

::: solution
1. **Value and roots.** $f(0) = 0$, and the roots are at $x = 0$ and $x = 4$.
2. **First derivative.**
   $$\begin{aligned} f' &= 4x^3 - 12x^2 \\ &= 4x^2(x - 3) \end{aligned}$$
   zero at 0 and 3.
3. **Where it falls and rises.** $f'$ is negative before 3 (except at 0) and positive after, so $f$ falls to a minimum at $x = 3$, $f(3) = -27$. At 0 the slope is zero but doesn't change sign: no extreme.
4. **Second derivative.**
   $$\begin{aligned} f'' &= 12x^2 - 24x \\ &= 12x(x - 2) \end{aligned}$$
   so there are inflection points at 0 and 2.
5. **The ends.** As $x \to \pm\infty$, $f \to +\infty$.
6. **Put it together.** It comes down from the left, flattens momentarily at the origin, keeps falling to $-27$ at $x = 3$, and climbs away.

**Answer:** the curve falls from the left, flattens at the origin, reaches its minimum of $-27$ at $x = 3$ and climbs away, with inflection points at 0 and 2.
:::
:::

::: example
## Sketch the charging voltage $v(t) = 5(1 - e^{-t/2})$ for $t \ge 0$.

::: solution
1. **Start and end.** $v(0) = 0$, and $v \to 5$ as $t \to \infty$.
2. **First derivative.**
   $$v' = \frac{5}{2}e^{-t/2} > 0$$
   so it's always rising, steepest at the start (2.5 V per unit time).
3. **Second derivative.**
   $$v'' = -\frac{5}{4}e^{-t/2} < 0$$
   so it's always concave down, with no inflection.
4. **Put it together.** A curve that starts steep and flattens toward 5: the classic charging curve, its shape fixed by two signs.

**Answer:** the voltage rises from 0, steepest at the start, and flattens toward 5 V, concave down all the way.
:::
:::

::: example
## Sketch $f(x) = \dfrac{x}{1 + x^2}$.

::: solution
1. **Symmetry and ends.** It's odd, and $f \to 0$ at both ends, so $y = 0$ is an asymptote.
2. **First derivative.**
   $$f'(x) = \frac{1 - x^2}{(1 + x^2)^2}$$
   zero at $x = \pm 1$, with a maximum of $f(1) = \tfrac12$ and a minimum of $f(-1) = -\tfrac12$.
3. **Second derivative.**
   $$f''(x) = \frac{2x(x^2 - 3)}{(1 + x^2)^3}$$
   zero at $0$ and $\pm\sqrt{3}$, where the curve changes concavity.
4. **Height at $\sqrt{3}$.**
   $$\begin{aligned} f(\sqrt{3}) &= \frac{\sqrt{3}}{4} \\ &= 0.433 \end{aligned}$$
5. **Put it together.** The curve rises from 0 to its peak at 1, then sinks back toward the axis.

**Answer:** an odd curve through the origin, with a peak of $\tfrac12$ at $x = 1$, a dip of $-\tfrac12$ at $x = -1$, inflection points at 0 and $\pm\sqrt{3}$, and the $x$-axis as an asymptote at both ends.
:::
:::

::: check
given: a = 2 | 3 | 4
answer: a

## Where is the maximum of $f(x) = \dfrac{x}{\given{a}^2 + x^2}$ for $x > 0$?

::: right
Right. $f' = \frac{a^2 - x^2}{(a^2 + x^2)^2}$, zero at $x = \given{a}$.
:::

::: misses
- [a^2] Solve $a^2 - x^2 = 0$ for $x$.
- [0] At 0 the function is 0 and rising.
- [any] Not yet. Quotient rule, then set the top to zero.
:::
:::

::: check
given: a = 1 | 2 | 3
answer: 1/(2*a)
tolerance: 0.5%

## What is that maximum value of $\dfrac{x}{\given{a}^2 + x^2}$?

::: right
Right. $f(a) = \frac{a}{2a^2} = \frac{1}{2a}$ = {answer}.
:::

::: misses
- [1/a] $f(a) = a/(a^2 + a^2)$.
- [any] Not yet. Substitute $x = \given{a}$.
:::
:::

::: check
given: b = 2..12 int
answer: 3*b/4

## Where is the minimum of $f(x) = x^4 - \given{b}x^3$?

::: right
Right. $f' = x^2(4x - 3b)$, and the minimum is at $x = 3b/4$ = {answer}.
:::

::: misses
- [0] At 0 the slope is zero but doesn't change sign: not a minimum.
- [b] That's a root of $f$, not of $f'$.
- [any] Not yet. Factor $f'$ and check where it changes sign.
:::
:::

::: check
kind: choice

## $f'(x) > 0$ and $f''(x) < 0$ on an interval. Which describes the curve?

- [x] Rising, but more and more slowly
- [ ] Rising faster and faster
- [ ] Falling, but more and more slowly
- [ ] Falling faster and faster

::: right
Right. Positive slope that's decreasing: a charging capacitor's curve.
:::

::: misses
- [2] That would need $f'' > 0$.
- [any] $f'$ gives the direction; $f''$ says whether the slope grows or shrinks.
:::
:::

::: check
kind: choice

## Which symmetry does $f(x) = \dfrac{x^3}{1 + x^2}$ have?

- [ ] Even: mirror symmetric in the $y$ axis
- [x] Odd: $f(-x) = -f(x)$
- [ ] Neither
- [ ] Both

::: right
Right. The top changes sign and the bottom doesn't.
:::

::: misses
- [1] Check $f(-x)$: the cube keeps the sign of $-x$.
- [any] Compute $f(-x)$ and compare with $f(x)$.
:::
:::

::: check
kind: parts
given: a = 1 | 2 | 3

## Sketch $f(x) = x^3 - 3\given{a}^2x$.

::: part
answer: -a
tolerance: 0.5%

### Where is its local maximum?

::: misses
- [a] That's the local minimum: $f''(a) > 0$.
- [any] $f'(x) = 3x^2 - 3a^2$; check $f''$ at each root.
:::
:::

::: part
answer: 2*a^3
tolerance: 0.5%

### What is the local maximum's value?

::: misses
- [-2*a^3] That's the minimum's value.
- [any] Put $x = -a$ into $f$.
:::
:::

::: part
answer: a*sqrt(3)
tolerance: 0.5%

### Where does it cross the $x$ axis, to the right of zero?

::: misses
- [any] $x(x^2 - 3a^2) = 0$.
:::
:::
:::

::: check
kind: derivation
vars: x = -3..3

## Find the inflection points of $f(x) = xe^{-x^2/2}$.

::: step
answer: (1 - x^2)*exp(-x^2/2)

### Find $f'$, factored.
:::

::: step
answer: (x^3 - 3*x)*exp(-x^2/2)

### Find $f''$, factored.
:::

::: step
answer: sqrt(3)

### Where is the positive inflection point?
:::

::: right
Right. $f''$ changes sign at $0$ and $\pm\sqrt{3}$.
:::
:::

::: explain
## A function has $f'(c) = 0$ but no maximum or minimum at $c$. How can that happen, and how would a sketch show it?

::: model
$f'(c) = 0$ means the tangent is flat at $c$, but a maximum or minimum also needs the slope to change sign there. If $f'$ is positive on both sides, like $x^3$ at 0, the curve rises, flattens for an instant, and keeps rising: a horizontal inflection point. The sketch shows a curve that levels off and then carries on in the same direction, with no peak or valley.
:::
:::

::: practice

::: check
given: k = 2..10 int
answer: 1/k
tolerance: 0.5%

## Where is the maximum of $t\,e^{-\given{k}t}$ for $t > 0$?

::: misses
- [k] Solve $1 - kt = 0$.
- [any] Set the derivative to zero.
:::
:::

::: check
given: a = 1..6 int
answer: sqrt(3)*a
tolerance: 0.5%

## Where is the positive inflection point of $\dfrac{x}{\given{a}^2 + x^2}$?

::: misses
- [a] That's the maximum.
- [any] $f''$ has the factor $x(x^2 - 3a^2)$.
:::
:::

::: check
given: V = 3 | 9; tau = 2 | 4
answer: V/tau
tolerance: 0.5%

## $v(t) = \given{V}(1 - e^{-t/\given{tau}})$. What is its steepest slope for $t \ge 0$?

::: misses
- [V] The slope at $t = 0$ is $V/\tau$.
- [any] It's steepest at $t = 0$.
:::
:::
:::
