The RC Circuit
Circuits
Of all the circuits, the RC circuit is the simplest one that has memory. A resistor by itself responds instantaneously — change the voltage, the current changes the next instant. A capacitor stores charge, and stored charge takes time to drain or accumulate. Put a resistor and a capacitor in series, and you have a circuit whose response to a sudden voltage change takes a characteristic time — the time constant. Everything else in dynamic circuit analysis is variations on this theme. The RC circuit is also, perhaps surprisingly, the same equation that governs a leaky integrate-and-fire neuron: same first-order linear ODE, just with the variable names changed.
The circuit and the capacitor's constitutive law
A voltage source connects through a resistor to a capacitor , which is grounded on the other side. The capacitor has a voltage across its plates and stores a charge .
A resistor obeys — instantaneous. The capacitor's law is the dynamic ingredient:
The current flowing into the capacitor is times the rate of change of the voltage across it. (Equivalently: and , chain rule.) That derivative is what makes the circuit have memory. The capacitor's "state" is its current voltage, and the state can only change at a rate the current allows.
Deriving the ODE
Apply KVL around the loop and Ohm's law to the resistor:
Substitute the capacitor's :
Define and rearrange:
A first-order linear ODE. The driving term is whatever the source is doing; the "leak" term pulls back toward zero (or toward in steady state). One state variable, one parameter, one equation.
The time constant
has units of seconds. Quick dimensional check: and , so .
The tau constant in RC circuits always tripped me up. I never really understood why you would go through all this business to use another variable when you could just measure in absolute time. The tau gives you access to the intrinsic time scale of the system. See you are interested in time, but the problem is that dimensionally to the whatever power needs to be dimensionless. That's a unit argument. So now you end up with this time called tau to let you use time again instead of some strange unitless quantity. The power of tau is that it basically describes how fast the system relaxes, but not where it stops, that's set by the input — and it gives you the time scale that the system operates at. It's like using a yardstick when you are measuring on a football field or an odometer when you are measuring your trip distance. Each of these things has a natural distance scale. Similarly you may think that your trip to a restaurant has a certain timescale. If you stop at a restaurant and the mean wait time is 15 minutes for all your trips, you will definitely have an opinion that the service is slow if it is 30 or 45 minutes.
Step response: charging from zero
Switch on at with the capacitor initially uncharged. The ODE is linear with a constant input; the closed-form solution is the textbook exponential approach to the input level:
The capacitor voltage starts at 0 and asymptotes to . At it's at 63.2% of the way there, at 86.5%, at 95.0%, at 99.3%. The 63%-86%-95%-99% pattern is worth memorizing — it shows up every time you compute "how long until this signal has settled."
Discharge: releasing stored charge
Same circuit, now is removed (or grounded), and the capacitor starts at . The ODE becomes , with solution:
A pure exponential decay, the time-reversal of the charging case. At 36.8% of the original voltage remains; at , 0.67%. The capacitor is forgetting.
Numerical simulation
The closed form is exact, but it's useful to know that a basic forward-Euler integration gets the right answer at small step size — and that the same integrator generalizes immediately to circuits without closed forms.
"""
RC circuit step response: numerical vs analytic.
Circuit: voltage source V_in switched on at t=0, in series with R and C.
Initial condition: capacitor uncharged.
ODE: tau dV/dt = V_in - V (tau = R C)
Soln: V(t) = V_in (1 - exp(-t/tau))
"""
import numpy as np
R = 1.0e3 # 1 kOhm
C = 1.0e-6 # 1 uF
tau = R * C # 1 ms
V_in = 1.0 # 1 V step at t=0
# Numerical integration with forward Euler
dt = 1.0e-6
t_max = 5 * tau
t = np.arange(0.0, t_max + dt, dt)
V = np.zeros_like(t)
for i in range(1, len(t)):
dV_dt = (V_in - V[i-1]) / tau
V[i] = V[i-1] + dt * dV_dt
V_analytic = V_in * (1.0 - np.exp(-t / tau))
print(f"R = {R} Ohm, C = {C*1e6} uF, tau = R*C = {tau*1e3} ms")
print()
print(f"{'t/tau':>6} {'V_numerical':>14} {'V_analytic':>14} {'% of V_in':>12}")
for n in [1, 2, 3, 4, 5]:
idx = int(n * tau / dt)
print(f"{n:6d} {V[idx]:14.6f} {V_analytic[idx]:14.6f} {V_analytic[idx]/V_in*100:11.2f}%")
print()
print(f"max |numerical - analytic| over the interval: {np.max(np.abs(V - V_analytic)):.2e}") Output for a representative , giving :
R = 1000.0 Ohm, C = 1.0 uF, tau = R*C = 1.0 ms
t/tau V_numerical V_analytic % of V_in
1 0.632305 0.632121 63.21%
2 0.864800 0.864665 86.47%
3 0.950288 0.950213 95.02%
4 0.981721 0.981684 98.17%
5 0.993279 0.993262 99.33%
max |numerical - analytic| over the interval: 1.84e-04 The forward-Euler trajectory matches the closed form to within at the chosen step size. With a more accurate integrator (RK4) or smaller the agreement improves further. The 63%-86%-95%-99% numbers are visible in the right-most column.
The same equation, everywhere
The reason the RC circuit is worth knowing cold is that the same first-order linear ODE shows up in dozens of places — anywhere a system has a single "stored quantity" being driven by a "source" through some "resistance." A partial list:
- Leaky integrate-and-fire neuron. The membrane is exactly this circuit, with and a threshold-and-reset rule layered on top. The whole subthreshold dynamics are the RC response. See LIF.
- Low-pass filter. In the frequency domain, this circuit attenuates frequencies above . The simplest audio low-pass filter, the simplest anti-aliasing filter, the simplest smoothing filter on a sensor reading — all RC.
- Button debouncing. A mechanical switch makes ringing noise on contact (the bounces). A small capacitor across it (with implicit input resistance) integrates the noise into a clean transition over a chosen .
- Sample-and-hold. The holding capacitor in an ADC stores the sampled voltage while the conversion runs. The driving impedance and the hold capacitor set a that bounds how fast you can sample.
- Battery and supercapacitor charging. Any system with a fixed source impedance charging a capacitive load. The charging curve is exactly the RC step response, with ranging from microseconds (capacitor banks) to hours (lithium cells).
- Thermal RC. A heated mass with a thermal capacitance connected to ambient through a thermal resistance follows the same equation, with temperature in place of voltage. Cooling curves, oven warm-ups, CPU thermals — all RC.
- Electron transport (Drude). Between collisions an electron's momentum relaxes by the same first-order law, , so — here is the scattering time. DC conductivity drops straight out, and the effective mass rides along in the mobility .
- Gradient-descent convergence. Gradient flow on a quadratic, , relaxes each eigendirection with its own time constant of the Hessian. The slowest mode sets convergence, and the condition number is the ratio of the longest to the shortest relaxation time. Plain gradient descent is the forward-Euler version of this flow.
Whenever a system has one state variable being pulled toward an input through a finite rate, you get this equation. Recognizing it on sight saves you from re-deriving it.
That "finite rate" has a name: it is an eigenvalue. Linearize any stable system near equilibrium and you get , which relaxes with time constants — one state variable, one ; many variables, a whole spectrum of them. That is why the same turns up as the RC time constant, the Drude scattering time, and gradient descent's : a relaxation time is an inverse eigenvalue, wearing different variable names each time.
What's next
The natural extensions:
- RL circuit: replace the capacitor with an inductor. Same shape of equation, with current as the state instead of voltage; .
- RLC circuit: add an inductor to RC. Second-order ODE, can oscillate, has a resonance frequency and a quality factor. The mass-spring-damper of analog electronics.
- Frequency response and impedance: viewing , , as complex impedances (resistor: ; capacitor: ; inductor: ) lets you analyze any linear circuit in the frequency domain without re-deriving its ODE. Transfer functions, Bode plots, filter design — all built on this.
- Active filters and op-amp circuits: combining op-amps with RCs gets you arbitrary higher-order filter responses, oscillators, integrators, differentiators.
Related on this site
KCL, KVL, and Ohm's law are the laws this page applies. Leaky integrate-and-fire is the same equation with biological variables and a spike rule. Control theory covers first-order systems abstractly — the RC circuit is the canonical example of a first-order lag, and the -and-step-response analysis is reused for every first-order control system. Explicit Euler is the integrator used in the simulation above.