Engineering

Pesky Resistor Cube

Pesky Resistor Cube

Even my grandma knows the answer to this one when all the resistors are the same. But what if they are not?

The classic problem in engineering physics (it’s always the physicists with this kind of nonsense πŸ˜‚πŸ˜‚) goes something like this: What is the equivalent resistance across the body diagonal of a one-ohm resistor cube? This version is easy to solve because all the resistors have the same value, but recently I came across a version of the puzzle with a pesky resistor breaking the symmetry.

The Simplified Problem

Let’s first consider the case where all the resistors have the same value. A practical way to solve this is to take advantage of the cube’s symmetry to identify nodes at the same electrical potential. From there, it is usually possible to redraw the circuit flattened into 2D in some clever way that makes the solution obvious.

Consider the case where the probes are placed across the body diagonal of a cube (not across the diagonal of a face). Since all the resistors are identical, if we look at the “Probe+” node, we can assume that the current splits equally into three parts, one through each resistor connected to that node. This means all nodes labeled “i+” are at what fancy people call equipotential (equi means equal; the same).

Finally, note that if we flip the cube or swap the probes, nothing changes because everything is symmetric. That means we get the same pattern from the perspective of the opposite node, “Probe-”.

resistor-cube-equi

For now, we draw these subcircuits with the three resistors twice. At this point, the connection between the two subcircuits is still missing, but by looking at the cube again we notice that each resistor connected to an “i+” node links to two resistors connected to “i-”. This means there are six resistors connecting the two sides together.

Redrawing the schematic in this simplified form makes it obvious that we can apply a parallel simplification followed by a series simplification, resulting in the equivalent resistance of the path.

resistor-cube-diagonals-flattened

This practical approach is very nice, but it relies on having good intuition about how electrical networks work, and more importantly, the mesh needs to be symmetric.

A General Solution

When the circuit has what I call a “pesky” resistor breaking the symmetry, the approach needs to change. We need a general solution. To do that, we start by labeling all the nodes and resistors.

labeled resistor cube

Next, usingKirchhoff’s current law, which states that

βˆ‘i=1nIi=0 \sum_{i=1}^{n} I_i = 0

or, in words:

The algebraic sum of currents in a network of conductors meeting at a point is zero.

we can create the nodal equations.

Here, it is useful to model the currents flowing into each node because that way all the equations follow the same pattern:

Vnodeβˆ’VneighborRbetweenNodes \frac{V_{node} - V_{neighbor}}{R_{betweenNodes}}

As an example, for node A:

node equations

There is no need to worry too much about the signs; you just need to be consistent when putting the equations together. Once the system is solved, the signs will sort themselves out.

Rinse and repeat on all other nodes and we get:

{Vaβˆ’VeRae+Vaβˆ’VdRad+Vaβˆ’VbRab=0(A)Vbβˆ’VaRab+Vbβˆ’VfRbf+Vbβˆ’VcRbc=0(B)Vcβˆ’VbRcb+Vcβˆ’VgRcg+Vcβˆ’VdRcd=0(C)Vdβˆ’VaRad+Vdβˆ’VhRdh+Vdβˆ’VcRdc=0(D)Veβˆ’VfRef+Veβˆ’VaRae+Veβˆ’VhReh=0(E)Vfβˆ’VeRfe+Vfβˆ’VgRfg+Vfβˆ’VbRfb=0(F)Vgβˆ’VfRfg+Vgβˆ’VhRgh+Vgβˆ’VcRgc=0(G)Vhβˆ’VdRhd+Vhβˆ’VeRhe+Vhβˆ’VgRgh=0(H) \begin{dcases} \frac{V_{a}-V_{e}}{R_{ae}} + \frac{V_{a}-V_{d}}{R_{ad}} + \frac{V_{a}-V_{b}}{R_{ab}} = 0 \quad \text{(A)} \\[1em] \frac{V_{b}-V_{a}}{R_{ab}} + \frac{V_{b}-V_{f}}{R_{bf}} + \frac{V_{b}-V_{c}}{R_{bc}} = 0 \quad \text{(B)} \\[1em] \frac{V_{c}-V_{b}}{R_{cb}} + \frac{V_{c}-V_{g}}{R_{cg}} + \frac{V_{c}-V_{d}}{R_{cd}} = 0 \quad \text{(C)} \\[1em] \frac{V_{d}-V_{a}}{R_{ad}} + \frac{V_{d}-V_{h}}{R_{dh}} + \frac{V_{d}-V_{c}}{R_{dc}} = 0 \quad \text{(D)} \\[1em] \frac{V_{e}-V_{f}}{R_{ef}} + \frac{V_{e}-V_{a}}{R_{ae}} + \frac{V_{e}-V_{h}}{R_{eh}} = 0 \quad \text{(E)} \\[1em] \frac{V_{f}-V_{e}}{R_{fe}} + \frac{V_{f}-V_{g}}{R_{fg}} + \frac{V_{f}-V_{b}}{R_{fb}} = 0 \quad \text{(F)} \\[1em] \frac{V_{g}-V_{f}}{R_{fg}} + \frac{V_{g}-V_{h}}{R_{gh}} + \frac{V_{g}-V_{c}}{R_{gc}} = 0 \quad \text{(G)} \\[1em] \frac{V_{h}-V_{d}}{R_{hd}} + \frac{V_{h}-V_{e}}{R_{he}} + \frac{V_{h}-V_{g}}{R_{gh}} = 0 \quad \text{(H)} \\ \end{dcases}

With this set of equations, solving the cube for any combination of resistor values is no problem. For example, solving the opening puzzle of this post is as easy as:

#!/usr/bin/env python3

from numpy import array, linalg

R_ae = 0.75

resistor_network = array([
    [1/R_ae + 2, -1, 0, -1, -1/R_ae, 0, 0, 0],
    [-1, 3, -1, 0, 0, -1, 0, 0],
    [0, -1, 3, -1, 0, 0, -1, 0],
    [-1, 0, -1, 3, 0, 0, 0, -1],
    [-1/R_ae, 0, 0, 0, 1/R_ae + 2, -1, 0, -1],
    [0, -1, 0, 0, -1, 3, -1, 0],
    [0, 0, -1, 0, 0, -1, 3, -1],
    [0, 0, 0, -1, -1, 0, -1, 3],
    ])

currents = array([1, 0, 0, 0, 0, 0, -1, 0])

voltages = linalg.pinv(resistor_network) @ currents

R_equivalent = voltages[0] - voltages[6]
print(R_equivalent)

This code returns:

0.8023255813953489

Which is the equivalent resistance for this particular case.

One subtle detail: this system is singular. In Python, this is easy to handle by solving the system using the pseudoinverse method from the linalg package.

Going up a notch

Using NumPy or any other numerical solver gets the job done, but it is not that hard to come up with a more elegant solution.

Since we already went through the trouble of writing down all the equations, we can go up a notch and useMaxima to find a symbolic solution.

/* ------------------------------------------------
Maxima code to solve the pesky resistor cube puzzle 
   
Edi Liberato, eddie.liberatoe@gmail.com
created 20260601
------------------------------------------------ */

eq1 : (V_a - V_e) / R_ae + (V_a - V_d) / R + (V_a - V_b) / R;
eq2 : (V_b - V_a) / R + (V_b - V_f) / R + (V_b - V_c) / R;
eq3 : (V_c - V_b) / R + (V_c - V_g) / R + (V_c - V_d) / R;
eq4 : (V_d - V_a) / R + (V_d - V_h) / R + (V_d - V_c) / R;
eq5 : (V_e - V_f) / R + (V_e - V_a) / R_ae + (V_e - V_h) / R;
eq6 : (V_f - V_e) / R + (V_f - V_g) / R + (V_f - V_b) / R;
eq7 : (V_g - V_f) / R + (V_g - V_h) / R + (V_g - V_c) / R;
eq8 : (V_h - V_d) / R + (V_h - V_e) / R + (V_h - V_g) / R;

/* -----------------------------------------------------------------------------
In Maxima skiping the relevant nodal equations is mandatory to avoid singularity
In this example: V_a is the current source and V_g is the curren sink
----------------------------------------------------------------------------- */

sol : solve([eq2, eq3, eq4, eq5, eq6, eq8], [V_b, V_c, V_d, V_e, V_f, V_h]), V_a=1, V_g=0;

V_b : subst(first(sol), V_b);
V_d : subst(first(sol), V_d);
V_e : subst(first(sol), V_e);
V_a : 1;
I_ae : (V_a - V_e) / R_ae;
I_ad : (V_a - V_d) / R;
I_ab : (V_a - V_b) / R;
I_in : I_ae + I_ad + I_ab;
R_eq : 1/I_in;

print(ratsimp(R_eq));

vals : [R=1, R_ae=3/4];
final_sol : subst(vals, R_eq);

print(final_sol);

Running this gives us:

                2
11 R R_ae + 9 R
──────────────── 
10 R_ae + 14 R

69
── 
86

Since R=1 R = 1 , we can write the generic equation as:

Req=11Rae+910Rae+14Β Β Ξ© R_{eq} = \frac{11 R_{ae} + 9}{10 R_{ae} + 14} \ \ \Omega

This lets us evaluate the opening problem easily. When Rae=34Ξ© R_{ae} = \frac{3}{4} \Omega , the exact solution is 69/86Β Ξ© 69 / 86 \ \Omega .

Thomas the Engineer

That’s how engineer Thomas does it.