Learn & build · Electronics · Chapter 6

The circuit-theory toolkit

Every circuit on this site is solved by a program. This chapter shows how, so you can do it yourself on paper: two laws that hold everywhere, a recipe that turns any circuit into a matrix, a trick that shrinks any circuit to one battery and one resistor, and the idea that makes AC as easy as DC: treating waves as spinning arrows.

In plain words: charge doesn't pile up anywhere (what flows into a point flows out), and voltage is like height (go around any loop and you end up where you started). Everything else in circuit theory is careful bookkeeping of those two facts.

1. What flows in flows out

A junction where four wires meet. Set three of the currents (arrows pointing in are positive); the fourth has no choice.

The pictureWater in pipes: a junction can't store water, so the flow into it equals the flow out of it.
The mathKirchhoff's current law (KCL): \(\sum_k I_k = 0\) at every node, counting currents in as + and out as −.

Into a node: 5 mA and 2 mA. Out of it: 9 mA through one wire. How much current flows in through the fourth wire?

In = out: \(5 + 2 + I_4 = 9\), so \(I_4 = 2\) mA flowing in. (Had the answer come out negative, it would have meant the current actually flows out: the sign tells you the direction.)

2. Voltage is height

Think of every point in a circuit as having a height: its voltage. A battery is an escalator, lifting charge up by its voltage; each resistor is a ramp back down, by \(I \cdot R\). Walk all the way around the loop and you're back where you started, so the climbs and drops cancel. Here's a battery and two resistors, drawn with voltage as height.

The pictureA hike around a loop: however you go up and down, you end at the height you started from.
The mathKirchhoff's voltage law (KVL): \(\sum_k V_k = 0\) around any closed loop, counting rises + and drops −.

9 V battery, R₁ = 1 kΩ, R₂ = 2 kΩ in a loop. How much voltage drops across R₂?

Current \(I = 9 / 3000 = 3\) mA; \(V_2 = 3\text{ mA} \times 2\text{ kΩ} = 6\) V. Check with KVL: \(+9 - 3 - 6 = 0\). ✓

3. Any circuit is a matrix

The two laws are enough to solve any circuit, and there's a recipe that never fails, called nodal analysis. It's exactly what the simulator behind every picture on this site does, a few thousand times a second.

  1. Pick one node as ground (0 V). Call the other node voltages \(v_1, v_2, \dots\): those are the unknowns.
  2. At each unknown node, write KCL, with every resistor current written as (voltage here − voltage there) / R.
  3. You get one linear equation per node: a matrix equation \(G\,v = i\). Solve it.

Example: a 10 V source feeds node 1 through 1 kΩ; node 1 goes to ground through 2 kΩ and to node 2 through 1 kΩ; node 2 goes to ground through 3 kΩ. Change the resistors and watch the matrix and the answer update.

The math, step by step

KCL at node 1 (currents leaving the node add up to zero):

\[ \frac{v_1 - 10}{R_a} + \frac{v_1}{R_b} + \frac{v_1 - v_2}{R_c} = 0 \]

and at node 2:

\[ \frac{v_2 - v_1}{R_c} + \frac{v_2}{R_d} = 0 \]

Collect the \(v\)'s, writing \(G = 1/R\) (conductance, in siemens):

\[ \begin{pmatrix} G_a + G_b + G_c & -G_c \\ -G_c & G_c + G_d \end{pmatrix} \begin{pmatrix} v_1 \\ v_2 \end{pmatrix} = \begin{pmatrix} 10\,G_a \\ 0 \end{pmatrix} \]

A pattern you can write without thinking: each diagonal entry is the sum of conductances touching that node; each off-diagonal entry is minus the conductance between two nodes; the right side is current pushed in by sources. Diodes and transistors make the equations non-linear: the simulator guesses, linearizes around the guess, solves this same kind of matrix, and repeats (Newton's method, chapter 2 of the AI course).

4. Any circuit, seen from two terminals, is one battery and one resistor

This is Thevenin's theorem, and it's the most useful shortcut in electronics. However complicated a circuit of sources and resistors is, from the outside, at two terminals, it behaves exactly like one voltage source \(V_{th}\) with one resistor \(R_{th}\) in series. Below, a voltage divider is the "black box". Turn the load and watch the operating point slide along a straight line.

🎯 Challenge: find the load that gets the most power out of the box.

The math, step by step

Two measurements give both numbers. Open circuit (no load): the output is \(V_{th}\). Short circuit (a wire): the current is \(I_{sc} = V_{th}/R_{th}\). So

\[ R_{th} = \frac{V_{oc}}{I_{sc}} \]

For a divider of 12 V with \(R_1 = R_2 = 1\) kΩ: \(V_{th} = 6\) V, and \(R_{th}\) is \(R_1\) and \(R_2\) in parallel, 500 Ω (turn every source off, meaning batteries become wires, and look back into the terminals).

With a load \(R_L\): \(I = V_{th}/(R_{th} + R_L)\) and the power in the load is

\[ P_L = \frac{V_{th}^2\, R_L}{(R_{th} + R_L)^2} \]

Its slope is zero at \(R_L = R_{th}\) (set the derivative to zero, chapter 2 of the AI course): maximum power transfer, delivering \(V_{th}^2 / 4R_{th}\). At that point half the power is wasted in \(R_{th}\), so power supplies aim for \(R_L \gg R_{th}\) instead; antennas and audio amplifiers match to get the most out.

A box measures 9 V open-circuit and 3 kΩ inside. What current flows into a 0 Ω short?

\(I_{sc} = 9 / 3000 = 3\) mA. Equivalently, a meter on its current range across the terminals would read 3 mA.

A 50 Ω antenna feeds a receiver. For the most signal power, what should the receiver's input resistance be?

Maximum power transfer: \(R_L = R_{th}\). That's why radio gear is "50 Ω everywhere" (radio course, chapter 12).

Seen from two terminals, any circuit of sources and resistors is one battery with one resistor in series: measure the open-circuit voltage and the short-circuit current, and you know it.

5. Superposition: one source at a time

In a circuit of resistors (linear parts), the effect of several sources is the sum of each one's effect alone, with the others turned off (voltage sources replaced by wires; current sources, parts that push a fixed current whatever the voltage, by gaps). It's why you can think about a signal and its DC bias separately: an amplifier's input is "1.65 V of DC plus a small audio wave", and each can be analyzed on its own.

Two equal resistors from a +10 V source and a +4 V source meet at a middle point. With only the 10 V source (4 V replaced by a wire) the middle is at 5 V; with only the 4 V one, 2 V. What's the middle voltage with both?

\(5 + 2 = 7\) V, the average of 10 and 4, as you'd expect for equal resistors.
Where it breaks: add a diode and the sums stop working

Superposition, and Thevenin too, need every part to be linear: twice the voltage, twice the current. A diode isn't (chapter 4). Put a 1 kΩ resistor and a silicon diode in series, and drive them with a 1 V battery, then a 2 V one, then both in series (3 V). The course's solver gives:

The 1 V battery on its own barely gets past the diode's 0.6 V knee; added on top of 2 V, the whole extra volt goes into the resistor. With two plain resistors (2 kΩ in total) the sums would be exact: 0.5 + 1.0 = 1.5 mA. This is why the simulator can't solve a circuit with diodes in one step and repeats its linear solve (section 3), and why amplifier designers analyze small wiggles around a fixed operating point, where a curve looks almost straight.

6. AC: waves are spinning arrows

For a sine wave, Ohm's law needs one more idea: timing. In a capacitor, current flows most while the voltage is changing fastest, so the current wave peaks a quarter cycle before the voltage wave. The trick (the same one the radio course starts with) is to draw each wave as an arrow spinning around a circle: the wave is its shadow, and timing differences are just angles between arrows. Below, an RC low-pass filter: the resistor's and capacitor's voltages are arrows at right angles, and they add like the sides of chapter 2's right triangle to make the input.

The math, step by step

A sine wave \(V\cos(\omega t + \varphi)\) is the shadow of an arrow of length \(V\) at angle \(\varphi\), spinning at \(\omega = 2\pi f\). Write the arrow as a complex number, \(V e^{j\varphi}\) (radio course chapter 2; engineers write \(j\) for \(\sqrt{-1}\)). Then every part has an impedance, a complex resistance:

\[ Z_R = R, \qquad Z_C = \frac{1}{j\omega C}, \qquad Z_L = j\omega L \]

Dividing by \(j\) turns an arrow back a quarter turn: that's the capacitor's current leading its voltage. Now Ohm's law and the divider formula work exactly as for DC, with complex numbers. The RC low-pass:

\[ \frac{V_{out}}{V_{in}} = \frac{Z_C}{R + Z_C} = \frac{1}{1 + j\omega RC} = \frac{1}{1 + j\, f/f_c} \]

Its length is \(1/\sqrt{1 + (f/f_c)^2}\), chapter 2's formula, and its angle is \(-\arctan(f/f_c)\): at the cutoff the output lags by exactly 45°.

At the cutoff frequency, what's the phase of the RC low-pass output relative to its input?

\(1/(1 + j)\) has angle \(-45°\): the two arrows (resistor and capacitor voltages) are equal and at right angles, so the output sits halfway round.

What is the impedance of a 1 µF capacitor at 0 Hz (DC)?

\(1/(\omega C)\) with \(\omega = 0\) is infinite. At high frequency it's nearly a wire. "Passes AC, blocks DC" in one formula.

Every chapter from here on uses these tools: op-amps (next) are analyzed with KCL and one extra rule, filters with impedances, power supplies with Thevenin. Build any of these circuits in the circuit lab and check the numbers with its meters and scope.

Previous: Real parts · All chapters: Learn & build.

Last updated