#
2.15

Solving Circuit Systems

In the previous sections building up to Kirchhoff’s Voltage Law and Kirchhoff’s Current Law we examined how to turn the structure of a circuit network into a number of equations. In this section, we’ll finally combine the *structure of the network* with the *individual component behavior* to fully setup and solve the system of equations describing a circuit.

## Component Constituent Equations

The KCL and KVL equations tell us how various currents and voltage relate to each other throughout the circuit, but they do **not** tell us anything about the behavior of each component itself.

For that, we need the equation for each component that describes the voltage-current relationship for that particular component.

In general, these can be just about anything: for example, they can be nonlinear equations (as we’ll see for example in diodes), they can have in them (as we’ll see for example in capacitors and inductors), they can even reference other variables elsewhere in the circuit (as we’ll see for example in controlled sources, used in modeling transistors).

However, so far we’ve only looked at three types of simple, linear elements: ideal voltage sources, ideal current sources, and ideal resistors. All three of these have very simple constitutent equations:

These are all simple linear relationships created by each type of element. The ideal voltage source is setting a particular voltage difference equal to a constant. The ideal current source is setting a branch current equal to a constant. And the resistor is a simple line through the origin.

Each two-terminal component generates a single equation. Next, we’ll combine these component constituent equations with the structural equations to solve a full circuit.

## Solving Circuits

Here is a general process that applies to any network that follows the Lumped Element Model. This process is closely related to Modified Nodal Analysis, which merges a few algebraic reduction steps into the setup process at the cost of added complexity to understand. It is essential to practice and remember this general process:

**Label Node Voltages.**Choose a ground node. Label all non-ground voltages. (For nodes we’ll have labeled voltages.)**Label Branch Currents.**Indicate flow direction with an arrow. Where two or more components are strictly in series, use a single branch current variable. (For review on steps 1 and 2, see Labeling Voltages, Currents, and Nodes.)**Write Kirchhoff’s Current Law Equations.**For each (non-ground) node, write the KCL equation from branch currents. When only two components meet at a given node and you’ve labeled only a single branch current variable for the connected components, you may simply omit this KCL equation because you’ve already included it when considering the two paths to have the same branch current. (For review, including a discussion of why we don’t write the KCL equation at the ground node, see Kirchhoff’s Voltage Law (KVL) and Kirchhoff’s Current Law (KCL).)**Write Component Constituent Equations.**For each (two-terminal) component, write the component-specific constituent equation for that component, which relates its voltage difference (expressed as a difference of the corresponding nodal voltages) and its branch current. Be careful to keep track of signs. Note that this step implicitly uses KVL’s definition of voltage difference. (For review, see Ideal Sources and Resistance and Ohm’s Law.)**Setup the System of Equations.**Combine the unknown variables from steps 1 and 2 with the equations from steps 3 and 4. If you’ve done the steps properly, you should have the same number of unknowns as equations.**Solve the System of Equations.**Find the resulting branch currents and node voltages. Use these to answer your questions of interest. (For review: apply the techniques from the Systems of Equations section to solve the simultaneous equations.)

As we’ll discuss in greater detail in future chapters, nonlinear elements are included either by solving them algebraically where possible, or via Newton’s Method of iterated relinearization as demonstrated in Linear & Nonlinear.

Note that 3+-terminal components are generally included in this formulation by modeling them as a collection of two-terminal elements. In doing so, these higher-order components may each generate several equations in step 4, and may also have multiple internal branch currents in step 2, as well as internal nodes in step 1!

## A Simple Example

First, let’s walk through all six steps on a very simple circuit with just three components in a single series loop:

Exercise Click to open and simulate the circuit above.

**Step 1** is already done by labeling nodes X and Y as shown, as well as indicating the third node as a ground. This gives us two variables:
and
.

**Step 2** is already done by labeling current
along with a directional arrow. As there’s only one branch current, there’s only one current variable:
.

**Step 3** is trivial for this circuit. At node X, only two devices connect, and the two current flows are labeled with the same branch current variable. This means we can omit the KCL equation. The same goes for node Y, so zero equations are generated by step 3.

**Step 4** is what we’ll practice in more detail now by going through each component and writing its constitutent equation in terms of the variables we’ve already defined in steps 1 and 2.

*For the voltage source V1:* we have a relationship for the voltage difference at its two terminals. To use the component terminal notation we introduced in the Labeling Voltages, Currents, and Nodes section:

In this case, the terminal V1.nA is connected to node X, and the terminal V1.nB is connected to a ground node:

By definition, , so we have:

or in the node subscript notation we used in step 1:

This is our first equation for step 4.

*For the resistor R1:* regardless of which terminal we choose to call terminals “nA” and “nB” of the resistor, the same relationship applies:

where I(R1.nA) is defined as the current *into* the nA terminal.

Resistor R1 is connected between nodes X and Y. We can choose either orientation, but let’s suppose that we pick node X as R1.nA, and node Y as R1.nB. In this case, our equation becomes:

We now have to define I(R1.nA) in terms of the branch current . As the arrow of branch current flow is flowing into R1 from node X, we simply have , so:

or in the node subscript notation we used in step 1:

This is our second equation for step 4.

*For the resistor R2:* again, the same relationship applies:

Let’s choose node Y as R2.nA, and the ground node as R2.nB (so ). As the branch current flows into R2.nA, we have , so:

or in the node subscript notation we used in step 1:

This is our third and final equation for step 4.

**Step 5** involves simply gathering and writing out all the equations from steps 3 and 4:

This is a fairly simple system of equations to solve directly, but in general, we might want to rearrange them so all variable terms are on the left-hand side, and all constants on the right:

Equivalently as a (unitless) matrix equation:

We could equivalently write this matrix equation even more compactly as an augmented matrix as described in the Systems of Equations section:

**Step 6** is to solve this system of simultaneous equations now that we’ve set it up. We’ll follow the process outlined in the Systems of Equations section for solving by hand.

First, we’ll see the first equation sets . We can use that to create a smaller augmented matrix:

Now we can observe that the second row sets , from which we can decide to replace the variable in the remaining equation by :

From this we find that , or 60 mA.

Finally, we can expand our earlier simplification for , or 6 volts.

We’ve now successfully solved for all our unknowns:

As discussed in Labeling Voltages, Currents, and Nodes, we can now use these three answers to find the answers to a much larger space of possible voltage difference and terminal current questions we may wish to ask about the circuit.

You can confirm these values by using the CircuitLab simulation software. To do so, simply click the schematic above to open it in a new browser tab, then click “Simulate,” click “Run DC Solver,” and read off the values listed.

## A Closer Look at Resistors

While a voltage source or current source has a defined orientation or direction, a resistor can have its two terminals swapped with no change in behavior in the surrounding circuit. (Sometimes, this property is called “unpolarized.”) Regardless of orientation, we can arbitrarily call one of the resistor’s terminals “nA” and the other “nB”. Now, whichever way we choose those, the same equation holds:

where
is the current *into* terminal A. In the more verbose style as used within the CircuitLab simulation software:

This equation says that the voltage difference between the two terminals of the resistor R1 (specifically the voltage at the nA terminal with respect to the nB terminal) is equal to the current into terminal R1.nA multiplied by the resistance R1.R. For resistors, this equation is true regardless of which way we label the two terminals.

Let’s review the simple example circuit above:

For this part, let’s take a closer look only at just resistor R1, which is connected between nodes X and Y. Let’s cut it out of the circuit and show the node labels X and Y, as well as the component terminals:

We’ve drawn two copies of R1, called R1_alpha and R1_beta. Note that the “beta” copy has the resistor rotated (or flipped) around, so that the designated nA and nB terminals are in opposite positions. Regardless, in both copies, the node names X and Y are unchanged, and the branch current is unchanged.

*In the alpha copy:*

*In the beta copy:* we’ve now switched the mapping between terminals and nodes. Additionally, now the branch current direction of
is in the opposite direction relative to our newly selected terminal A because if we follow the direction of the branch current arrow we find that it flows *out of* R1.nA. We’ve marked the three changes resulting from flipping the terminals of the resistor in red:

*With respect to the node voltages and branch currents:* the resulting equations in both cases are completely identical! Multiply the final beta-case equation by -1 to get the alpha-case equation:

Note that this reversability is only the case for unpolarized components such as resistors. In future sections we will see that inductors and (unpolarized) capacitors also have this property. Because it’s possible to define the resistor’s direction in two ways, this is a common source of confusion when setting up resistive circuits to solve.

With respect to resistors in particular, it may help to remember that their instantaneous power dissipation is always positive. Resistors can only consume power from the circuit and subsequently heat up due to current flow; they can’t turn thermal energy back into electrical energy. (See also: Thermodynamics, Energy & Equilibrium.)

## A Larger Example

Let’s walk through all six steps with a more complicated example circuit:

Exercise Click to open and simulate the circuit above.

**Step 1** is already done by labeling four non-ground nodes W, X, Y, Z as shown; the fifth node is marked as ground. This gives us four variables:
.

**Step 2** is already done by labeling five branch current variables
along with directional arrows for each.

**Step 3** is to write Kirchhoff’s Current Law at each non-ground node. For node W, no equation is necessary, because we have only the single branch current
flowing in and out of that node. A similar argument goes for node Y and branch current
. For nodes X and Z:

**Step 4** is to write the constitutent equation for each of the 7 components as a function of the node voltage and branch current variables we’ve defined in steps 1 and 2.

*For voltage source V1:*

The positive terminal is connected to node X, and the negative to ground, so:

*For resistor R1:*

*For voltage source V2:*

*For resistor R2:*

*For resistor R3:*

*For resistor R4:*

*For current source I1:*

**Step 5** is to gather all the equations from steps 3 and 4:

This is a system of 9 equations and 9 unknowns. While it may appear daunting, notice that each individual equation is quite simple. We’ll be able to take advantage of this to solve the system fairly quickly. First, let’s represent the system with all variables on one side:

Then as a matrix equation:

And as an augmented matrix:

While this is a fairly large system to approach by hand, notice that most cells of the matrix are 0. This is known as a “sparse” matrix. The process of solving a sparse matrix is considerably faster than solving a dense matrix of the same size.

**Step 6** is to solve the system of equations. Again, we’ll follow the process outlined in the Systems of Equations section for solving by hand. In practice, with some experience solving circuits you will not have to write out the entire system, but instead may be able to solve parts in place as you go by applying parts of the same process in your head without as much written bookkeeping. For this example, though, we’ll work through writing our work at every step.

First, we’ll notice that the 3rd and 9th rows have simply one variable equal to a constant: and . We can remove these two equations and these two variables from the system by substituting their values everywhere else they’re referenced:

In this 7x7 system, the final equation says , which is easy to eliminate as the variable is not referenced anywhere else in the system.

In the 6x6 system, the final two lines have two variables and zero constant term, so they say simply and . Out of these three variables, we can choose to keep any one and eliminate the other two. Let’s keep and replace and :

These substitutions modified the 2nd remaining equation, leaving us again with an easily reducible , or . We can remove everywhere and replace it with :

We’re now down to a 3x3 system, but have no easy substitutions left. Now we can use row operations to perform Gaussian elimination. Add the second row to the third row, and store the result in place of the 3rd row ( ):

At this point, we have an upper triangular matrix, so the system is easily solved from the bottom row up: , or . Next, , or . And finally, , or .

From here, we can expand the proportional substitutions we made earlier:

We now have solved all nine variables:

You can confirm that this solution is correct by clicking the schematic above, then clicking “Simulate,” and “Run DC Solver” to print the voltage and current values as shown. You can also substitute into any of the equations we wrote earlier to double-check that these satisfy all constraints.

With practice and experience, you will be able to make many of the simplifications we described mathematically as you’re working with the schematic, saving you the trouble of setting up the entire system of equations.

(In fact, other circuit analysis methods with fancy-sounding names like “Modified Nodal Analysis” are mathematically identical to the six-step method presented here, and essentially just do some of these simplifications at the same time as setting up the equations.)

An experienced electrical engineer would be able to look at the schematic and instantly label, for example, – because the first two variables we solved ( and ) are so obvious that they wouldn’t be worth labeling! They would then start to look at R1, V2, R2, and R3 as if they were a branch composed of a single voltage source and a single equivalent resistance , and use that to solve for the total current . All in all, the experienced engineer would effectively follow the same mathematical procedure done here but with more “intuition” about what to solve for next. However, it’s powerful to remember that any circuit can always be solved using the technique presented here.

## What’s Next

In the next section, Superposition, we’ll look at one special method of solving circuits with multiple sources.

**Ultimate Electronics: Practical Circuit Design and Analysis.**CircuitLab, Inc., 2019, ultimateelectronicsbook.com. Accessed . (Copyright © 2019 CircuitLab, Inc.)