Skip to content
Tutorials Center
My learning

Topics

Lesson 21 of 38 · DC Circuits

Kirchhoff's Laws

Use Kirchhoff's junction rule and loop rule to analyze circuits that cannot be reduced by series and parallel rules, with a full worked two-loop example.

Series and parallel rules are powerful, but some circuits refuse to reduce. Picture two batteries feeding the same resistor from different branches: there is no single "equivalent resistance" to find. For these, physicists use two general rules, named after the German physicist Gustav Kirchhoff, who stated them in 1845. They are nothing more than conservation of charge and conservation of energy applied to circuits.

In this lesson you will learn both rules, a reliable sign convention, and a step-by-step method that turns any DC circuit into a set of simultaneous equations. Then you will let Python solve them.

The junction rule: charge is conserved

A junction (or node) is a point where three or more wires meet. Charge cannot pile up at a junction in steady state, so the current that flows in equals the current that flows out:

Text
Σ I_in = Σ I_out

If 5.0 A arrives at a junction and a branch takes 2.0 A away, the other branch must carry 3.0 A. You have already used this rule when you added the currents in parallel branches.

The loop rule: energy is conserved

Take any closed loop in a circuit. If you walk once around it and add up all the changes in electric potential, the total is zero:

Text
Σ ΔV = 0  (around any closed loop)

This works because the electric force from static charges is conservative: when you return to your starting point you must be at the same potential you started from.

Sign convention

Pick a direction to walk around the loop (clockwise, say) and apply these rules:

What you cross Change in potential
A source from the minus to the plus side +ε
A source from the plus to the minus side -ε
A resistor in the direction of the assumed current -I R
A resistor against the direction of the assumed current +I R

Current flows through a resistor from high to low potential. So walking with the current you go downhill (a drop), and walking against it you go uphill.

You are allowed to guess the direction of each current. If your final answer comes out negative, the real current flows the opposite way. The mathematics corrects itself.

A method that always works

  1. Label every branch current with a name and a guessed direction.
  2. Write the junction rule for each independent junction. (A circuit with N junctions needs only N - 1 junction equations, since the last one is redundant.)
  3. Choose independent loops and write the loop rule for each. Every new loop should include a branch not yet used.
  4. You now have as many equations as unknown currents. Solve them.
  5. Check with a loop you did not use, or with power conservation.

Worked example: two batteries, three resistors

Battery 1 has ε₁ = 12 V and is in series with R₁ = 2.0 Ω. Battery 2 has ε₂ = 6.0 V and is in series with R₂ = 4.0 Ω. Both feed the shared resistor R₃ = 6.0 Ω. Call the currents leaving the batteries I₁ and I₂, and the current through R₃ is I₃.

flowchart TB
  T["top junction"] --> R3["R3 = 6 ohm, current I3"]
  B1["battery 1: 12 V, R1 = 2 ohm, current I1"] --> T
  B2["battery 2: 6 V, R2 = 4 ohm, current I2"] --> T
  R3 --> G["bottom junction"]
  G --> B1
  G --> B2

Two source branches meet at the top junction and share one load.

Junction rule (top junction): I₃ = I₁ + I₂.

Loop 1 (through battery 1 and R₃): 12 - 2 I₁ - 6 I₃ = 0.

Loop 2 (through battery 2 and R₃): 6 - 4 I₂ - 6 I₃ = 0.

Substitute I₃ = I₁ + I₂ into both loops:

Text
8 I₁ + 6 I₂ = 12
6 I₁ + 10 I₂ = 6

From the first, I₁ = 1.5 - 0.75 I₂. Put this in the second: 9 - 4.5 I₂ + 10 I₂ = 6, so 5.5 I₂ = -3 and I₂ = -6/11 ≈ -0.545 A. The negative sign says battery 2 actually has current going into it: the stronger battery is charging the weaker one. Then I₁ = 21/11 ≈ 1.91 A and I₃ = 15/11 ≈ 1.36 A.

Python Solve the two-loop circuit with numpy

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The two power numbers match. Battery 2's contribution ε₂ I₂ is negative, meaning it absorbs energy while it is being charged.

Building the equations by program

For bigger circuits, hand-algebra gets tedious. The matrix form A x = b scales to any size. Here is a small helper that solves any circuit once you give it the equations in this format. It is a general-purpose solver for linear equations, not a circuit simulator: you still do the physics of choosing the equations.

Python A tiny linear equation solver for circuits

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

This uses mesh currents, a variant where each loop gets its own circulating current. The shared resistors are written with the difference of the two neighboring mesh currents. It is the loop rule applied cleverly, and it saves you the junction equations.

Common mistakes

  • Mixing up signs when crossing a source. Always decide the walking direction first and stick to it for that loop.
  • Writing a loop equation that is a combination of two others (not independent). A fresh loop must include at least one branch the earlier loops did not.
  • Forgetting internal resistance of a battery, which acts as one more resistor in that branch.
  • Treating a negative answer as an error. It just means your guessed arrow was backward.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. At a junction, 3.0 A and 2.0 A flow in, and one wire carries 1.5 A out. What current flows out of the fourth wire?

    Current in is 5.0 A, so the total out must be 5.0 A. One wire takes 1.5 A, leaving 3.5 A for the other.
  2. 2. Kirchhoff's loop rule is a statement of which conservation law?

    The sum of potential changes around a closed loop is zero because electric potential energy per charge returns to its starting value.
  3. 3. You walk around a loop and cross a resistor in the same direction as your assumed current. What is the change in potential?

    Moving with the current means moving from high to low potential, a drop of I R.
  4. 4. Solving a circuit gives I₂ = -0.50 A for a branch. What does that mean?

    A negative result only means the guessed direction was wrong. The magnitude is still correct.

Summary

  • Junction rule: the currents into a node equal the currents out (conservation of charge).
  • Loop rule: potential changes around a closed loop add to zero (conservation of energy).
  • Choose current directions freely; negative answers mean the true direction is reversed.
  • With N unknown currents write N independent equations, then solve them by hand or with numpy.
  • Check the result by comparing power supplied with power dissipated.

Next: RC Circuits: Charging and Discharging