Choose one node as the reference (ground); the voltage of every other node relative to it is a node voltage. At each other node write Kirchhoff's current law (KCL, Chapter 1): the currents leaving the node sum to zero. Replace each branch current by its element law: a resistor's current is its conductance 1/R (siemens, S) times a difference of node voltages, and a current source's value is a known term. A voltage source has no current law, so its current becomes one more unknown and the source adds one row: its two node voltages differ by the source value. Every row is then linear in the unknowns, with each source value on the right-hand side.
NODE EQUATIONS OF A LINEAR CIRCUIT
Gx=s
For resistors and sources: a KCL row per non-reference node and a row per voltage source. The unknowns, node voltages (V) and voltage-source currents (A), are collected together in x. G holds conductances (S), and 1, −1 or 0 where a voltage source enters. s holds source currents (A) in KCL rows and source voltages (V) in source rows.
PROPORTIONALITY AND SUPERPOSITION
x=G−1s=G−1s1+G−1s2+⋯
Needs every element linear and detG=0. sk is s with every source but source k at zero, so s=s1+s2+⋯. A zero voltage source is a short circuit (0 V at any current), a zero current source an open circuit (0 A at any voltage). Scaling every source by K scales x by K: proportionality.
A capacitor adds Cdv/dt to a KCL row and an inductor adds L1∫0tvdt, with v the element's voltage. First split any initial capacitor voltage or inductor current off as an independent source, so each element starts from zero. The rows then hold derivatives and integrals, not one matrix, but every term is still linear, since the derivative and the integral of a sum are the sums of each. So if x1 answers s1 and x2 answers s2, then x1+x2 answers s1+s2, and superposition carries over.