---
title: Continuity and the intermediate value theorem
heading: Why a capacitor's voltage can't jump
eyebrow: A5 · Lesson 6 · Continuity
xp: 40
---

::: hook
Flip a switch and the current through a resistor can change instantly, but the voltage across a capacitor can't: moving charge onto its plates takes time. In math terms, the capacitor's voltage is a **continuous** function of time, and that one fact sets the starting point of every transient calculation in C2. Continuity also guarantees something useful: a continuous signal that starts below a threshold and ends above it must cross it somewhere, which is exactly what makes bisection work.
:::

::: play
- The function jumps at $x = 1$ unless the two pieces meet. Adjust $c$ until the jump closes.
- With the pieces meeting, is there any $x$ where the graph has a break?
:::
:::

```sim plot
view: graph
x: x = -1..3
y: y = -1..6
slider: c = -1..4 step 0.25 = 0.5
plot: (x^2 + 1)*(1 - step(x - 1)) + (c + 2*x)*step(x - 1) | label: f(x) | samples: 2000
readout: left limit at 1 = 2 | digits: 3
readout: right limit at 1 = c + 2 | digits: 3
```

::: predict
## $f(x) = x^2 + 1$ for $x < 1$ and $c + 2x$ for $x \ge 1$. What value of $c$ makes $f$ continuous at 1?

- [ ] 2
- [x] 0
- [ ] 1
- [ ] Any value: each piece is continuous

::: reveal
$c = 0$. From the left, $x^2 + 1 \to 2$; from the right, the value is $c + 2$. They agree only when $c = 0$. Each piece being continuous isn't enough: the pieces have to meet where they join.
:::
:::

::: nameit
## What continuity means

$f$ is **continuous at** $a$ when

$$\lim_{x \to a} f(x) = f(a)$$

which packs in three requirements: $f(a)$ is defined, the limit exists, and they're equal. A function continuous at every point of an interval can be drawn there without lifting the pen.

**Kinds of discontinuity:**
- a **jump**: the one-sided limits differ (a step function);
- a **removable** one: the limit exists but $f(a)$ is missing or different (the hole in $\frac{x^2 - 9}{x - 3}$);
- an **infinite** one: a vertical asymptote.

Polynomials, $e^x$, $\sin$ and $\cos$ are continuous everywhere; rational functions and $\ln$ and $\sqrt{\ }$ wherever they're defined. Sums, products, quotients (with a nonzero bottom) and compositions of continuous functions are continuous.

## Continuity in circuits

A capacitor's voltage and an inductor's current are continuous in time, because changing them instantly would take infinite current ($i = C\,dv/dt$) or infinite voltage ($v = L\,di/dt$). So at a switching instant, $v_C(0^+) = v_C(0^-)$ and $i_L(0^+) = i_L(0^-)$. Other quantities, like a resistor's current, can jump.

## The intermediate value theorem

If $f$ is continuous on $[a, b]$ and $N$ is any value between $f(a)$ and $f(b)$, then $f(c) = N$ for some $c$ in $[a, b]$.

In particular, if $f(a)$ and $f(b)$ have opposite signs, $f$ has a root between them. That's the guarantee behind bisection (A4): halving keeps the sign change, and continuity promises a root inside. Without continuity it fails: $1/x$ changes sign between −1 and 1 but is never zero.
:::

::: example
## Is $f(x) = \dfrac{x^2 - 4}{x - 2}$ continuous at 2? Can it be fixed?

::: solution
1. **Check $f(2)$.** $f(2)$ is undefined (0/0), so $f$ isn't continuous at 2.
2. **Find the limit.** For $x \ne 2$, $f(x) = x + 2$, so
   $$\lim_{x \to 2} f = 4$$
3. **Fix it.** The discontinuity is removable: defining $f(2) = 4$ makes $f$ continuous, and then it's just the line $x + 2$.

**Answer:** no, but the discontinuity is removable: defining $f(2) = 4$ fixes it.
:::
:::

::: example
## Show that $x^3 + x - 3 = 0$ has a root between 1 and 2, and narrow it down.

::: solution
1. **Check the ends.** $f$ is a continuous polynomial, with
   $$f(1) = -1 < 0, \quad f(2) = 7 > 0$$
   so by the intermediate value theorem there's a root in $(1, 2)$.
2. **Bisect at 1.5.**
   $$f(1.5) = 1.875 > 0$$
   so the root is in $(1, 1.5)$.
3. **Bisect at 1.25.**
   $$f(1.25) = 0.203 > 0$$
   so it's in $(1, 1.25)$.
4. **Bisect at 1.125.**
   $$f(1.125) = -0.451 < 0$$
   so it's in $(1.125, 1.25)$.

**Answer:** there's a root between 1 and 2, at about 1.213.
:::
:::

::: example
## An inductor carrying 2 A is suddenly switched so its current must flow through a 10 Ω resistor. What voltage appears across the resistor just after the switch?

::: solution
1. **The current can't jump.** An inductor's current is continuous: a jump would take infinite voltage ($v = L\,di/dt$) and change its stored energy instantly.
2. **Voltage across the resistor.** Just after the switch the current is still 2 A, now through the resistor:
   $$\begin{aligned} v &= 2\ \text{A} \times 10\ \Omega \\ &= 20\ \text{V} \end{aligned}$$
3. **Why it matters.** That voltage can be far larger than anything in the circuit before the switch. With a bigger resistor, or an open switch, it would be bigger still, which is why inductive loads need a path for their current when they're switched off.

**Answer:** 20 V appears across the resistor just after the switch.
:::
:::

::: check
given: a = 2 | 3; k = 2 | 3
answer: a^2 + 1 - k*a

## $f(x) = x^2 + 1$ for $x < \given{a}$ and $c + \given{k}x$ for $x \ge \given{a}$. What value of $c$ makes $f$ continuous?

::: right
Right. The left piece reaches $\given{a}^2 + 1$ at {a}, and $c + \given{k} \cdot \given{a}$ must match it.
:::

::: misses
- [a^2 + 1] That's the left limit. The right piece adds $\given{k}x$, so subtract $\given{k} \cdot \given{a}$.
- [k*a - a^2 - 1] Check the sign: solve $c + \given{k}\given{a} = \given{a}^2 + 1$ for $c$.
- [any] Not yet. Set the two pieces equal at $x$ = {a}.
:::
:::

::: check
given: a = 2 | 3 | 5
answer: 2*a

## $f(x) = \dfrac{x^2 - \given{a}^2}{x - \given{a}}$ has a removable discontinuity at {a}. What value of $f(\given{a})$ removes it?

::: right
Right. The limit is $2 \times \given{a}$ = {answer}.
:::

::: misses
- [0] 0/0 isn't the value. Find the limit by factoring.
- [a] It simplifies to $x + \given{a}$; at {a} that's {answer}.
- [any] Not yet. Define $f(\given{a})$ as the limit.
:::
:::

::: check
kind: choice

## A 10 µF capacitor sits at 4 V. At $t = 0$ a switch connects it through 1 kΩ to 12 V. What is the capacitor's voltage at $t = 0^+$?

- [x] 4 V
- [ ] 12 V
- [ ] 8 V
- [ ] 0 V

::: right
Right. A capacitor's voltage is continuous, so it starts from where it was. The current, $(12 - 4)/1\text{ k}\Omega$ = 8 mA, is what jumps.
:::

::: misses
- [2] That's where it ends up. Changing it instantly would need infinite current.
- [any] A capacitor's voltage can't jump.
:::
:::

::: check
given: a = 1 | 2; b = 1 | 3 | 5
answer: 1

## How many roots does $x^3 + \given{a}x - \given{b}$ have between 0 and 2? (It's increasing everywhere, since $3x^2 + \given{a} > 0$.)

::: right
Right. It starts negative at 0, is positive at 2 here, and only ever increases, so it crosses zero exactly once.
:::

::: misses
- [0] Check the signs at 0 and at 2: the intermediate value theorem guarantees a root.
- [3] An increasing function crosses each level only once.
- [any] Not yet. Compare $f(0)$ and $f(2)$, then use that $f$ always increases.
:::
:::

::: check
kind: choice

## $f(-1) = -1$ and $f(1) = 1$ for $f(x) = 1/x$. Why doesn't the intermediate value theorem promise a root in $[-1, 1]$?

- [x] $1/x$ isn't continuous on $[-1, 1]$: it isn't even defined at 0
- [ ] The theorem only works for polynomials
- [ ] The values at the ends aren't far enough apart
- [ ] It does promise one, at $x = 0$

::: right
Right. The theorem needs continuity on the whole interval, and $1/x$ jumps from $-\infty$ to $+\infty$ at 0 without passing through zero.
:::

::: misses
- [4] $1/x$ is never zero, and isn't defined at 0.
- [any] Check the theorem's requirement on the function.
:::
:::

::: check
kind: parts
given: c = 3 | 5 | 7

## $f(x) = x^3 + x - \given{c}$ is continuous, so the intermediate value theorem applies.

::: part
answer: 2 - c
tolerance: 0.5%

### What is $f(1)$?

::: misses
- [any] $1 + 1 - \given{c}$.
:::
:::

::: part
answer: 10 - c
tolerance: 0.5%

### What is $f(2)$? (Opposite signs mean a root lies between 1 and 2.)

::: misses
- [any] $8 + 2 - \given{c}$.
:::
:::

::: part
answer: 1.25 + 0.5*step(c - 4.875)
tolerance: 0.1%

### Bisect once: check $f(1.5)$ and keep the half with a sign change. What is the midpoint of the new bracket?

::: misses
- [1.75 - 0.5*step(c - 4.875)] Check the sign of $f(1.5) = 4.875 - \given{c}$ again: keep the half whose ends have opposite signs.
- [any] Find $f(1.5)$, pick the half that still brackets the root, then take its midpoint.
:::
:::
:::

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

## $f(x) = ax + b$ for $x < 1$ and $f(x) = x^2 + k$ for $x \ge 1$. Find the $k$ that makes $f$ continuous.

::: step
answer: a + b

### What is the limit from the left at $x = 1$?
:::

::: step
answer: a + b - 1

### The value at 1 is $1 + k$. What must $k$ be?
:::

::: right
Right. $k = a + b - 1$ makes the two pieces meet.
:::
:::

::: explain
## Why can't the voltage across a capacitor change instantly, and why does that matter when you analyze a switching circuit?

::: model
A capacitor's current is $C\,dv/dt$, so an instant jump in voltage would need an infinite rate of change and so infinite current, which no real circuit can supply. The voltage is therefore a continuous function of time. When a switch operates at $t = 0$, that means the capacitor's voltage just after is the same as just before, $v(0^+) = v(0^-)$, which gives the starting condition for working out what happens next. Quantities like a resistor's current are free to jump.
:::
:::

::: practice

::: check
given: a = 1 | 2; m = 3 | 4
answer: a^2 - m*a

## $f(x) = x^2$ for $x \le \given{a}$ and $\given{m}x + c$ for $x > \given{a}$. What $c$ makes $f$ continuous?

::: misses
- [a^2] Subtract $\given{m} \cdot \given{a}$.
- [any] Match the pieces at {a}.
:::
:::

::: check
given: v0 = 2 | 5; vs = 10 | 15
answer: v0
unit: V

## A capacitor at {v0} V is switched onto a {vs} V source through a resistor. What is its voltage at $t = 0^+$, in volts?

::: misses
- [vs] That's the final value.
- [any] Capacitor voltage is continuous.
:::
:::

::: check
given: a = 3 | 4 | 7
answer: 2*sqrt(a)
tolerance: 0.5%

## What value at $x = \given{a}$ makes $\dfrac{x - \given{a}}{\sqrt{x} - \sqrt{\given{a}}}$ continuous there?

::: misses
- [sqrt(a)] $x - a = (\sqrt x - \sqrt a)(\sqrt x + \sqrt a)$.
- [any] Factor the top as a difference of squares.
:::
:::
:::
