How to Derive and Solve the Differential Equation for an RC Capacitor
At a glance
- 1. Write the circuit laws
Use the capacitor relation i = C dv/dt together with Kirchhoff’s voltage law.
- 2. Form the equation
For a series resistor and constant source, write RC dv/dt + v = Vs.
- 3. Apply the initial voltage
Use the capacitor voltage at the switching time to determine the solution’s constant.
- 4. Interpret the time constant
The voltage approaches its final value exponentially, with time constant tau = RC.
A capacitor’s current depends on how quickly its voltage changes, so circuits containing capacitors naturally lead to differential equations. The standard example is a resistor and capacitor in series, connected to a constant voltage source. This article derives the equation, solves it for any initial capacitor voltage, and shows how the result describes charging and discharging.
Start with the capacitor law and Kirchhoff’s law
For a capacitor with capacitance , current and voltage are related by
Here, is the voltage across the capacitor, and the current direction is chosen to enter the capacitor’s positive-voltage terminal. This passive sign convention makes the equation’s sign positive.
Consider a series circuit containing a resistor , a capacitor , and a constant source voltage . Kirchhoff’s voltage law gives
The resistor and capacitor carry the same series current, so substitute :
This is a first-order linear differential equation. It applies after the circuit is switched into this configuration, assuming an ideal constant source and ideal components.
Solve for the capacitor voltage
Divide by to put the equation in standard form:
For a constant source, the steady-state solution is . The difference between the actual voltage and that final value decays exponentially. Thus the general solution is
where is set by the initial condition. If the capacitor voltage at is , then , which gives . Therefore,
The quantity is called the time constant. Since resistance is measured in ohms and capacitance in farads, their product has units of seconds.
The current follows from the capacitor law:
This expression uses the current direction from the source through the resistor into the capacitor’s positive terminal. If the capacitor starts above the source voltage, the calculated current is negative, indicating flow in the opposite direction.
Worked example: charging from zero volts
Suppose a capacitor is connected in series with a resistor to a source. The capacitor is initially uncharged, so .
First calculate the time constant:
The voltage is therefore
At one time constant, :
The initial current is , or . At one time constant it has fallen to . The capacitor voltage rises while the current falls, and both approach their steady-state values exponentially.
Discharging is the same equation with a different final value
If the source is removed and the capacitor discharges through a resistor, set . For an initial voltage , the result becomes
The voltage does not become exactly zero at any finite time in this ideal mathematical model, but it becomes small. At , it is about of its starting value, or 0.67%.
More generally, if a capacitor sees a network that can be replaced by a Thevenin source, use that source’s voltage as and its resistance as . The same solution applies when those equivalent values remain constant after switching.
Common mistakes
- Confusing capacitor voltage and current. The capacitor law is , not . A constant capacitor voltage means zero current in the ideal model.
- Using the wrong sign. Write the voltage law and current direction consistently. If your chosen current enters the negative terminal, the capacitor relation has the opposite sign for that convention.
- Forgetting the initial condition. The capacitor voltage generally cannot jump instantaneously in a circuit with finite current. Use its voltage just before switching as the initial voltage just after switching.
- Mixing units. Convert microfarads to farads and kilo-ohms to ohms before multiplying to find .
- Assuming every capacitor circuit has this exact equation. The equation changes if there are additional components, time-varying sources, or a different equivalent resistance. Derive it from the circuit laws for the configuration you have.
For an arbitrary time-varying source , the same circuit equation still holds, but the solution is not generally a single exponential toward a constant final voltage. You can solve it using an integrating factor or a standard first-order circuit method.
References
- Fundamentals of Electric Circuits, Charles K. Alexander and Matthew N. O. Sadiku
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.