Sub topic 2
Kirchhoff's Current Law Refresher
This chapter assumes you know voltage, current, and resistance, Ohm's law, and how to combine series and parallel resistors. It reviews Kirchhoff's current law (KCL), the rule that every nodal equation in this tutorial is built from.
The Law
A node is a point where two or more circuit elements connect. Charge does not build up at a node in a DC circuit, so the current flowing into a node equals the current flowing out of it. KCL states this in either of two equivalent forms:
- The sum of currents entering a node equals the sum of currents leaving it.
- The algebraic sum of all currents at a node is zero, if you count entering currents as positive and leaving currents as negative (or the reverse, as long as you stay consistent).
Nodal analysis uses the second form with every current written as leaving the node. This convention keeps the signs uniform from one node to the next.
A Worked Example
Take a node where three branches meet. A 5 A source pushes current into the node. One resistor carries an unknown current I1 away from the node, and another carries 2 A away.
Write KCL with currents leaving the node as positive. The source current enters, so it counts as negative:
-5 + I1 + 2 = 0
I1 = 3 AIf the answer had come out negative, the actual current would flow opposite to the arrow you drew. A negative result is not an error. The arrow you chose was only a guess at the direction.
Currents Through Resistors
KCL alone does not tell you the currents in resistors. You need Ohm's law to express each branch current in terms of node voltages. For a resistor R between node a and node b, the current from a toward b is:
I = (Va - Vb) / R = G * (Va - Vb)Here G = 1/R is the conductance in siemens (S). The current leaves node a and enters node b. When you write KCL at node a, this term appears with a plus sign. At node b, the same resistor's leaving current is G * (Vb - Va).
The next chapters build on this step, so check it with a small case. Two 2 Ω resistors connect node 1 to ground and node 1 to node 2. Their leaving currents at node 1 are 0.5 * V1 and 0.5 * (V1 - V2).
Checking KCL Numerically
You can verify a set of branch currents with a few lines of code. This script tests whether currents leaving a node sum to zero.
def kcl_residual(leaving_currents):
"""Return the sum of currents leaving a node (should be ~0)."""
return sum(leaving_currents)
# Node with a 5 A source entering (-5), plus branches of 3 A and 2 A leaving
currents = [-5.0, 3.0, 2.0]
residual = kcl_residual(currents)
print(residual) # 0.0
print(abs(residual) < 1e-9) # TrueUse a small tolerance rather than an exact comparison when the currents come from floating-point calculations.
Common Errors
- Mixed sign conventions. Writing some currents as entering and others as leaving within the same equation is the most frequent mistake. Pick "leaving" and keep it.
- Forgetting a branch. Count every element touching the node, including current sources.
- Treating a wire as one node only once. Points joined by an ideal wire are the same node. Do not write separate equations for them.
- Applying KCL to a voltage source branch as if its current were known. A voltage source fixes voltage, not current. Its current is an unknown unless something else determines it.
Exercise
A node has four branches. A 4 A source pushes current into the node. Branch 1 carries 1 A away from the node, and branch 2 carries 2 A away. Branch 3 has a current I3 that you define as leaving the node. What is I3?
Show answer
With currents leaving as positive, the source counts as -4. KCL gives -4 + 1 + 2 + I3 = 0, so I3 = 1 A, flowing away from the node.
Exercise
Write the KCL equation at node 1 for a 1 A source entering node 1, a 5 Ω resistor from node 1 to ground, and a 10 Ω resistor from node 1 to node 2. Use conductances and currents leaving the node.
Show answer
-1 + (1/5) V1 + (1/10) (V1 - V2) = 0. Collecting terms gives 0.3 V1 - 0.1 V2 = 1.