The capacitor and the switch
A 12 V source, switch S1, a 10 kΩ resistor and a 100 µF capacitor form one loop. Switch S2 can join the resistor straight to the bottom wire. Both switches are open and the capacitor is empty.
A capacitor is two plates with a gap. Its current is i = C·dv/dt: current flows only while its voltage changes. So its voltage cannot jump; a jump would need infinite current. It stores energy ½Cv².
At t = 0, S1 closes. The capacitor voltage cannot jump, so just after (t = 0⁺) it is still 0 V. All 12 V sits across R: i(0⁺) = Vs/R = 12 / 10 kΩ = 1.2 mA.
Step response: charging
Walk round the loop (Kirchhoff's voltage law): Vs = R·i + vC. Put i = C·dvC/dt in: RC·dvC/dt + vC = Vs. It has one derivative, so it is a first-order circuit.
The product RC has units of seconds. It is the time constant: τ = 10 kΩ × 100 µF = 1.0 s. After one τ the capacitor reaches 1 − e⁻¹ = 63.2 % of the way: 7.59 V.
vC(t) = Vs(1 − e^(−t/τ)) climbs fast, then slower. The current i(t) = (Vs/R)e^(−t/τ) falls the same way. As vC rises, less voltage is left for R, so less current flows. Watch the dots slow.
At t = 5τ = 5 s the capacitor is at 11.92 V, 99.3 % of 12 V, and the current is only 8.1 µA. Engineers call it settled: in steady DC a capacitor carries no current, like an open circuit.
By 5τ the source has given 14.3 mJ. The capacitor stores ½Cv² = 7.10 mJ and the resistor turned 7.20 mJ into heat. Charging fully, exactly half becomes heat, whatever the value of R.
Natural response and the pattern
At 5 s, S1 opens and S2 closes. No source is left: the capacitor drives current back through R. vC = V0·e^(−t′/τ), where t′ is time since the switch and V0 = 11.92 V. The current reverses: i = −1.19 mA at first.
Both curves follow one rule: x(t) = x(∞) + [x(0⁺) − x(∞)]·e^(−t/τ). Find the start value, the final value and τ = RC, and you have the whole response. Charging: 0 to 12 V. Discharging: 11.92 V to 0.
The working
# step 1/10 · circuit source Vs = 12 V resistor R = 10 kΩ capacitor C = 100 µF, empty: vC = 0 switch S1 open (closes at t = 0) switch S2 open (closes at t = 5 s) No closed path: no current yet.
The parts are ideal: the source holds 12 V, the switches flip instantly and the capacitor does not leak. S1 opens at the same instant S2 closes, at t = 5 s = 5τ. Every number in the figure is computed from this model.