Two-Loop Mesh Current Calculator

Two-Loop Mesh Current Calculator (Kirchhoff)

Two loops with their own sources and a resistor in common, solved by Kirchhoff’s voltage law and Cramer’s rule — with the matrix, the determinant and both cofactors printed, the branch currents including the shared one, the power in every element, and a power-balance check on the answer.

Two-loop mesh solver

Two loops → mesh currents, branch currents, powers
Enter a negative number if the source opposes the clockwise direction. Nothing breaks either way; the sign of the answer tells you.
Both mesh currents are defined clockwise, so this convention makes the matrix symmetric — which is a useful check that you have set the problem up correctly.
The branch both loops run through. It carries the DIFFERENCE of the two mesh currents, which is the whole reason mesh analysis is worth learning.
Two loops sharing the middle branch. Both mesh currents circulate clockwise (the round arrows) and each battery is drawn driving its own loop that way. The dots on the outer paths move at I1 and I2; the dots in the shared branch move at their difference, and reverse when mesh 2 pushes harder than mesh 1.
2.077AExample

V1 = 12 V, V2 = 6 V, R1 = 4 Ω, R2 = 6 Ω, shared R3 = 8 Ω

Advertisement

Kirchhoff’s voltage law, as a 2 × 2 system

mesh 1:   (R1 + R3)·I1 − R3·I2 = V1
mesh 2:   −R3·I1 + (R2 + R3)·I2 = V2
Δ = (R1 + R3)(R2 + R3) − R3² = R1R2 + R1R3 + R2R3
I1 = (V1(R2 + R3) + V2R3) ÷ Δ,   I2 = (V1R3 + V2(R1 + R3)) ÷ Δ
shared branch:   I3 = I1 − I2
I 1, I 2
the mesh currents, both defined clockwise. They are bookkeeping quantities, not things you can measure directly
I 3
the real current in the shared branch, which IS measurable: the difference of the two mesh currents
Δ
the determinant of the coefficient matrix. Zero means the problem has no finite answer
Δ 1, Δ 2
the determinants with the first or second column replaced by the right-hand side — Cramer’s rule

Worked example

V1 = 12 V, V2 = 6 V, R1 = 4 Ω, R2 = 6 Ω, shared R3 = 8 Ω
Mesh 1: (4 + 8)I₁ − 8I₂ = 12;   mesh 2: −8I₁ + (6 + 8)I₂ = 6
Δ = 12 × 14 − 8² = 104
Δ₁ = 12 × 14 + 6 × 8 = 216, so I₁ = 216 ÷ 104 = 2.077 A
Δ₂ = 12 × 8 + 6 × 12 = 168, so I₂ = 1.615 A
The shared branch carries I₁ − I₂ = 461.5 mA, downwards
Powers: the sources supply 24.9231 W and 9.6923 W, a total of 34.62 W
The resistors dissipate 17.2544 W, 15.6568 W and 1.7041 W — 34.6154 W, which balances the supply exactly

The working for the example above

StepArithmeticCoefficient of I₁Coefficient of I₂Right-hand side
Mesh 1 equation(4 + 8)·I₁ − 8·I₂ = 1212−812
Mesh 2 equation−8·I₁ + (6 + 8)·I₂ = 6−8146
Determinant Δ12 × 14 − 8² = 104
Δ₁ (first column replaced)12 × 14 + 6 × 8 = 216
Δ₂ (second column replaced)12 × 8 + 6 × 12 = 168
I₁ = Δ₁ ÷ Δ216 ÷ 104 = 2.076923 A
I₂ = Δ₂ ÷ Δ168 ÷ 104 = 1.615385 A
Written out the way it is done on paper. The matrix is symmetric because both mesh currents are defined clockwise and the shared resistance appears with a minus sign in both off-diagonal positions; if yours comes out unsymmetric, a sign is wrong somewhere.

How mesh analysis works, and why the shared branch is the point

Kirchhoff’s voltage law says the voltages around any closed loop add to zero. Mesh analysis turns that into a system of equations by assigning a circulating current to each independent loop, rather than a current to each branch — which is fewer unknowns and, more usefully, unknowns that automatically satisfy Kirchhoff’s CURRENT law, because a circulating current enters and leaves every node it passes through. A two-loop circuit has two unknowns and a 2 × 2 matrix, which is small enough to solve by hand every time.

Setting it up. Draw both mesh currents clockwise — always, without thinking about which way the current “really” goes, because the sign of the answer will tell you. Then for each mesh: the coefficient on its own current is the sum of every resistance around that loop, and the coefficient on the other mesh’s current is minus the resistance they share. The right-hand side is the sum of the sources, positive when they drive that mesh clockwise. Two things follow that are worth using as checks: the matrix is symmetric, and the diagonal terms are always at least as large as the off-diagonal ones. If either fails, you have a sign error.

The shared branch. The mesh currents are bookkeeping; you cannot put a meter on I₁. The branch currents are what exist, and in the two-loop circuit every branch carries one mesh current except the shared one, which carries the difference I₁ − I₂. That is the whole reason for the method, and it is also where a reader meets a negative current for the first time: if mesh 2 pushes harder than mesh 1, the shared branch runs backwards against the arrow and the arithmetic reports it as a minus sign, without anything having gone wrong.

Cramer’s rule, and the determinant. For a 2 × 2 system, I₁ = Δ₁ ÷ Δ and I₂ = Δ₂ ÷ Δ, where Δ is the determinant of the coefficient matrix and Δ₁, Δ₂ are the same determinant with one column replaced by the right-hand side. For this circuit Δ tidies to R1R2 + R1R3 + R2R3, which is non-negative for real resistors and zero only when at least two of the three are zero. That case is not a numerical accident: two zero resistances put an ideal voltage source directly across a perfect conductor, and the honest answer is that the model has no solution rather than that the current is very large. This page refuses there and says why. Put in the wire resistance, the source’s own resistance or the contact resistance that is really present — any of them — and the equations solve.

Checking the answer. Add up the power the sources deliver and the power the resistors dissipate; they must be equal, and the page prints both plus the error between them. A source can come out negative, which means it is absorbing power — a battery being charged, or a supply being back-driven — and that is a legitimate answer, not a failure. Once the currents are known, Thévenin’s theorem turns any part of the network into an equivalent for the next stage, and the delta-wye transformation handles the three-terminal networks that mesh analysis alone will not simplify. For more than two loops the same method scales, but the arithmetic stops being something to do on paper.

Advertisement

Frequently asked questions

What is the mesh current method?

Assign a circulating current to each independent loop, write Kirchhoff’s voltage law around each loop, and solve. The unknowns are loop currents rather than branch currents, which is fewer equations and automatically satisfies Kirchhoff’s current law at every node.

How do I write the mesh equations for two loops?

(R1 + R3)I₁ − R3·I₂ = V1 and −R3·I₁ + (R2 + R3)I₂ = V2, with both mesh currents clockwise and R3 the shared branch. The diagonal is the total resistance round each loop; the off-diagonal is minus the shared resistance, in both corners.

What current actually flows in the shared branch?

The difference of the two mesh currents, I₁ − I₂. Every other branch carries a single mesh current. If the difference comes out negative, the current simply flows the other way.

What does it mean when the determinant is zero?

That the circuit as described has no finite solution. Here Δ = R1R2 + R1R3 + R2R3, so it vanishes only when at least two resistances are zero — an ideal voltage source across a perfect conductor. Real circuits always have some resistance; adding it makes the system solvable.

Why is my mesh current negative?

Because the real current runs anticlockwise. The convention is to draw every mesh current clockwise and let the algebra sort out the direction, so a minus sign is information rather than an error.

Should I use mesh analysis or node analysis?

Count the unknowns. Mesh analysis needs one equation per independent loop; node analysis needs one per node other than the reference. Whichever is smaller wins. Circuits full of voltage sources usually favour mesh; circuits full of current sources and parallel branches usually favour nodes.

Related calculators

References

  1. Nilsson JW, Riedel SA. Electric Circuits, 11th ed. Pearson, 2019. §4.5 “Introduction to the Mesh-Current Method”, §4.7 “The Mesh-Current Method: Some Special Cases” and §4.8 “The Node-Voltage Method Versus the Mesh-Current Method”. Section titles confirmed against Pearson’s own published front matter for the eleventh edition.
  2. Kirchhoff G. Ueber den Durchgang eines elektrischen Stromes durch eine Ebene, insbesondere durch eine kreisförmige. Annalen der Physik und Chemie, vol. 140, no. 4, pp. 497–514, 1845. The original statement of the current and voltage laws.
  3. Horowitz P, Hill W. The Art of Electronics, 3rd ed. Cambridge University Press, 2015. Chapter 1: Kirchhoff’s laws, and the observation that most real circuits are solved by inspection and Thévenin rather than by writing the full system.