---
title: Switches and initial conditions
heading: What a circuit looks like the instant a switch moves
eyebrow: C2 · Lesson 18 · Switches and initial conditions
xp: 40
---

::: hook
When a switch flips, most voltages and currents in a circuit jump. Two never do: the voltage on a capacitor and the current in an inductor. Those two facts let you redraw the circuit at the instant after the switch, find every other voltage and current, and then do the same for the far future. With the start and the end in hand, the transient in between (lessons 7 and 8) is almost automatic.

::: play
- A switch (the step source) connects 10 V to two branches at once: a resistor and capacitor, and a resistor and inductor.
- Right after the step, which branch carries current? Which part has the full 10 V across it?
- Long afterward, which branch carries current, and where is the 10 V?
:::
:::

```sim circuit
V1 in 0 step 10     @ 0,0 down 4
R1 in c 1k          @ 0,0 right
C1 c 0 1u           @ 2,0 down 4
R2 in l 1k          @ 0,0 up 2
L1 l 0 1            @ 4,-2 down 6
slider: C1 100n..10u log
slider: L1 100m..10 log
scope: v(c), v(l)
time: 0..5m s
meter: i(R1), i(R2)
```

::: predict
## An uncharged capacitor sits in series with a 1 kΩ resistor. A 10 V source is switched across them. What current flows at the first instant?

- [ ] 0
- [x] 10 mA
- [ ] 5 mA
- [ ] It depends on the capacitance

::: reveal
10 mA. The capacitor's voltage can't jump, so just after the switch it's still 0 V: it behaves like a short circuit, and all 10 V lands on the resistor. The capacitance decides how long the current takes to die away, but the starting value only depends on the resistor. An inductor does the opposite: at the first instant it carries no current, so it behaves like an open circuit, with the full voltage across it.
:::
:::

::: nameit
## Initial and final conditions

**What can't jump**, and why: a capacitor's voltage (a jump would need infinite current, $i = C\,dv/dt$) and an inductor's current (a jump would need infinite voltage, $v = L\,di/dt$). Equivalently, neither one's stored energy can change instantly.

**Just after the switch** ($t = 0^+$), redraw the circuit:

- each capacitor becomes a voltage source equal to its voltage just before ($0^-$); an uncharged one is a **short circuit**;
- each inductor becomes a current source equal to its current just before; one carrying no current is an **open circuit**.

Then solve that resistive circuit for everything else: resistor currents, inductor voltages, capacitor currents.

**Long after** ($t \to \infty$, with DC sources): capacitors are **open circuits** and inductors are **short circuits**. Solve again.

**Initial rates of change** follow from the $0^+$ circuit:

$$\left.\frac{dv_C}{dt}\right|_{0^+} = \frac{i_C(0^+)}{C} \qquad \left.\frac{di_L}{dt}\right|_{0^+} = \frac{v_L(0^+)}{L}$$

These are what you need to start a second-order solution (lesson 15), which has two constants to fix.

**Before the switch** matters too. If a capacitor was charged to 5 V before the switch, it starts at 5 V, not 0. Work out the $0^-$ state from the circuit as it was, which is usually a DC steady state.
:::

::: example
## A switch connects 12 V through 1 kΩ to an empty 10 µF capacitor with 2 kΩ across it. Find the current just after closing, the final voltage and τ.

::: solution
1. **Current just after closing.** At $0^+$ the empty capacitor is a short, so
   $$\begin{aligned} i &= \frac{12\ \text{V}}{1\ \text{k}\Omega} \\ &= 12\ \text{mA} \end{aligned}$$
2. **Final voltage.** Long after, the capacitor is open, so
   $$\begin{aligned} v &= 12 \times \frac23\ \text{V} \\ &= 8\ \text{V} \end{aligned}$$
3. **Time constant.** The capacitor sees $1 \parallel 2 = 0.667$ kΩ, so
   $$\begin{aligned} \tau &= 0.667\ \text{k}\Omega \times 10\ \mu\text{F} \\ &= 6.67\ \text{ms} \end{aligned}$$

**Answer:** 12 mA flows just after closing, the capacitor ends at 8 V, and τ = 6.67 ms.
:::
:::

::: example
## An inductor carrying 50 mA has its supply switch opened, leaving only a 1 kΩ resistor across it. What voltage appears at the first instant?

::: solution
1. **The current can't jump.** The inductor's 50 mA is forced through the 1 kΩ.
2. **Voltage at the first instant.**
   $$\begin{aligned} v &= 50\ \text{mA} \times 1\ \text{k}\Omega \\ &= 50\ \text{V} \end{aligned}$$
3. **After that.** It decays with τ = L/(1 kΩ).

**Answer:** 50 V appears at the first instant, then decays with τ = L/(1 kΩ).
:::
:::

::: example
## A 10 µF capacitor starts at 3 V and is switched to 12 V through 2 kΩ. How long until it reaches 10 V?

::: solution
1. **Time constant.** It heads from 3 V toward 12 V with
   $$\begin{aligned} \tau &= 2\ \text{k}\Omega \times 10\ \mu\text{F} \\ &= 20\ \text{ms} \end{aligned}$$
2. **Write the curve.**
   $$v(t) = 12 - 9e^{-t/20\ \text{ms}}$$
3. **Set v = 10 V.** That gives $e^{-t/\tau} = \frac29$, so
   $$\begin{aligned} t &= 20\ \text{ms} \times \ln 4.5 \\ &= 30\ \text{ms} \end{aligned}$$
4. **The recipe.** It's always the same: initial value, final value, time constant.
5. **What the head start saves.** Starting from 3 V rather than empty saves the first ln(12/9) = 0.29τ of the charge.

**Answer:** it reaches 10 V after 30 ms.
:::
:::

::: check
given: V = 5 | 10 | 12; R1 = 1 | 2; R2 = 3 | 4
answer: V/R1
unit: mA
tolerance: 0.5%

## An uncharged capacitor is in parallel with {R2} kΩ. That pair is switched onto a {V} V source through {R1} kΩ. What current does the source deliver at the first instant?

::: right
Right. The capacitor acts as a short, bypassing {R2} kΩ: $V/R_1$ = {answer}.
:::

::: misses
- [V/(R1 + R2)] That's the final current, once the capacitor acts as an open circuit.
- [0] An uncharged capacitor is a short at first, not an open.
- [any] Not yet. Replace the uncharged capacitor with a short.
:::
:::

::: check
given: V = 5 | 10 | 12; R1 = 1 | 2; R2 = 3 | 4
answer: V*R2/(R1 + R2)
unit: V
tolerance: 0.5%

## Same circuit, {V} V, {R1} kΩ and {R2} kΩ. What voltage does the capacitor reach in the end?

::: right
Right. At DC it's an open circuit, so it sits at the divider's voltage: {answer}.
:::

::: misses
- [V] The {R2} kΩ in parallel holds the voltage below the supply.
- [V*R1/(R1 + R2)] That's across R1.
- [any] Not yet. Treat the capacitor as open and use the divider.
:::
:::

::: check
given: V = 6 | 9 | 12; R = 10 | 100; L = 1 | 10
answer: V
unit: V
tolerance: 0.5%

## A {L} mH inductor in series with {R} Ω, carrying no current, is switched onto {V} V. What is the inductor's voltage at the first instant?

::: right
Right. With no current yet, nothing drops across R: all {answer} is across the inductor.
:::

::: misses
- [0] It's the current that starts at zero; the voltage jumps.
- [V/2] The resistor has no current, so no voltage, at first.
- [any] Not yet. Replace the inductor with an open circuit.
:::
:::

::: check
given: V0 = 5 | 10; R = 1 | 2 | 5; C = 2.2 | 10
answer: -V0/(R*C)
unit: V/ms
tolerance: 0.5%

## A {C} µF capacitor charged to {V0} V starts discharging through {R} kΩ. How fast is its voltage changing at the first instant, in V/ms?

::: right
Right. The current is $V_0/R$, and $dv/dt = -i/C$ = {answer}.
:::

::: misses
- [V0/(R*C)] It's falling: the rate is negative.
- [-V0*R*C] Divide by RC.
- [any] Not yet. $dv/dt = -V_0/(RC)$.
:::
:::

::: check
kind: match

## Match each part, just after a switch moves, to what it acts like.

- uncharged capacitor :: a short circuit
- inductor carrying no current :: an open circuit
- capacitor charged to 5 V :: a 5 V voltage source
- inductor carrying 2 mA :: a 2 mA current source

::: right
Right. Each part keeps its old state for that instant: a capacitor its voltage, an inductor its current.
:::
:::

::: check
kind: parts
given: a = 2 | 3; b = 12 | 15; R = 1 | 2; C = 10 | 47; v = 9 | 10

## A {C} µF capacitor at {a} V is switched to {b} V through {R} kΩ.

::: part
answer: (b - a)/R
unit: mA
tolerance: 0.5%

### What current flows just after switching?

::: misses
- [b/R] The capacitor's voltage can't jump, so only the difference drives current.
- [any] $\frac{V_s - v_0}{R}$.
:::
:::

::: part
answer: R*C*ln((b - a)/(b - v))
unit: ms
tolerance: 0.5%

### How long until it reaches {v} V?

::: misses
- [any] $\tau\ln\frac{V_s - v_0}{V_s - v}$.
:::
:::
:::

::: check
kind: derivation
vars: a = -10..10, b = -20..20, R = 10..100000, C = 0.000000001..0.001, t = 0..10

## A capacitor starting at a is driven toward b through R.

::: step
answer: b + (a - b)*exp(-t/(R*C))

### What's its voltage at t?
:::

::: step
answer: (b - a)/R*exp(-t/(R*C))

### What current flows?
:::

::: right
Right. Initial value, final value, time constant: every first-order transient has this shape.
:::
:::

::: explain
## Why can't a capacitor's voltage change instantly when a switch flips?

::: model
A capacitor's voltage is proportional to the charge on its plates, $v = q/C$, and changing that charge takes current flowing for some time. An instant jump in voltage would need a finite charge moved in zero time, which means an infinite current. Every real circuit has some resistance limiting the current, so the voltage changes continuously. The same reasoning applied to energy says $\frac12Cv^2$ can't change instantly.
:::
:::

::: practice

::: check
given: V = 5 | 9; R = 1 | 3
answer: V/R
unit: mA
tolerance: 0.5%

## {V} V switched onto an uncharged capacitor through {R} kΩ. Initial current?

::: misses
- [0] An uncharged capacitor is a short at first.
- [any] $V/R$.
:::
:::

::: check
given: V = 10 | 20; R = 5 | 10
answer: V/R
unit: A
tolerance: 0.5%

## {V} V drives an inductor through {R} Ω. Final current?

::: misses
- [0] At DC, the inductor is a short.
- [any] $V/R$.
:::
:::

::: check
given: V0 = 2 | 4 | 6
answer: V0
unit: V
tolerance: 0.5%

## A capacitor at {V0} V is switched into a new circuit. What's its voltage just after?

::: misses
- [0] Its voltage can't jump.
- [any] Same as just before.
:::
:::
:::
