Learning Objectives
By the end of this section you will be able to:
- Derive the series-RLC differential equation directly from Kirchhoff's voltage law.
- Recognize that the RLC equation is the same second-order linear ODE as the mass–spring–damper, so everything you learned in Section 22.06 applies here verbatim.
- Classify a circuit as overdamped, critically damped, or underdamped from the discriminant .
- Compute the undamped natural frequency , the damping ratio , and the damped frequency .
- Track energy as it sloshes between the capacitor (electric field) and the inductor (magnetic field), with the resistor monotonically converting it into heat.
- Implement both an analytic solver and a numerical state-space solver in Python, and reproduce them with PyTorch's matrix exponential.
Why an RLC Circuit Is the Same Story
"Electromagnetism and mechanics share a hidden mathematical spine." The RLC circuit is the cleanest place to feel this.
In Section 22.06 we studied a mass on a spring with damping. We are about to write down the equation for a circuit made of an inductor, a resistor, and a capacitor in series. Letter by letter the two systems are different — one has mass and forces, the other has charge and voltage. Coefficient by coefficient they are identical. The same characteristic polynomial appears, the same three damping regimes appear, the same energy-exchange picture appears.
That is not a coincidence. It is a consequence of the universal structure of any linear oscillator: inertia + restoring force + dissipation. Once you can solve one, you can solve the other — which is why a single section of calculus unlocks both your physics and your electrical-engineering courses.
The equation we are about to solve
For a series circuit with inductance , resistance , capacitance , and capacitor charge :
The loop current is . Two initial conditions are required: (initial capacitor charge) and (initial current).
The Three Elements
Before we derive the ODE, let's make sure each element's voltage law is crystal clear. Voltage across an element and current through it are related by:
| Element | Voltage law | Plain-English meaning |
|---|---|---|
| Resistor (R) | v_R = R · i | Ohm's law. The resistor instantly converts current into heat in proportion to its current. |
| Inductor (L) | v_L = L · di/dt | An inductor resists CHANGES in current. The faster current changes, the bigger the voltage it develops to oppose that change (Lenz's law). |
| Capacitor (C) | v_C = q / C | A capacitor stores charge q. Its voltage is just charge divided by capacitance. Note: i = dq/dt, so charge builds up by integrating current. |
Why the inductor is the "mass" of a circuit
The inductor formula looks exactly like Newton's second law — force opposes changes in velocity. Inductors are mechanical inertia for electrons. The capacitor, meanwhile, plays the role of the spring: it stores energy by being "displaced" from zero charge.
Deriving the RLC Equation from Kirchhoff
Kirchhoff's voltage law (KVL) says: the sum of the voltage drops around any closed loop is zero. For our series RLC loop with no external source:
Substitute each element's law:
Now the trick: everything in terms of one variable. Because current is the rate of charge flow, , and . Substituting:
This is a homogeneous second-order linear ODE with constant coefficients. Compare with the abstract form from Section 22.01:
| Abstract symbol | RLC meaning |
|---|---|
| a | L (inductance) |
| b | R (resistance) |
| c | 1/C (inverse capacitance, sometimes called 'elastance') |
| y(t) | q(t) (capacitor charge) |
| y'(t) | i(t) (loop current) |
Characteristic Equation & Roots
Try . Then and . Substituting and dividing out :
a plain quadratic in with discriminant
The roots are
Sign of tells you everything. The boundary happens when
Above , the circuit is too lossy to oscillate — it just slumps back to zero charge. Below it, the circuit rings.
The two engineering parameters
Engineers almost never quote directly. They use:
- — the undamped natural frequency. The frequency the circuit would oscillate at if R = 0.
- — the damping ratio. Dimensionless.
In these variables the ODE becomes , which is the universal form shared by every weakly-damped second-order system in nature.
The Three Damping Regimes
| Regime | Condition | Roots | q(t) |
|---|---|---|---|
| Overdamped | ζ > 1 (R > 2√(L/C)) | Two distinct negative reals r₁, r₂ | C₁ e^(r₁t) + C₂ e^(r₂t) — no oscillation, slow return |
| Critically damped | ζ = 1 (R = 2√(L/C)) | One repeated real root r = −R/(2L) | (C₁ + C₂ t) e^(rt) — fastest non-oscillating return |
| Underdamped | 0 < ζ < 1 (R < 2√(L/C)) | α ± iβ with α = −R/(2L), β = √(−Δ)/(2L) | e^(αt) (C₁ cos βt + C₂ sin βt) — damped sinusoid |
In the underdamped case the angular oscillation frequency is . This is lower than the undamped natural frequency — damping not only kills the amplitude, it slightly slows the ringing.
The s-plane picture
Engineers plot the roots in the complex s-plane. Left half-plane ⇒ stable (decaying). Right half-plane ⇒ unstable (growing). Imaginary axis ⇒ pure (undamped) oscillation. For our passive RLC with , the roots are always in the left half-plane — passive circuits cannot go unstable on their own.
Mechanical–Electrical Analogy
Match the coefficients of against :
| Mechanical | Symbol | Electrical analog | Symbol |
|---|---|---|---|
| Mass (inertia) | m | Inductance (electromagnetic inertia) | L |
| Damping coefficient | c | Resistance | R |
| Spring stiffness | k | Inverse capacitance (elastance) | 1/C |
| Displacement | x | Capacitor charge | q |
| Velocity | ẋ | Current | i = q̇ |
| Applied force | F(t) | Source voltage | v_s(t) |
| Kinetic energy | ½ m ẋ² | Magnetic energy in inductor | ½ L i² |
| Spring potential energy | ½ k x² | Electric energy in capacitor | q²/(2C) |
This is not a metaphor — it is a literal mathematical equivalence. Any theorem you prove about one system maps directly onto the other. Electrical engineers exploit this so thoroughly that simulators like SPICE solve the SAME ODE solver backend that mechanical-engineering FEM codes do.
The Energy View: An LC Tank Sloshes, R Burns
Multiply the ODE through by :
The first and last terms are perfect derivatives: and . So:
Read this carefully — it's one of the most beautiful equations in elementary physics:
- If R = 0 the right-hand side is zero, so is conserved. Energy oscillates perfectly between the capacitor (electric field, term ) and the inductor (magnetic field, term ). It sloshes back and forth forever.
- If R > 0 the right-hand side is strictly negative whenever — energy drains monotonically out of the LC tank as heat in the resistor.
- The instantaneous power dissipated by the resistor is — Joule heating. Integrating this gives the total heat produced; it equals the total initial energy in the long-time limit.
LC tanks are oscillators
A capacitor and an inductor with no resistance form a perfect oscillator at frequency . This is the principle behind radio tuners, crystal oscillators, and the quartz-clock crystal in every watch — choose and to put at the station you want to receive.
Worked Example (Step-by-Step)
Solve with . These coefficients correspond to , , (so ).
Click to expand the full hand calculation
Compare with : so .
. Negative ⇒ underdamped (complex-conjugate roots, the circuit will ring).
. Our is far below , so this is a lightly-damped circuit.
rad/s. (dimensionless).
(decay rate). (damped frequency).
Cross-check with ✓.
At : ⇒ .
Using the product rule on :
At : ⇒ .
✓. ✓.
At : , , . So
The capacitor has swung past zero and now holds about half a coulomb of opposite polarity — the LC tank is ringing. Verify this against the interactive plot below (L = 1, R = 0.4, C = 0.25, q(0) = 1, i(0) = 0).
Initial energy: . At , the envelope has shrunk by , so total energy is roughly . The missing has been dissipated as heat in .
Interactive RLC Explorer
Drag the sliders for , , , , and and watch the capacitor charge polarity flip, current dots flow around the loop, and the time series react in real time. The readouts show the damping regime, the natural frequency , the damping ratio , and the damped frequency .
Things to try
- Set for a perfect LC tank. The charge and current swap roles forever; the envelope is a flat horizontal line.
- Crank up to (the critical value). The charge slumps to zero in the fastest possible non-oscillating way.
- Push beyond that. Now the circuit is overdamped — too sluggish to swing past zero.
- Shrink . The natural frequency increases, so the circuit rings faster.
Interactive Energy Visualizer
Same circuit, different lens. The three bars on top show the instantaneous electric energy in the capacitor (red), the magnetic energy in the inductor (purple), and the cumulative heat dumped into the resistor (orange). The plot underneath traces all three over time. With the dashed total-energy curve is a flat line; with it decays as .
Why the total decays at e^(-Rt/L), not e^(-Rt/(2L))
The amplitude of decays as . But energy is quadratic in and in , so the energy envelope decays at double the rate: . This is why oscillators are often characterised by their quality factor — the number of radians the system rings through before its energy drops by a factor of .
Computation in Python
We will write two solvers: one analytic (using the closed-form solutions we just derived for all three regimes), and one numerical (using classical RK4 on the equivalent 2-D first-order system). On any reasonable time grid they should agree to ~10⁻⁸.
Analytic solver — closed form for all three regimes
Numerical solver — RK4 on the 2-D state-space form
Any real-world RLC circuit you simulate (with diodes, op-amps, time- varying components, nonlinear loads) will require a numerical solver. The standard recipe converts the second-order ODE into a first-order vector ODE by stacking :
The eigenvalues of this state matrix are exactly the characteristic roots . Engineers call this the state-space form of the circuit, and it is the universal input format for control-theory tools.
PyTorch View: State-Space and Matrix Exponential
Because is linear with constant , an extraordinary fact applies: the exact solution is
where is the matrix exponential. PyTorch ships , which evaluates this to machine precision. No numerical-integrator error.
Why PyTorch and not just NumPy?
Three reasons. First, autodiff: with PyTorch you can differentiate through and fit them to experimental oscilloscope traces by gradient descent. Second, GPU acceleration: batched RLC simulations (e.g. parameter sweeps for a circuit-design optimization) parallelize trivially. Third, this is the building block of linear neural ODEs — a learnable matrix whose eigenvalues encode the continuous-time dynamics of a network.
Where This Shows Up
📻 Radio & signal processing
- Tuned LC tanks select a single AM/FM station by setting to the carrier frequency.
- Band-pass and notch filters in analog audio.
- Crystal oscillators in every microcontroller clock.
⚡ Power electronics
- Snubber circuits clamp transients on switching power supplies.
- LC filters smooth the output of buck/boost converters.
- EMI suppression chokes on USB and HDMI cables.
🩺 Medical & sensors
- MRI gradient coils — heavily damped LRC stages.
- Inductive proximity sensors and metal detectors.
- Wireless power-transfer pickup coils.
🤖 Control & ML
- State-space form is the input to every control-theory tool (PID tuning, LQR, Kalman filters).
- Linear neural ODEs and SSMs (Mamba, S4) reuse the exact machinery.
- Battery and motor models in EV control software.
Common Pitfalls
Don't confuse i(0) with q(0)
A series RLC needs both initial values. A common student mistake is to specify only the capacitor's initial charge and forget about the initial current. Without the solution is under-determined.
Sign convention on q and i
We chose with a specific loop-traversal direction. Reversing the assumed direction of flips the sign of the cross-term but gives the same q(t). Stay consistent within a single analysis.
The discriminant is R² − 4L/C, NOT R² − 4LC
Because the coefficient of is , the discriminant of the characteristic polynomial picks up the : , equivalently . Writing is dimensionally wrong.
Parallel RLC ≠ series RLC
A parallel RLC (R, L, C all connected to the same two nodes) obeys a similar second-order ODE, but the roles of and swap, and the natural variable is voltage rather than charge. The shape of the math is identical; the coefficient mapping is different.
Summary
Every series RLC circuit (no source) obeys the same second-order linear ODE. The recipe to analyze it is universal:
- Write Kirchhoff's voltage law and substitute to get .
- Form the characteristic equation and compute the discriminant .
- Classify (overdamped / critical / underdamped) and write the appropriate general solution.
- Apply the two initial conditions to solve for (or ).
- Compute engineering parameters , , .
- Track energy via ; .
Master equation at a glance
| Quantity | Mechanical (Sec 22.06) | Electrical (this section) |
|---|---|---|
| ODE | m ẍ + c ẋ + k x = 0 | L q̈ + R q̇ + (1/C) q = 0 |
| Inertia coefficient | m | L |
| Damping coefficient | c | R |
| Restoring coefficient | k | 1/C |
| Natural frequency | ω₀ = √(k/m) | ω₀ = 1/√(LC) |
| Damping ratio | ζ = c/(2√(mk)) | ζ = (R/2)√(C/L) |
| Critical condition | c² = 4mk | R² = 4L/C (R_crit = 2√(L/C)) |
| Energy | ½ m ẋ² + ½ k x² | ½ L i² + q²/(2C) |
| Dissipated power | c ẋ² | R i² |
Coming next: Chapter 22 wraps up here. With forced oscillations, resonance, mechanical vibrations, and RLC circuits behind us, you now own the entire theory of second-order linear ODEs with constant coefficients — the workhorse equation of classical physics, signal processing, and continuous-time control. Chapter 23 lifts the assumption that the coefficients are constant.