---
title: First-order equations and exponential response
heading: Why an RC circuit charges along an exponential
eyebrow: A8 · Lesson 3 · First-order equations
xp: 40
---

::: hook
Close a switch to connect a battery through a resistor to a capacitor, and the capacitor's voltage climbs along a curve you've seen many times: fast at first, then leveling off. Where does the exponential come from? Kirchhoff's voltage law and the capacitor's own law combine into a first-order differential equation, and solving it takes three lines.

::: play
- The source steps from 0 to 5 V at $t = 0$. The scope shows the capacitor's voltage.
- Double R, then double C. Where does the curve reach about 63% of the way? Compare with $RC$.
- Make R small and C large, then the other way around, keeping $RC$ the same. Does the curve change?
:::
:::

```sim circuit
V1 in 0 step 5      @ 0,0 down
R1 in out 1k        @ 0,0 right
C1 out 0 1u         @ 2,0 down
slider: R1 100..10k log
slider: C1 100n..10u log
scope: v(in), v(out)
time: 0..10m s
meter: v(out)
```

::: predict
## R = 1 kΩ and C = 1 µF. How long until the capacitor reaches about 63% of 5 V?

- [ ] 1 s
- [x] 1 ms
- [ ] 1 µs
- [ ] 63 ms

::: reveal
1 ms, the time constant $\tau = RC = 1000 \times 10^{-6}$ s. At $t = \tau$ the voltage is $5(1 - e^{-1}) \approx 3.16$ V, 63% of the way. Only the product RC matters, which is why doubling R and halving C leaves the curve unchanged.
:::
:::

::: nameit
## Setting up and solving

**Setting up.** Around the loop, the source voltage is shared by the resistor and the capacitor: $V_s = iR + v$. The capacitor's law says $i = C\,dv/dt$. Substituting:

$$RC\frac{dv}{dt} + v = V_s$$

A first-order linear equation, with $\tau = RC$ as the only parameter of the circuit.

**Solving by separating variables.** Rearrange so everything with $v$ is on one side and everything with $t$ on the other:

$$\frac{dv}{V_s - v} = \frac{dt}{\tau}$$

Integrate both sides: $-\ln|V_s - v| = t/\tau + c$, so $V_s - v = Ke^{-t/\tau}$. Using the starting voltage $v(0) = v_0$ to fix $K = V_s - v_0$:

$$v(t) = V_s + (v_0 - V_s)\,e^{-t/\tau}$$

Read it as: **final value, plus the initial gap shrinking exponentially.** That one formula covers charging ($v_0 = 0$), discharging ($V_s = 0$), and everything in between.

**The same equation, everywhere.** An inductor and resistor give $L\,di/dt + Ri = V$, so $\tau = L/R$. A thermometer warming in a bath, a tank draining through a pipe and a motor spinning up against friction all obey the same first-order law, with their own time constants. Learn it once.

**The homogeneous part.** With no source, $\tau\,dv/dt + v = 0$, the solution is $v_0e^{-t/\tau}$: the **natural response**, how the circuit relaxes on its own. With a constant source it shifts to approach the new final value. Lesson 4 adds sources that change in time.
:::

::: example
## A 5 V step charges 100 nF through 10 kΩ. What is the voltage after 2 ms?

::: solution
1. **Time constant.**
   $$\begin{aligned} \tau &= RC \\ &= 10^4 \times 10^{-7}\ \text{s} \\ &= 1\ \text{ms} \end{aligned}$$
2. **Voltage at 2 ms.** Two milliseconds is two time constants:
   $$\begin{aligned} v &= 5(1 - e^{-2}) \\ &= 4.32\ \text{V} \end{aligned}$$
   86% of the way there.

**Answer:** 4.32 V after 2 ms, 86% of the way to 5 V.
:::
:::

::: example
## A 470 µF capacitor at 12 V discharges through 2.2 kΩ. When is it down to 1 V?

::: solution
1. **Time constant.**
   $$\begin{aligned} \tau &= 2200 \times 470 \times 10^{-6}\ \text{s} \\ &= 1.034\ \text{s} \end{aligned}$$
2. **Solve for the time.**
   $$\begin{aligned} 12e^{-t/\tau} &= 1 \\ t &= \tau\ln 12 \\ &= 2.57\ \text{s} \end{aligned}$$

**Answer:** it's down to 1 V after 2.57 s.
:::
:::

::: example
## A 5 V step drives a 10 mH inductor through 100 Ω. What is the current after 0.2 ms?

::: solution
1. **Write KVL.**
   $$L\frac{di}{dt} + Ri = 5$$
   This is the same first-order form as the RC circuit.
2. **Time constant.**
   $$\begin{aligned} \tau &= \frac{L}{R} \\ &= 0.1\ \text{ms} \end{aligned}$$
3. **The rising current.** The current rises toward $5/100 = 50$ mA:
   $$i = 50\left(1 - e^{-t/0.1\,\text{ms}}\right)\ \text{mA}$$
4. **Current at 0.2 ms.**
   $$\begin{aligned} i(0.2\ \text{ms}) &= 50(1 - e^{-2}) \\ &= 43.2\ \text{mA} \end{aligned}$$
5. **What can't jump.** In an RL circuit the inductor current is the quantity that can't jump, the way capacitor voltage can't jump in an RC circuit.

**Answer:** the current is 43.2 mA after 0.2 ms.
:::
:::

::: check
given: R = 1k..100k E12 Ω; C = 10n..10µ E6 F
answer: R*C
unit: s
tolerance: 1%

## What is the time constant of a {R} resistor charging a {C} capacitor?

::: right
Right. $\tau = RC$ = {answer}.
:::

::: misses
- [R/C] It's the product $RC$: ohms times farads is seconds.
- [1/(R*C)] That's $1/\tau$, a rate in 1/s.
- [any] Not yet. $\tau = RC$.
:::
:::

::: check
given: L = 1m..100m E6 H; R = 10..1k E12 Ω
answer: L/R
unit: s
tolerance: 1%

## What is the time constant of an {L} inductor in series with {R}?

::: right
Right. $L\,di/dt + Ri = V$ gives $\tau = L/R$ = {answer}.
:::

::: misses
- [L*R] For an inductor it's $L/R$: henries per ohm is seconds.
- [R/L] That's upside down: $\tau = L/R$.
- [any] Not yet. Divide the equation by R and read off τ.
:::
:::

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

## Solve $\dfrac{dy}{dt} = -a\,y$ with $y(0) = y_0$.

::: right
Right. Separating, $dy/y = -a\,dt$, so $\ln y = -at + c$ and $y = y_0e^{-at}$.
:::

::: misses
- [exp(-a*t)] That starts at 1. Use $y(0) = y_0$.
- [y0*exp(a*t)] That grows. A negative rate gives decay.
- [y0 - a*t] That's a straight line; the slope here depends on y itself.
- [any] Not yet. Separate the variables and integrate.
:::
:::

::: check
given: V0 = 6..12 int; Vs = 1 | 2 | 3; tau = 2..5 int; t = 1..2 int
answer: Vs + (V0 - Vs)*exp(-t/tau)
tolerance: 0.5%

## A capacitor at {V0} V is connected through a resistor to a {Vs} V source, with $\tau$ = {tau} ms. What is its voltage after {t} ms?

::: right
Right. Final value {Vs} V plus the gap ({V0} − {Vs}) V shrinking by $e^{-t/\tau}$: {answer} V.
:::

::: misses
- [V0*exp(-t/tau)] That decays toward 0 V. It's heading for {Vs} V.
- [Vs*(1 - exp(-t/tau))] That starts from 0 V; this one starts at {V0} V.
- [any] Not yet. Use $v = V_s + (v_0 - V_s)e^{-t/\tau}$.
:::
:::

::: check
kind: parts
given: L = 10 | 47; R = 100 | 220; V = 5 | 12

## A {V} V step drives a {L} mH inductor through {R} Ω.

::: part
answer: L/R*1000
unit: µs
tolerance: 0.5%

### What is the time constant?

::: misses
- [R/L] It's $L/R$.
- [any] $\tau = L/R$.
:::
:::

::: part
answer: V/R*1000*(1 - exp(-1))
unit: mA
tolerance: 0.5%

### What is the current after one time constant?

::: misses
- [V/R*1000] That's the final value; after one $\tau$ it's 63% of the way.
- [any] $\frac VR(1 - e^{-1})$.
:::
:::
:::

::: check
kind: derivation
vars: tau = 0.5..5, V = 1..10, t = 0..10

## A capacitor charges toward $V$ with time constant $\tau$.

::: step
answer: V*(1 - exp(-t/tau))

### What is $v(t)$ from 0?
:::

::: step
answer: V/tau*exp(-t/tau)

### What is $\dot v(t)$?
:::

::: right
Right. The slope is the remaining gap divided by $\tau$, as the equation $\tau\dot v = V - v$ says.
:::
:::

::: explain
## In $v(t) = V_s + (v_0 - V_s)e^{-t/\tau}$, explain what each part represents physically.

::: model
$V_s$ is where the capacitor ends up: once it's charged to the source voltage, no current flows and nothing changes. $v_0 - V_s$ is how far it starts from there. The factor $e^{-t/\tau}$ shrinks that gap by the same fraction every time constant, because the current, and so the rate of change, is proportional to the remaining gap. The time constant $\tau = RC$ sets the pace: a bigger resistor lets less current through, and a bigger capacitor needs more charge.
:::
:::

::: practice

::: check
given: R = 1k..1M E6 Ω; C = 1n..1µ E6 F
answer: 5*R*C
unit: s
tolerance: 1%

## About how long does a {R}, {C} circuit take to settle?

::: misses
- [R*C] That's one time constant: 37% of the change is still to come.
- [any] Five time constants: $5RC$.
:::
:::

::: check
given: V = 5..24 int; R = 10..1k E12 Ω
answer: V/R
unit: A
tolerance: 1%

## An inductor in series with {R} is switched onto {V} V. What current does it reach eventually?

::: misses
- [0] Once the current stops changing, the inductor has no voltage across it.
- [any] At steady state the inductor acts like a wire: $I = V/R$.
:::
:::

::: check
given: Vs = 5..15 int; tau = 2..5 int
answer: Vs/tau
unit: V/ms
tolerance: 0.5%

## A capacitor starting at 0 V charges toward {Vs} V with τ = {tau} ms. What is $dv/dt$ at the start, in V/ms?

::: misses
- [Vs*tau] The rate is $(V_s - v)/\tau$; at the start that's $V_s/\tau$.
- [any] Put $v = 0$ into $(V_s - v)/\tau$.
:::
:::
:::
