Kirchhoff's Circuit Laws

2023-12-06, RB

Wikipedia (en)

Kirchhoff's Circuit Laws consist of two rules:

  1. Junction Rule (Current)
  2. Loop Rule (Voltage)

Literature

Kirchhoffs' Current Law (Junction Rule)

It is based on the conservation of charge.

$\sum_1^n I_k = 0 $

The sum of currents into a junction is equal to the sum of currents out of that junction.

Equivalent expression: The sum of all currents of a junction is zero, if you grade currents into the junction positive and those out of that junction negative.

Kirchhoff'S Voltage Law (Loop Rule)

It is based on the conservation of energy.

$\sum_1^n V_k = 0 $

The sum of the voltages around any closed loop in a circuit is equal to zero.

Conventions

General

Voltage

When summing voltages:

Example 1: YouTube Channel NunezPhysics

I did not find out yet, who the teacher behind NunezPhysics is! I could not ask for permission.

The following video tutorials discuss an example and describes very clearly how to derive the linear equation system from Kirchhoff's laws applied to an electrical circuit.

kirchhoff.jpg
Fig.: Kirchhoff's laws examples from the
NunezPhysics video tutorials above.

To solve the above problem we need three independent equations for three unknowns $I_1$, $I_2$, and $I_3$.

The resulting equation system of three equations in matrix form (i-th equation in i-th row):

$\begin{pmatrix} -1 & -1 & 1 \\ -6 & 3 & 0 \\ 0 & -3& -6 \end{pmatrix}\begin{pmatrix} I_1 \\ I_2 \\ I_3 \end{pmatrix} = \begin{pmatrix} 0 \\ -24 \\ -12 \end{pmatrix} $

WITH PROPER UNITS!

To solve the above problem we need three independent equations for three unknowns $I_1$, $I_2$, and $I_3$.

The resulting equation system of three equations in matrix form (i-th equation in i-th row):

$\begin{pmatrix} -1 & -1 & 1 \\ -6 & 3 & 0 \\ 0 & -3& -6 \end{pmatrix}\Omega\begin{pmatrix} I_1 \\ I_2 \\ I_3 \end{pmatrix}A = \begin{pmatrix} 0 \\ -24 \\ -12 \end{pmatrix}V $

Devide by $\Omega A$ (=$V$)$:

$\begin{pmatrix} -1 & -1 & 1 \\ -6 & 3 & 0 \\ 0 & -3& -6 \end{pmatrix}\begin{pmatrix} I_1 \\ I_2 \\ I_3 \end{pmatrix} = \begin{pmatrix} 0 \\ -24 \\ -12 \end{pmatrix} $

Solution in Matlab / Octave

This code block shows the solution of the LES in Matlab/Octave. Klick on the block title to download.

kirchhoff_exercise_01.m
# kirchhoff_exercise_01.m
# This script solves a simple LES resulting from Kirchhoff's laws.
# Example from NunezPhysics video tutorial: https://www.youtube.com/watch?v=zdE7xsbuNTg
# R. Becker, 2015-04-12 
 
# A*x = b <=> x = A^-1 * b (another notation x = A\b)
 
A = [-1 -1 1 ; -6 3 0 ; 0 -3 -6]
 
b = [0 -24 -12]' # ' means "transpose". Here result is column vector
 
x = A\b
 
# alternative: 
# x = A^-1 * b
# or 
# x = inv(A) * b

Solution in Python

This code block shows the solution of the LES in Python (numpy). Klick on the block title to download.

kirchhoff_exercise_01.py
# kirchhoff_exercise_01.py
# This script solves a simple LES resulting from Kirchhoff's laws.
# Example from NunezPhysics video tutorial: https://www.youtube.com/watch?v=zdE7xsbuNTg
# R. Becker, 2021-10-23 
 
import numpy as np
 
# A matrix is an array of rows, which are arrays. Thus a matrix is a two dimensional array.
# The numpy.array() function is used to create 2D array (aka matrix) from a list of row lists.
R = np.array(
    [
        [-1.0, -1.0,  1.0],
        [-6.0,  3.0,  0.0],
        [ 0.0, -3.0, -6.0]
    ])
 
V = np.array([0.0, -24.0, -12.0])
 
# Inverse matrix
Rinv = np.linalg.inv(R)
 
# Matrix vector multiplication, aka dot product
I = Rinv.dot(V)
 
# Print currents
print(I)

Example 2: YouTube Channel Jesse Mason

Excellent explanation of Kirchhoff's Laws by Jesse Mason.

Example 3: Wikipedia