---
title: The fundamental theorem of calculus
heading: Why integrating and differentiating undo each other
eyebrow: A14 · Lesson 18 · The fundamental theorem of calculus
xp: 40
---

::: hook
A capacitor's voltage is the running integral of its current divided by C; its current is C times the derivative of its voltage. That the two descriptions agree is the **fundamental theorem of calculus**, and with the Riemann integral now defined carefully it can be proved, with its conditions spelled out. The accumulated integral of any integrable function is continuous, even if the function jumps; it's differentiable wherever the function is continuous; and at such points its derivative gives the function back. A step in current makes a kink in voltage, never a jump.
:::

::: play
- The solid curve is $f(t) = \cos(kt)$; the dashed one is its running integral $F(x) = \int_0^x\cos(kt)\,dt = \frac{\sin kx}{k}$.
- At the marked x, the slope of F (readout) equals the height of f: $F' = f$.
- Raise k: f oscillates faster, and F gets smaller, since a fast oscillation cancels itself in the integral. Its slope is still exactly f.
:::
:::

```sim plot
view: graph
x: x = 0..6.3
y: y = -1.2..1.2
slider: k = 0.5..4 step 0.1 = 1
slider: x0 = 0..6.3 step 0.05 = 1
plot: cos(k*x) | label: f(t) = cos kt
plot: sin(k*x)/k | dashed | label: F(x) = ∫₀ˣ f
marker: x = x0 | label: x
readout: F(x) = sin(k*x0)/k
readout: slope of F at x = (sin(k*(x0 + 0.0001)) - sin(k*(x0 - 0.0001)))/(0.0002*k)
readout: f(x) = cos(k*x0)
```

::: predict
## $F(x) = \int_0^x u(t)\,dt$, where u is the unit step at t = 1. What does F look like?

- [ ] It jumps at x = 1
- [x] 0 until x = 1, then the ramp x − 1: continuous, with a corner at 1
- [ ] It's undefined at x = 1
- [ ] It's u(x) itself

::: reveal
A ramp starting at x = 1: continuous everywhere, differentiable everywhere except at 1, where its slope jumps from 0 to 1. Integration smooths: a jump in f becomes a corner in F. A capacitor charged by a step of current shows exactly this.
:::
:::

::: nameit
## The fundamental theorem

Let f be integrable on [a, b] and $F(x) = \int_a^xf(t)\,dt$.

1. F is continuous; in fact $\lvert F(x) - F(y)\rvert \le M\lvert x - y\rvert$ with $M = \sup\lvert f\rvert$.
2. If f is continuous at c, then F is differentiable at c and $F'(c) = f(c)$.
3. If G is any function with G′ = f on [a, b] (and f integrable), then

$$\int_a^bf(t)\,dt = G(b) - G(a)$$

## Tools that follow

- **Substitution:** $\int_a^bf(g(t))g'(t)\,dt = \int_{g(a)}^{g(b)}f(u)\,du$.
- **Integration by parts:** $\int_a^bfg' = [fg]_a^b - \int_a^bf'g$.
- **Variable limits (Leibniz):** $\frac{d}{dx}\int_a^{g(x)}f(t)\,dt = f(g(x))\,g'(x)$.
- **Mean value for integrals:** a continuous f takes its average value $\frac{1}{b - a}\int_a^bf$ somewhere in [a, b].

## In circuits

$v_C(t) = v_C(0) + \frac1C\int_0^ti(s)\,ds$ is continuous whenever the current is bounded: a capacitor's voltage can't jump unless an impulse of current flows. The same holds for an inductor's current.
:::

::: example
## Find $\frac{d}{dx}\int_0^{x^2}\sin t\,dt$ at x = 1.

::: solution
1. **Use the Leibniz form.** The derivative is
   $$\sin(x^2)\cdot 2x$$
2. **Put in x = 1.**
   $$2\sin 1 = 1.683$$
3. **Check directly.** The integral is $1 - \cos(x^2)$, whose derivative is $2x\sin(x^2)$, the same.

**Answer:** the derivative at x = 1 is $2\sin 1 = 1.683$.
:::
:::

::: example
## A 10 µF capacitor at 0 V is charged by $i(t) = 2e^{-t/0.5\text{ ms}}$ mA. What's its voltage at 1 ms?

::: solution
1. **Integrate the current.** With τ = 0.5 ms,
   $$v = \frac1C\int_0^{1\text{ ms}}2 \times 10^{-3}e^{-t/\tau}dt$$
2. **Evaluate the integral.**
   $$\begin{aligned} v &= \frac{2 \times 10^{-3}\times 0.5 \times 10^{-3}}{10^{-5}} \\ &\quad \times (1 - e^{-2}) \end{aligned}$$
3. **Put in the numbers.**
   $$\begin{aligned} v &= 0.1 \times 0.8647\ \text{V} \\ &= 86.5\ \text{mV} \end{aligned}$$

**Answer:** the capacitor is at 86.5 mV after 1 ms.
:::
:::

::: example
## Find $\frac{d}{dx}\int_x^{x^2}e^{-t^2}\,dt$ at x = 1.

::: solution
1. **Split at 0.**
   $$\int_x^{x^2} = \int_0^{x^2} - \int_0^x$$
2. **Differentiate each piece.** By the fundamental theorem and the chain rule, the derivative is
   $$e^{-x^4}\cdot 2x - e^{-x^2}$$
3. **Put in x = 1.**
   $$\begin{aligned} 2e^{-1} - e^{-1} &= e^{-1} \\ &= 0.368 \end{aligned}$$
4. **Why this works.** The integrand $e^{-t^2}$ has no elementary antiderivative, yet the derivative of the integral is exact: the fundamental theorem only needs the integrand to be continuous.

**Answer:** the derivative at x = 1 is $e^{-1} = 0.368$.
:::
:::

::: check
given: x = 1 | 1.5 | 0.7
answer: 2*x*sin(x^2)
tolerance: 0.1%

## What's $\frac{d}{dx}\int_0^{x^2}\sin t\,dt$ at x = {x}?

::: right
Right. $\sin(x^2)\cdot 2x$ = {answer}.
:::

::: misses
- [sin(x^2)] Multiply by the derivative of the upper limit, 2x.
- [any] Not yet. $f(g(x))\,g'(x)$.
:::
:::

::: check
given: b = 1 | 2 | 3; c = 1 | 4
answer: b^3/3 + c*b
tolerance: 0.01%

## What's $\int_0^{\given{b}}(t^2 + \given{c})\,dt$?

::: right
Right. $G(b) - G(0)$ with $G = \frac{t^3}{3} + ct$: {answer}.
:::

::: misses
- [b^2 + c] That's the integrand at b, not the integral.
- [any] Not yet. Find an antiderivative and evaluate at the ends.
:::
:::

::: check
given: b = 1 | 3 | 6
answer: b^2/3
tolerance: 0.01%

## What's the average value of $t^2$ on [0, {b}]?

::: right
Right. $\frac{1}{b}\cdot\frac{b^3}{3} = \frac{b^2}{3}$ = {answer}.
:::

::: misses
- [b^2/2] Average of $t^2$, not of t.
- [any] Not yet. $\frac{1}{b - 0}\int_0^bt^2\,dt$.
:::
:::

::: check
given: I = 1 | 2 | 5; tau = 0.2 | 0.5; T = 0.5 | 1; C = 10 | 47
answer: I*tau/C*(1 - exp(-T/tau))*1000
unit: mV
tolerance: 0.1%

## A {C} µF capacitor at 0 V is charged by $\given{I}e^{-t/\tau}$ mA with τ = {tau} ms. What's its voltage at t = {T} ms?

::: right
Right. $\frac{I\tau}{C}(1 - e^{-T/\tau})$ = {answer} mV.
:::

::: misses
- [I*tau/C*1000] That's the final voltage; at T the exponential hasn't finished.
- [any] Not yet. $\frac1C\int_0^TIe^{-t/\tau}dt$.
:::
:::

::: check
given: M = 2 | 5; d = 0.01 | 0.3
answer: M*d
tolerance: 0.1%

## $\lvert f\rvert \le$ {M} on the interval. How much can $F(x) = \int_a^xf$ change when x moves by {d}?

::: right
Right. At most $M\lvert\Delta x\rvert$ = {answer}: F is Lipschitz even if f jumps.
:::

::: misses
- [M] Multiply by how far x moves.
- [any] Not yet. $\lvert F(x) - F(y)\rvert \le \sup\lvert f\rvert\cdot\lvert x - y\rvert$.
:::
:::

::: check
kind: choice

## f is the square wave that's 1 on [0, 1) and −1 on [1, 2). Where is $F(x) = \int_0^xf$ differentiable on (0, 2)?

- [ ] Nowhere
- [ ] Everywhere
- [x] Everywhere except x = 1
- [ ] Only at x = 1

::: misses
- [1] F is differentiable wherever f is continuous.
- [2] At the jump of f, F has a corner.
- [4] That's the one point where it isn't.
:::
:::

::: check
kind: parts
given: a = 2 | 3; m = 1 | 2; x = 1 | 2

## $F(x) = \int_x^{\given{a}x}t^{\given{m}}\,dt$.

::: part
answer: (a^(m + 1) - 1)*x^m
tolerance: 0.5%

### What is F′(x) at x = {x}?

::: misses
- [a^(m + 1)*x^m] Subtract the lower limit's contribution, $x^m$.
- [any] $a(ax)^m - x^m$.
:::
:::

::: part
answer: (a^(m + 1) - 1)*x^(m + 1)/(m + 1)
tolerance: 0.5%

### What is F(x) itself?

::: misses
- [any] $\frac{(ax)^{m+1} - x^{m+1}}{m + 1}$.
:::
:::
:::

::: check
kind: derivation
vars: a = -3..3, b = 0.5..3

## $\int_0^b(t^2 + a)\,dt$.

::: step
answer: b^3/3 + a*b

### What is it?
:::

::: step
answer: b^2/3 + a

### What is the average value of $t^2 + a$ on [0, b]?
:::

::: right
Right. Average equals integral over length, and by the mean value theorem for integrals the function takes that value somewhere.
:::
:::

::: explain
## Why can't a capacitor's voltage jump when a finite current flows, even if the current itself jumps?

::: model
The voltage is $v(0)$ plus $\frac1C$ times the integral of the current. By the fundamental theorem, the running integral of a bounded function is continuous, indeed Lipschitz: over a time Δt it can change by at most $\sup\lvert i\rvert\cdot\Delta t/C$, which goes to zero as Δt does. So however abruptly the current changes, the voltage changes continuously; a jump in current only puts a corner in the voltage, where its slope changes. A voltage jump would need the integral to change by a finite amount in zero time, which takes an infinite current: an impulse.
:::
:::

::: practice

::: check
given: x = 0.5 | 0.8 | 1 | 1.2 | 1.5 | 2
answer: 2*x*sin(x^2)
tolerance: 0.1%

## $\frac{d}{dx}\int_0^{x^2}\sin t\,dt$ at {x}?

::: misses
- [any] $2x\sin(x^2)$.
:::
:::

::: check
given: b = 1.5 | 2 | 3 | 4 | 5 | 6
answer: b^2/3
tolerance: 0.01%

## Average of $t^2$ on [0, {b}]?

::: misses
- [any] $b^2/3$.
:::
:::

::: check
given: I = 3 | 10; tau = 0.1 | 1; T = 0.5 | 3; C = 22 | 100
answer: I*tau/C*(1 - exp(-T/tau))*1000
unit: mV
tolerance: 0.1%

## Capacitor voltage at {T} ms: {C} µF, $\given{I}e^{-t/\tau}$ mA, τ = {tau} ms?

::: misses
- [any] $\frac{I\tau}{C}(1 - e^{-T/\tau})$.
:::
:::
:::
