Integrals as areas
About this lesson
When a capacitor charges, the current into it falls over time. How much charge did it collect? Multiply current by time, but the current keeps changing, so slice time into thin strips and add up rectangles. Watch a Riemann sum close in on the exact area, the definite integral, and see why the slope of the running area is the curve itself.
Current is a rate
Close the switch at t = 0. Current i flows from the 5 V source through R into the capacitor C. Current is a rate: 1 mA carries 1 µC of charge every millisecond. How much charge has C collected after 3 ms?
>>> 5 / 1000 # i = V / R at t = 0, in amps 0.005 >>> 1e-3 * 1e-3 # 1 mA for 1 ms, in coulombs 1e-06
Read the lesson step by step
Current is a rate
Close the switch at t = 0. Current i flows from the 5 V source through R into the capacitor C. Current is a rate: 1 mA carries 1 µC of charge every millisecond. How much charge has C collected after 3 ms?
>>> 5 / 1000 # i = V / R at t = 0, in amps 0.005 >>> 1e-3 * 1e-3 # 1 mA for 1 ms, in coulombs 1e-06The current falls
At first C is empty, so all 5 V sits across R and i = 5 V / 1 kΩ = 5 mA. As C charges, i falls: i(t) = 5e^(−t/τ) mA, where τ = RC = 1 ms is the time constant.
>>> from math import exp >>> [round(5*exp(-t), 2) for t in (0, 1, 2, 3)] # mA [5.0, 1.84, 0.68, 0.25] >>> 1e3 * 1e-6 # tau = R*C, in seconds 0.001One slice is a rectangle
Over a short time the current barely changes, so charge = current × time: the area of a thin rectangle under the plot. Slice 1 is 0.5 ms wide and 5 mA tall: 5 mA × 0.5 ms = 2.5 µC.
>>> 5 * 0.5 # mA × ms = µC 2.5 >>> 5e-3 * 0.5e-3 # the same in A × s = C 2.5e-06Add up the slices
Cut 0 to 3 ms into six slices. Make each one as tall as the current at its left edge, and add the areas. This is a Riemann sum. The six slices hold 6.04 µC.
>>> from math import exp >>> def area(n, T=3.0): ... dt, q = T / n, 0.0 ... for k in range(n): ... q += 5*exp(-k*dt) * dt ... return q ... >>> round(area(6), 2) # µC 6.04The corners overshoot
Check it: 6.04 µC on a 1 µF capacitor would mean 6.04 V, more than the 5 V source can give. The current falls inside every slice, so each rectangle pokes above the curve. Those red corners are the error.
>>> 6.04e-6 / 1e-6 # q / C, in volts 6.04 >>> 6.04 > 5 TrueThinner slices
Use more, thinner slices and the corners shrink. Thirty slices of 0.1 ms give 4.99 µC. Three hundred slices of 0.01 ms give 4.77 µC, and 3000 give 4.75 µC. The sums settle on one number.
>>> from math import exp >>> def area(n, T=3.0): ... dt, q = T / n, 0.0 ... for k in range(n): ... q += 5*exp(-k*dt) * dt ... return q ... >>> [round(area(n), 2) for n in (6, 30, 300, 3000)] [6.04, 4.99, 4.77, 4.75]The limit is the integral
The number the sums approach as the slices get infinitely thin is the definite integral: q = ∫₀³ i(t) dt = 4.75 µC, the exact area under the curve. The ∫ sign is a stretched S for sum; dt is the shrinking slice width.
>>> from math import exp >>> round(5 * (1 - exp(-3)), 4) # exact area, µC 4.7511 >>> round(5 * (1 - exp(-3)), 2) 4.75Area so far is charge
Now let the right edge move. The area from 0 up to any time t is the charge collected so far, q(t). Plotted, it is a second curve that climbs fast at first, then flattens as the current dies away.
>>> from math import exp >>> [round(5*(1 - exp(-t)), 2) for t in (0, 1, 2, 3)] # µC [0.0, 3.16, 4.32, 4.75]Slope of area is height
The fundamental theorem of calculus: area grows at the rate of the curve, so dq/dt = i. We need a q whose slope is 5e^(−t): q(t) = 5(1 − e^(−t)) µC, t in ms. At 3 ms, q = 4.75 µC.
>>> from math import exp >>> q = lambda t: 5 * (1 - exp(-t)) >>> h = 1e-6 >>> round((q(1 + h) - q(1)) / h, 4) # slope of q at 1 ms 1.8394 >>> round(5 * exp(-1), 4) # i at 1 ms 1.8394Charge sets the voltage
A capacitor's voltage is its charge over its capacitance: vC = q / C = 4.75 µC ÷ 1 µF = 4.75 V. After three time constants C holds 95% of the 5 V. This is the RC charging curve.
>>> from math import exp >>> q, C = 5e-6 * (1 - exp(-3)), 1e-6 >>> round(q / C, 2) # volts 4.75 >>> round(1 - exp(-3), 3) # fraction of 5 V 0.95
5 quick questions
Choose one answer per question. You can change your choices before checking them.
01A constant current of 2 mA flows into a capacitor for 3 ms. How much charge does it deliver?
On an i–t graph this is a rectangle 2 mA tall and 3 ms wide. Its area is 2 mA × 3 ms = 6 µC, because mA × ms = 10⁻³ A × 10⁻³ s = 10⁻⁶ C.
02The current is falling. Why does a left-endpoint Riemann sum give too much charge?
On a falling curve the left edge is the tallest point of each slice, so every rectangle includes a corner of extra area. Here six slices give 6.04 µC against an exact 4.75 µC.
03What happens to a Riemann sum as the number of slices grows without limit?
Each slice gets thinner while there are more of them; the sum settles on a limit. In the lesson: 6.04, 4.99, 4.77, 4.75 µC for 6, 30, 300 and 3000 slices.
04q(t) is the area under i(t) from 0 to t. What is the slope of q(t) at any moment?
That is the fundamental theorem of calculus: the running area grows at the rate of the curve's height, so dq/dt = i. That is why q(t) = 5(1 − e^(−t)) works: its slope is 5e^(−t).
05A 2 µF capacitor that started empty has collected 10 µC of charge. What is its voltage?
v = q / C = 10 µC ÷ 2 µF = 5 V. Integrate the current to get the charge, then divide by the capacitance.
Glossary
- Rate
- How fast something changes per unit of time. Current is a rate: charge per second (1 A = 1 C/s).
- Area under a curve
- For a rate plotted against time, the area between the curve and the time axis is the total amount that built up.
- Riemann sum
- An estimate of an area made by cutting it into thin slices and adding up rectangles. A left-endpoint sum uses the curve's height at each slice's left edge.
- Definite integral
- The exact area under a curve between two points, written ∫ₐᵇ f(t) dt: the limit of Riemann sums as the slices get infinitely thin.
- Antiderivative
- A function F whose slope (derivative) is the curve f. The definite integral from a to b equals F(b) − F(a).
- Fundamental theorem of calculus
- The rule that links slopes and areas: the running area under f grows at the rate f, so differentiation undoes integration.
- Time constant (τ)
- In an RC circuit τ = R × C. After one τ the charging current has fallen to about 37% of its start; after 3τ the capacitor holds about 95% of the source voltage.
- Capacitance
- Charge stored per volt: C = q / v, measured in farads (F). 1 µF stores 1 µC per volt.
Notes and sources
- Units multiply like numbers: mA × ms = (10⁻³ A)(10⁻³ s) = 10⁻⁶ C = 1 µC. Keeping units on every number is the quickest check that an area means what you think.
- Left-edge rectangles overestimate a falling curve and underestimate a rising one. Taking each slice's height at its middle is usually much closer: six midpoint slices give 4.70 µC here.
- Area below the time axis counts as negative. When the capacitor discharges, current flows the other way, i is negative, and the integral takes charge away.
- Check an antiderivative by taking its slope: the derivative of 5(1 − e^(−t)) is 5e^(−t), the current. The definite integral is the change F(3) − F(0) of any such F.
- In general a capacitor that starts at vC(0) reaches vC(t) = vC(0) + (1/C)∫₀ᵗ i dt: integrate the current, divide by C.
- OpenStax Calculus Volume 1, 5.1 Approximating Areas (Riemann sums)
- OpenStax Calculus Volume 1, 5.2 The Definite Integral
- OpenStax Calculus Volume 1, 5.3 The Fundamental Theorem of Calculus
- MIT OpenCourseWare 18.01SC Single Variable Calculus (Unit 3: the definite integral)
- OpenStax University Physics Volume 2, 10.5 RC Circuits
- OpenStax University Physics Volume 2, 9.1 Electrical Current
- Python library: math.exp
Quiz Unlocks after the last step.