Sub topic 7
Writing branch currents with Ohm's law
This chapter assumes you can read a schematic, apply Ohm's law to a single resistor, and solve a small linear system. It also assumes you know what a node is and how to pick a current reference direction. Here you will turn a resistor's two end voltages into the current through it, in a form that plugs directly into a KCL equation.
Why this step matters
KCL talks about currents. Most circuit problems give you resistances and source values, and the unknowns are voltages. Ohm's law connects the two. If you can write every branch current in terms of node voltages, each KCL equation becomes an equation with node voltages as the only unknowns. The next chapter builds on that.
The skill is mechanical, but most sign errors in nodal work start here. Treat it carefully.
Ohm's law across a branch
For a resistor, Ohm's law says that the voltage across it equals the current through it times its resistance:
$$v = iR$$
This statement is incomplete until you say which end is positive and which way the current points. For a resistor, the two have to be paired. The current reference arrow must point into the terminal you call positive, and out of the other. Then $v = iR$ holds with no minus sign.
Now suppose a resistor $R$ connects node $a$ to node $b$. Node voltages are measured against a common reference (ground). The voltage across the resistor is the difference of the two node voltages. If the current reference points from $a$ to $b$, then $a$ is the positive end, and:
$$i{a \to b} = \frac{va - v_b}{R}$$
Read it as "current flows from the higher voltage toward the lower voltage." If $va > vb$, the result is positive and the current really flows from $a$ to $b$. If $va < vb$, the result is negative, and the real current flows from $b$ to $a$. The formula stays correct either way.
Currents leaving a node
When you write KCL at a node, the cleanest habit is to define every branch current as leaving that node. Then KCL reads: the sum of all currents leaving the node equals zero (or equals the source current entering it).
For node $k$ with a resistor $R_{kj}$ to each neighbor $j$, the current leaving through that resistor is:
$$i{k \to j} = \frac{vk - vj}{R{kj}}$$
The node you are writing the equation for always comes first in the subtraction. If a resistor goes to ground, $vj = 0$, so the term is just $vk / R$.
The same rule applies at every node, so the equations all look alike. That uniformity is what makes the method easy to automate.
A worked example
Take the circuit from the Topic Spine. A 10 mA current source pushes current into node 1. $R1 = 1\ \text{k}\Omega$ connects node 1 to ground. $R2 = 2\ \text{k}\Omega$ connects node 1 to node 2. $R_3 = 2\ \text{k}\Omega$ connects node 2 to ground.
Choose reference directions first. Let $i1$ leave node 1 through $R1$ to ground. Let $i2$ leave node 1 through $R2$ toward node 2. Let $i3$ leave node 2 through $R3$ to ground. Then Ohm's law gives:
- $i1 = \dfrac{v1 - 0}{R1} = \dfrac{v1}{1000}$
- $i2 = \dfrac{v1 - v2}{R2} = \dfrac{v1 - v2}{2000}$
- $i3 = \dfrac{v2 - 0}{R3} = \dfrac{v2}{2000}$
Each current is now an expression in the node voltages. KCL at node 1 says the 10 mA entering must equal the currents leaving:
$$0.010 = \frac{v1}{1000} + \frac{v1 - v_2}{2000}$$
KCL at node 2 says the current arriving through $R2$ equals the current leaving through $R3$:
$$\frac{v1 - v2}{2000} = \frac{v_2}{2000}$$
The second equation gives $v1 - v2 = v2$, so $v1 = 2 v2$. Substitute into the first equation: $0.010 = 2v2/1000 + v2/2000 = 2.5 v2/1000$, so $v2 = 4\ \text{V}$ and $v1 = 8\ \text{V}$. The branch currents are:
| Branch | Expression | Value |
|---|---|---|
| $i_1$ (node 1 to ground) | $8 / 1000$ | 8 mA |
| $i_2$ (node 1 to node 2) | $(8 - 4) / 2000$ | 2 mA |
| $i_3$ (node 2 to ground) | $4 / 2000$ | 2 mA |
All three values are positive, so each current really flows in its reference direction. At node 1, $8 + 2 = 10$ mA leaves, matching the source. At node 2, 2 mA arrives and 2 mA leaves.
The same calculation in code
A small helper makes the "leaving" rule explicit. The function takes the voltage at the node you are writing the equation for first.
def leaving_current(v_node, v_other, resistance):
"""Current leaving a node through a resistor, in amperes.
v_node: voltage at the node whose KCL equation you are writing (volts)
v_other: voltage at the far end of the resistor (volts)
resistance: resistance in ohms
"""
return (v_node - v_other) / resistance
R1, R2, R3 = 1000.0, 2000.0, 2000.0
v1, v2, ground = 8.0, 4.0, 0.0
i1 = leaving_current(v1, ground, R1) # node 1 to ground
i2 = leaving_current(v1, v2, R2) # node 1 to node 2
i3 = leaving_current(v2, ground, R3) # node 2 to ground
print(i1, i2, i3) # 0.008 0.002 0.002 (amperes)
print(i1 + i2) # 0.01: matches the 10 mA source at node 1
print(i2 - i3) # 0.0: current in minus current out at node 2
# The same resistor seen from the other end gives the opposite sign:
print(leaving_current(v2, v1, R2)) # -0.002The last line shows the point of the sign rule. The 2 mA through $R_2$ is $+2$ mA leaving node 1 and $-2$ mA leaving node 2. A current leaving one end of a resistor is a current entering the other end.
Conductance form
Writing $1/R$ repeatedly gets clumsy. Conductance is $G = 1/R$, measured in siemens (S). Ohm's law becomes:
$$i{k \to j} = G{kj}(vk - vj)$$
A KCL equation at node $k$ then collects terms as a sum of conductances times voltage differences. You can expand it into one coefficient for $vk$ (the sum of conductances touching the node) and one coefficient for each neighbor voltage (minus that branch's conductance). This is where the matrix form $G\mathbf{v} = \mathbf{I}$ in the Topic Spine's second code example comes from. For the circuit above, node 1's row is $(1/R1 + 1/R2)\,v1 - (1/R2)\,v2$.
Common errors
These are the mistakes that appear most often when students first write branch currents.
- Using one node voltage instead of a difference. The current through $R2$ depends on $v1 - v2$, not on $v1$ alone. A resistor to ground is the only case where the other term vanishes.
- Flipping the subtraction between nodes. If you define all currents as leaving the node you are working on, the node's own voltage always comes first. Mixing "leaving" and "entering" definitions inside one equation is how signs go wrong.
- Treating a negative answer as a mistake. A negative current means the real flow is opposite to your reference arrow. The value is valid.
- Mixing units. Kilohms with volts give milliamperes. Ohms with volts give amperes. Convert before you combine terms, or write everything in ohms and amperes.
- Applying the formula to a source. $i = \Delta v / R$ holds for resistors. A current source has a fixed current regardless of voltage, and an ideal voltage source has a fixed voltage regardless of current. Those branches need their own treatment, covered in the supernode and dependent source chapters.
Choosing reference directions in practice
You are free to pick any direction for each branch current. Two habits keep the algebra tidy.
- For nodal equations, orient each current away from the node whose equation you are writing. A branch between two nodes then appears with opposite signs in the two equations, which is correct.
- When you only need one branch current, choose the arrow along the direction you expect the current to flow. A positive answer then confirms your expectation.
A wrong guess costs nothing. The sign of the final number tells you the true direction.
Exercise
A 4 kΩ resistor connects node a (at 10 V) to node b (at 2 V). Find the current from a to b, then the current leaving node b through this resistor.
Show answer
Current from a to b: (10 − 2) / 4000 = 2 mA, positive, so it flows from a to b. The current leaving node b through the same resistor is (2 − 10) / 4000 = −2 mA. The negative sign means 2 mA is actually entering node b through this resistor.
Exercise
Node 1 is at 5 V. It connects through 2 kΩ to a node at 1 V, through 1 kΩ to a node at 3 V, and through 5 kΩ to ground. A current source also feeds node 1, and there are no other branches. Write the current leaving node 1 through each resistor, then find the source current needed to satisfy KCL.
Show answer
Through 2 kΩ: (5 − 1) / 2000 = 2 mA. Through 1 kΩ: (5 − 3) / 1000 = 2 mA. Through 5 kΩ: (5 − 0) / 5000 = 1 mA. The currents leaving total 5 mA, so the source must push 5 mA into node 1.
Exercise
In the worked example, suppose R3 is changed to 1 kΩ while v1 stays 8 V and v2 stays 4 V. What is the new value of i3, and does KCL still hold at node 2 with the old i2?
Show answer
i3 = 4 / 1000 = 4 mA. The old i2 is still 2 mA, so 2 mA arrives at node 2 and 4 mA would leave. KCL fails, which shows that v1 and v2 can no longer both stay at those values. Changing a resistor changes the node voltages, and the equations must be solved again.