---
title: Derivatives of e^x, sin and cos
heading: The functions that are their own rate of change
eyebrow: A5 · Lesson 11 · Derivatives of exp, sin and cos
xp: 40
---

::: hook
Most functions change into something else when you differentiate them. A few don't: $e^x$ is exactly its own slope, and the slope of a sine is the same wave shifted a quarter cycle. That's why these functions fill electrical engineering. Circuits are governed by rates of change, and only functions that keep their shape under differentiation can satisfy those equations.

::: play
- The yellow curve is $\sin x$. The blue curve is its slope at every $x$, measured numerically from the yellow curve. The dashed curve is $\cos x$.
- Move $k$ to speed the sine up, $\sin(kx)$. What happens to the size of its slope curve?
- At which $x$ is the sine steepest, and what is the slope curve doing there?
:::
:::

```sim plot
view: graph
x: x = 0..12.6
y: y = -3.5..3.5
slider: k = 0.5..3 step 0.1 = 1
plot: sin(k*x) | label: sin(kx)
plot: (sin(k*(x + 0.00001)) - sin(k*(x - 0.00001)))/0.00002 | color: ch2 | label: its slope
plot: k*cos(k*x) | dashed | color: ch3 | label: k cos(kx)
readout: largest slope = k
```

::: predict
## At $x = 0$, $e^x = 1$. What is the slope of $e^x$ at $x = 0$?

- [ ] 0
- [x] 1
- [ ] $e$
- [ ] 2.3

::: reveal
1, the same as the function's value. And at $x = 2$, where $e^x \approx 7.39$, the slope is also about 7.39. That's what makes $e$ special: of all the exponentials $b^x$, it's the one whose slope equals its value everywhere. For $10^x$, say, the slope is $2.303 \times 10^x$, with an awkward factor of $\ln 10$.
:::
:::

::: nameit
## The table to know

| $f(x)$ | $f'(x)$ |
|---|---|
| $e^{x}$ | $e^{x}$ |
| $e^{kx}$ | $k\,e^{kx}$ |
| $\sin x$ | $\cos x$ |
| $\cos x$ | $-\sin x$ |
| $\ln x$ | $1/x$ |
| $b^{x}$ | $(\ln b)\, b^{x}$ |

All angles in radians: the clean results depend on $\lim_{h \to 0} \sin h/h = 1$, which is true only in radians.

**Why $e^x$ is its own slope.** From the definition,

$$\frac{e^{x + h} - e^{x}}{h} = e^{x}\cdot\frac{e^{h} - 1}{h} \;\to\; e^{x} \cdot 1$$

using the limit from lesson 2.

**Why sine gives cosine.** The angle-sum identity gives $\sin(x + h) = \sin x\cos h + \cos x\sin h$. For small $h$, $\cos h \approx 1$ and $\sin h \approx h$, so the change in $\sin$ over a step $h$ is about $h\cos x$, and the slope is $\cos x$.

**With the chain rule**, the ones you'll use most in circuits:

$$\frac{d}{dt}e^{-t/\tau} = -\frac{1}{\tau}e^{-t/\tau} \qquad \frac{d}{dt}A\sin(\omega t + \varphi) = A\omega\cos(\omega t + \varphi)$$

The first says a decaying exponential falls at a rate proportional to what's left, the property behind every RC and RL transient. The second is the phasor rule from A3, now proved: differentiating multiplies the amplitude by ω and shifts the wave a quarter cycle ahead.
:::

::: example
## Differentiate $v(t) = 5e^{-t/2}$ and find its slope at $t = 0$.

::: solution
1. **Differentiate.**
   $$\begin{aligned} v'(t) &= 5 \cdot \left(-\frac{1}{2}\right)e^{-t/2} \\ &= -2.5e^{-t/2} \end{aligned}$$
2. **Evaluate at $t = 0$.**
   $$v'(0) = -2.5$$
3. **Check.** The slope at the start is the starting value divided by the time constant, with a minus sign.

**Answer:** $v'(t) = -2.5e^{-t/2}$, and its slope at $t = 0$ is $-2.5$.
:::
:::

::: example
## What is the largest rate of change of $v = 3\sin(100t)$?

::: solution
1. **Differentiate.**
   $$v' = 300\cos(100t)$$
2. **Find the peak.** It peaks at 300 when $\cos = 1$: at the zero crossings of $v$, where the sine is steepest.

**Answer:** the largest rate of change is 300, at the zero crossings of $v$.
:::
:::

::: example
## A ringing current is $i = 2e^{-100t}\sin(1000t)$ A. How fast is it rising at $t = 0$, and when does it first peak?

::: solution
1. **Product rule.**
   $$\begin{aligned} i' &= 2e^{-100t}\big(1000\cos(1000t) \\ &\quad - 100\sin(1000t)\big) \end{aligned}$$
2. **Rate at $t = 0$.**
   $$\begin{aligned} i'(0) &= 2 \times 1000 \\ &= 2000\ \text{A/s} \end{aligned}$$
3. **Set $i' = 0$ for the first peak.**
   $$1000\cos(1000t) = 100\sin(1000t)$$
   so $\tan(1000t) = 10$.
4. **Solve for $t$.**
   $$\begin{aligned} t &= \frac{\tan^{-1}(10)}{1000} \\ &= 1.471\ \text{ms} \end{aligned}$$
5. **Compare with an undamped sine.** The decay pulls the peak a little earlier than the 1.571 ms of an undamped sine.

**Answer:** the current rises at 2000 A/s at $t = 0$ and first peaks at 1.471 ms.
:::
:::

::: check
kind: expression
answer: -V0/tau*exp(-t/tau)
vars: V0 = 1..10, tau = 0.5..3, t = 0..5

## Differentiate $v(t) = V_0\,e^{-t/\tau}$ with respect to $t$.

::: right
Right. The chain rule brings down the inner rate, $-1/\tau$.
:::

::: misses
- [V0*exp(-t/tau)] Multiply by the derivative of the exponent, $-1/\tau$.
- [V0/tau*exp(-t/tau)] The exponent's rate is $-1/\tau$: the slope of a decay is negative.
- [-t/tau*V0*exp(-t/tau)] Multiply by the derivative of the exponent, which is $-1/\tau$, not the exponent itself.
- [any] Not yet. Use $\frac{d}{dt}e^{kt} = ke^{kt}$ with $k = -1/\tau$.
:::
:::

::: check
kind: expression
answer: A*w*cos(w*t + p)
vars: A = 1..5, w = 1..10, t = 0..2, p = -1..1

## Differentiate $A\sin(\omega t + \varphi)$ with respect to $t$.

::: right
Right. Sine becomes cosine, and the chain rule multiplies by ω.
:::

::: misses
- [A*cos(w*t + p)] Multiply by the derivative of the inside, ω.
- [-A*w*cos(w*t + p)] The slope of sine is $+\cos$; it's cosine whose slope is $-\sin$.
- [A*w*sin(w*t + p)] The derivative of sine is cosine.
- [any] Not yet. $\frac{d}{dt}\sin(u) = \cos(u)\,\frac{du}{dt}$.
:::
:::

::: check
given: V0 = 2..12 int V; tau = 1m..10m E6 s
answer: -V0/tau
unit: V/s
tolerance: 1%

## A capacitor discharges as $v = V_0e^{-t/\tau}$ with $V_0$ = {V0} and $\tau$ = {tau}. What is $dv/dt$ at $t = 0$, in volts per second?

::: right
Right. At $t = 0$ it's $-V_0/\tau$ = {answer}.
:::

::: misses
- [V0/tau] The voltage is falling, so the rate is negative.
- [-V0*tau] Divide by τ: the rate is $-V_0/\tau$.
- [any] Not yet. Evaluate $-\frac{V_0}{\tau}e^{-t/\tau}$ at $t = 0$.
:::
:::

::: check
kind: expression
answer: exp(-a*t)*(w*cos(w*t) - a*sin(w*t))
vars: a = 0.5..2, w = 1..5, t = 0..3

## Differentiate the damped sine $e^{-at}\sin(\omega t)$.

::: right
Right. Product rule: $-ae^{-at}\sin\omega t + e^{-at}\,\omega\cos\omega t$.
:::

::: misses
- [-a*w*exp(-a*t)*cos(w*t)] That's the product of the two derivatives. Use the product rule.
- [exp(-a*t)*(w*cos(w*t) + a*sin(w*t))] The exponential's derivative is $-ae^{-at}$: that term is negative.
- [any] Not yet. Product rule, with $f = e^{-at}$ and $g = \sin\omega t$.
:::
:::

::: check
kind: parts
given: V0 = 5 | 12; tau = 1 | 2 | 5; t = 1 | 3

## A capacitor discharges as $v = \given{V0}e^{-t/\tau}$ with $\tau$ = {tau} ms.

::: part
answer: V0*exp(-t/tau)
unit: V
tolerance: 0.5%

### What is $v$ at $t$ = {t} ms?

::: misses
- [any] Put $t$ and $\tau$ in the same units.
:::
:::

::: part
answer: -V0/(tau*1e-3)*exp(-t/tau)
unit: V/s
tolerance: 0.5%

### What is $dv/dt$ there, in volts per second?

::: misses
- [-V0/tau*exp(-t/tau)] That's in volts per millisecond. Put $\tau$ in seconds.
- [any] $\frac{dv}{dt} = -\frac{v}{\tau}$.
:::
:::

::: part
answer: tau*1e-3*ln(100)
unit: s
tolerance: 0.5%

### When has the slope fallen to 1% of its starting value?

::: misses
- [tau*1e-3*log(100)] Use the natural log.
- [any] The slope decays like $v$ itself: solve $e^{-t/\tau} = 0.01$.
:::
:::
:::

::: check
kind: derivation
vars: A = 0.5..5, w = 1..10, p = -3..3, t = 0..2

## Show that $v = A\sin(\omega t + \varphi)$ satisfies $v'' = -\omega^2v$.

::: step
answer: A*w*cos(w*t + p)

### Find $v'$.
:::

::: step
answer: -A*w^2*sin(w*t + p)

### Find $v''$.
:::

::: right
Right. $v'' = -\omega^2v$: the equation of every LC circuit and spring, solved by every sinusoid at $\omega$.
:::
:::

::: explain
## Why are exponentials and sinusoids the natural answers to circuit equations?

::: model
Capacitors and inductors relate a quantity to its rate of change, so circuit equations say things like "this voltage plus τ times its rate of change is constant". To satisfy that at every instant, a function's rate of change has to look like the function itself. Exponentials do exactly that: the slope of $e^{kt}$ is $k$ times itself. Sinusoids do it in pairs, sine turning into cosine and back with a factor of ω, so they're what a circuit driven at one frequency settles into.
:::
:::

::: practice

::: check
kind: expression
given: k = 2..9 int
answer: -k*sin(k*x)
vars: x = -2..2

## Differentiate $\cos(\given{k}x)$.

::: misses
- [k*sin(k*x)] The slope of cosine is $-\sin$.
- [-sin(k*x)] Multiply by the inside's rate, {k}.
- [any] Chain rule: $-\sin(u)\cdot u'$.
:::
:::

::: check
kind: expression
given: a = 2..9 int
answer: a/x
vars: x = 0.5..4

## Differentiate $\given{a}\ln x$.

::: misses
- [1/x] Keep the constant {a}.
- [any] $\frac{d}{dx}\ln x = 1/x$.
:::
:::

::: check
given: I0 = 1..9 int; tau = 1..9 int; t = 1..5 int
answer: -I0/tau*exp(-t/tau)
unit: A/ms
tolerance: 1%

## An inductor's current is $i = \given{I0}e^{-t/\given{tau}}$ amps, with t in ms. What is $di/dt$ at $t$ = {t} ms, in amps per millisecond?

::: misses
- [I0*exp(-t/tau)] That's the current itself. Differentiate it.
- [I0/tau*exp(-t/tau)] The current is decaying, so its rate is negative.
- [any] $\frac{d}{dt}I_0e^{-t/\tau} = -\frac{I_0}{\tau}e^{-t/\tau}$.
:::
:::

::: check
given: A = 1..9 int; w = 10..400 sig 2
answer: A*w
unit: V/s
tolerance: 1%

## What is the largest rate of change of $\given{A}\cos(\given{w}t)$ volts, in volts per second?

::: misses
- [A] Multiply by ω: faster waves are steeper.
- [any] The derivative is $-A\omega\sin(\omega t)$, whose largest size is $A\omega$.
:::
:::
:::
