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.
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 $\frac{d}{dt}$ 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:
$$ \begin{align} v_7 & = 5 \ \text{Volts} &&\text{Ideal Voltage Source}\\ i_8 & = 1 \ \text{Ampere} &&\text{Ideal Current Source}\\ v_9 & = (200 \ \text{Ohms})*i_9 &&\text{Resistor} \end{align} $$
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.
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:
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!
First, let's walk through all six steps on a very simple circuit with just three components in a single series loop:
Interactive 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: $V_X$ and $V_Y$.
Step 2 is already done by labeling current $i_1$ along with a directional arrow. As there's only one branch current, there's only one current variable: $i_1$.
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:
$$\text{V(V1.nA)} - \text{V(V1.nB)} = 12$$
In this case, the terminal V1.nA is connected to node X, and the terminal V1.nB is connected to a ground node:
$$\text{V(X)} - \text{V(ground)} = 12$$
By definition, $\text{V(ground)} = 0$, so we have:
$$\text{V(X)} = 12$$
or in the node subscript notation we used in step 1:
$$V_X = 12$$
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:
$$\text{V(R1.nA)} - \text{V(R1.nB)} = (100 \ \Omega) \ \text{I(R1.nA)}$$
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:
$$\text{V(X)} - \text{V(Y)} = (100 \ \Omega) \ \text{I(R1.nA)}$$
We now have to define I(R1.nA) in terms of the branch current $i_1$. As the arrow of branch current flow is flowing into R1 from node X, we simply have $\text{I(R1.nA)} = i_1$, so:
$$\text{V(X)} - \text{V(Y)} = (100 \ \Omega) \ i_1$$
or in the node subscript notation we used in step 1:
$$V_X - V_Y = (100 \ \Omega) \ i_1$$
This is our second equation for step 4.
For the resistor R2: again, the same relationship applies:
$$\text{V(R2.nA)} - \text{V(R2.nB)} = (100 \ \Omega) \ \text{I(R2.nA)}$$
Let's choose node Y as R2.nA, and the ground node as R2.nB (so $\text{V(R2.nB)} = \text{V(ground)} = 0$). As the branch current $i_1$ flows into R2.nA, we have $\text{I(R2.nA)} = i_1$, so:
$$\text{V(Y)} = (100 \ \Omega) \ i_1$$
or in the node subscript notation we used in step 1:
$$V_Y = (100 \ \Omega) \ i_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:
$$ \begin{align} V_X & = 12 \\ V_X - V_Y & = (100 \ \Omega) \ i_1 \\ V_Y & = (100 \ \Omega) \ i_1 \end{align} $$
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:
$$ \begin{align} V_X & = 12 \\ V_X - V_Y - (100 \ \Omega) \ i_1 & = 0\\ V_Y - (100 \ \Omega) \ i_1 & = 0 \end{align} $$
Equivalently as a (unitless) matrix equation:
$$ \begin{equation} \begin{bmatrix} 1 & 0 & 0 \\ 1 & -1 & -100 \\ 0 & 1 & -100 \end{bmatrix} \begin{bmatrix} V_X \\ V_Y \\ i_1 \end{bmatrix} = \begin{bmatrix} 12 \\ 0 \\ 0 \end{bmatrix} \end{equation} $$
We could equivalently write this matrix equation even more compactly as an augmented matrix as described in the Systems of Equations section:
$$
\begin{equation}
\left[
\begin{array}{ccc|c}
1 & 0 & 0 & 12 \\
1 & -1 & -100 & 0 \\
0 & 1 & -100 & 0
\end{array}
\right]
\ \text{for} \ (V_X, V_Y, i_1)
\end{equation}
$$
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 $\boxed{V_X = 12}$. We can use that to create a smaller augmented matrix:
$$ \begin{equation} \left[ \begin{array}{cc|c} -1 & -100 & -12 \\ 1 & -100 & 0 \end{array} \right] \ \text{for} \ (V_Y, i_1) \end{equation} $$
Now we can observe that the second row sets $V_Y = 100 i_1$, from which we can decide to replace the variable $V_Y$ in the remaining equation by $100 i_1$:
$$ \begin{equation} \left[ \begin{array}{c|c} -200 & -12 \\ \end{array} \right] \ \text{for} \ (i_1) \end{equation} $$
From this we find that $\boxed{i_1 = \frac {-12} {-200} = 0.06}$, or 60 mA.
Finally, we can expand our earlier simplification for $\boxed{V_Y = 100 \cdot 0.06 = 6}$, or 6 volts.
We've now successfully solved for all our unknowns:
$$ \begin{equation} \begin{bmatrix} V_X \\ V_Y \\ i_1 \end{bmatrix} = \begin{bmatrix} 12 \\ 6 \\ 0.06 \end{bmatrix} \end{equation} $$
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.
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:
$$v_{A B} = i_A R$$
where $i_A$ is the current into terminal A. In the more verbose style as used within the CircuitLab simulation software:
$$\text{V(R1.nA)} - \text{V(R1.nB)} = \text{I(R1.nA)} \cdot \text{R1.R}$$
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 $i_1$ is unchanged.
In the alpha copy:
$$ \begin{align} \text{V(R1.nA)} - \text{V(R1.nB)} & = \text{I(R1.nA)} \cdot \text{R1.R} \\ \text{V(R1.nA)} & = \text{V(X)} \\ \text{V(R1.nB)} & = \text{V(Y)} \\ \text{I(R1.nA)} & = i_1 \\ \text{V(X)} - \text{V(Y)} & = i_1 \cdot \text{R1.R} \end{align} $$
In the beta copy: we've now switched the mapping between terminals and nodes. Additionally, now the branch current direction of $i_1$ 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:
$$ \begin{align} \text{V(R1.nA)} - \text{V(R1.nB)} & = \text{I(R1.nA)} \cdot \text{R1.R} \\ \text{V(R1.nA)} & = \text{V(} \color{red}{\text{Y}} \text{)} \\ \text{V(R1.nB)} & = \text{V(} \color{red}{\text{X}} \text{)} \\ \text{I(R1.nA)} & = \color{red}{-} i_1 \\ \text{V(} \color{red}{\text{Y}} \text{)} - \text{V(} \color{red}{\text{X}} \text{)} & = \color{red}{-} i_1 \cdot \text{R1.R} \end{align} $$
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:
$$ \begin{align} \color{green}{-1} \cdot \big( \text{V(} \color{red}{\text{Y}} \text{)} - \text{V(} \color{red}{\text{X}} \text{)} \big) & = \color{green}{-1} \cdot \big( \color{red}{-} i_1 \cdot \text{R1.R} \big) \\ - \text{V(} \color{red}{\text{Y}} \text{)} + \text{V(} \color{red}{\text{X}} \text{)} & = \color{green}{+} i_1 \cdot \text{R1.R} \\ \text{V(} \color{green}{\text{X}} \text{)} - \text{V(} \color{green}{\text{Y}} \text{)} & = \color{green}{+} i_1 \cdot \text{R1.R} \\ \end{align} $$
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.)
Let's walk through all six steps with a more complicated example circuit:
Interactive 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: $V_W, V_X, V_Y, V_Z$.
Step 2 is already done by labeling five branch current variables $i_1, i_2, i_3, i_4, i_5$ 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 $i_2$ flowing in and out of that node. A similar argument goes for node Y and branch current $i_3$. For nodes X and Z:
$$ \begin{align} i_1 + i_2 - i_3 & = 0 && \text{(node X)} \\ i_3 - i_4 - i_5 & = 0 && \text{(node Z)} \end{align} $$
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:
$$ \begin{align} \text{V(V1.nA)} - \text{V(V1.nB)} & = 48 \\ \text{V(X)} - \text{V(ground)} & = 48 \\ V_X - 0 & = 48 \\ V_X & = 48 \end{align} $$
For resistor R1:
$$ \begin{align} \text{V(R1.nA)} - \text{V(R1.nB)} & = 8 \ \text{I(R1.nA)} \\ \text{V(X)} - \text{V(Y)} & = 8 \ \text{I(R1.nA)} \\ V_X - V_Y & = 8 i_3 \end{align} $$
For voltage source V2:
$$ \begin{align} \text{V(V2.nA)} - \text{V(V2.nB)} & = 19 \\ V_Y - V_Z & = 19 \end{align} $$
For resistor R2:
$$ \begin{align} \text{V(R2.nA)} - \text{V(R2.nB)} & = 2.5 \ \text{I(R2.nA)} \\ \text{V(Z)} - \text{V(ground)} & = 2.5 \ \text{I(R2.nA)} \\ V_Z & = 2.5 i_4 \end{align} $$
For resistor R3:
$$ \begin{align} \text{V(R3.nA)} - \text{V(R3.nB)} & = 5 \ \text{I(R3.nA)} \\ \text{V(Z)} - \text{V(ground)} & = 5 \ \text{I(R3.nA)} \\ V_Z & = 5 i_5 \end{align} $$
For resistor R4:
$$ \begin{align} \text{V(R4.nA)} - \text{V(R4.nB)} & = 1 \ \text{I(R4.nA)} \\ \text{V(W)} - \text{V(X)} & = 1 \ \text{I(R4.nA)} \\ V_W - V_X & = i_2 \end{align} $$
For current source I1:
$$i_2 = 2$$
Step 5 is to gather all the equations from steps 3 and 4:
$$ \begin{align} i_1 + i_2 - i_3 & = 0 \\ i_3 - i_4 - i_5 & = 0 \\ V_X & = 48 \\ V_X - V_Y & = 8 i_3 \\ V_Y - V_Z & = 19 \\ V_Z & = 2.5 i_4 \\ V_Z & = 5 i_5 \\ V_W - V_X & = i_2 \\ i_2 = 2 \end{align} $$
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:
$$ \begin{align} i_1 + i_2 - i_3 & = 0 \\ i_3 - i_4 - i_5 & = 0 \\ V_X & = 48 \\ V_X - V_Y - 8 i_3 & = 0 \\ V_Y - V_Z & = 19 \\ V_Z - 2.5 i_4 & = 0 \\ V_Z - 5 i_5 & = 0 \\ V_W - V_X - i_2 & = 0 \\ i_2 & = 2 \end{align} $$
Then as a matrix equation:
$$ \begin{equation} \begin{bmatrix} 1 & 1 & -1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & -1 & -1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & -8 & 0 & 0 & 0 & 1 & -1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & -1 \\ 0 & 0 & 0 & -2.5 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & -5 & 0 & 0 & 0 & 1 \\ 0 & -1 & 0 & 0 & 0 & 1 & -1 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} i_1 \\ i_2 \\ i_3 \\ i_4 \\ i_5 \\ V_W \\ V_X \\ V_Y \\ V_Z \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 48 \\ 0 \\ 19 \\ 0 \\ 0 \\ 0 \\ 2 \end{bmatrix} \end{equation} $$
And as an augmented matrix:
$$ \begin{equation} \left[ \begin{array}{ccccccccc|c} 1 & 1 & -1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & -1 & -1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 48 \\ 0 & 0 & -8 & 0 & 0 & 0 & 1 & -1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & -1 & 19 \\ 0 & 0 & 0 & -2.5 & 0 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & -5 & 0 & 0 & 0 & 1 & 0 \\ 0 & -1 & 0 & 0 & 0 & 1 & -1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 2 \end{array} \right] \ \text{for} \ (i_1, i_2, i_3, i_4, i_5, V_W, V_X, V_Y, V_Z) \end{equation} $$
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: $\boxed{V_X = 48}$ and $\boxed{i_2 = 2}$. We can remove these two equations and these two variables from the system by substituting their values everywhere else they're referenced:
$$ \begin{equation} \left[ \begin{array}{ccccccc|c} 1 & -1 & 0 & 0 & 0 & 0 & 0 & -2 \\ 0 & 1 & -1 & -1 & 0 & 0 & 0 & 0 \\ 0 & -8 & 0 & 0 & 0 & -1 & 0 & -48 \\ 0 & 0 & 0 & 0 & 0 & 1 & -1 & 19 \\ 0 & 0 & -2.5 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -5 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 50 \end{array} \right] \ \text{for} \ (i_1, i_3, i_4, i_5, V_W, V_Y, V_Z) \end{equation} $$
In this 7x7 system, the final equation says $\boxed{V_W = 50}$, which is easy to eliminate as the variable is not referenced anywhere else in the system.
$$ \begin{equation} \left[ \begin{array}{cccccc|c} 1 & -1 & 0 & 0 & 0 & 0 & -2 \\ 0 & 1 & -1 & -1 & 0 & 0 & 0 \\ 0 & -8 & 0 & 0 & -1 & 0 & -48 \\ 0 & 0 & 0 & 0 & 1 & -1 & 19 \\ 0 & 0 & -2.5 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -5 & 0 & 1 & 0 \end{array} \right] \ \text{for} \ (i_1, i_3, i_4, i_5, V_Y, V_Z) \end{equation} $$
In the 6x6 system, the final two lines have two variables and zero constant term, so they say simply $V_Z = 2.5 i_4$ and $V_Z = 5 i_5$. Out of these three variables, we can choose to keep any one and eliminate the other two. Let's keep $V_Z$ and replace $i_4 = 0.4 V_Z$ and $i_5 = 0.2 V_Z$:
$$ \begin{equation} \left[ \begin{array}{cccc|c} 1 & -1 & 0 & 0 & -2 \\ 0 & 1 & 0 & -0.6 & 0 \\ 0 & -8 & -1 & 0 & -48 \\ 0 & 0 & 1 & -1 & 19 \\ \end{array} \right] \ \text{for} \ (i_1, i_3, V_Y, V_Z) \end{equation} $$
These substitutions modified the 2nd remaining equation, leaving us again with an easily reducible $i_3 - 0.6 V_Z = 0$, or $i_3 = 0.6 V_Z$. We can remove $i_3$ everywhere and replace it with $0.6 V_Z$:
$$ \begin{equation} \left[ \begin{array}{ccc|c} 1 & 0 & -0.6 & -2 \\ 0 & -1 & -4.8 & -48 \\ 0 & 1 & -1 & 19 \\ \end{array} \right] \ \text{for} \ (i_1, V_Y, V_Z) \end{equation} $$
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 ($R_2 + R_3 \rightarrow R_3$):
$$ \begin{equation} \left[ \begin{array}{ccc|c} 1 & 0 & -0.6 & -2 \\ 0 & -1 & -4.8 & -48 \\ 0 & 0 & -5.8 & -29 \\ \end{array} \right] \ \text{for} \ (i_1, V_Y, V_Z) \end{equation} $$
At this point, we have an upper triangular matrix, so the system is easily solved from the bottom row up: $-5.8 V_Z = -29$, or $\boxed{V_Z} = 5$. Next, $-V_Y -4.8 (5) = -48$, or $\boxed{V_Y = 24}$. And finally, $i_1 - 0.6 (5) = -2$, or $\boxed{i_1 = 1}$.
From here, we can expand the proportional substitutions we made earlier:
$$ \begin{align} i_4 & = 0.4 V_Z = 2 \\ i_5 & = 0.2 V_Z = 1 \\ i_3 & = 0.6 V_Z = 3 \end{align} $$
We now have solved all nine variables:
$$ \begin{equation} \begin{bmatrix} i_1 \\ i_2 \\ i_3 \\ i_4 \\ i_5 \\ V_W \\ V_X \\ V_Y \\ V_Z \end{bmatrix} = \begin{bmatrix} 1 \\ 2 \\ 3 \\ 2 \\ 1 \\ 50 \\ 48 \\ 24 \\ 5 \end{bmatrix} \end{equation} $$
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, $V_W=50$ -- because the first two variables we solved ($V_X=48$ and $i_2 = 2$) 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 $R1 + (R2 // R3)$, and use that to solve for the total current $i_3$. 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.
In the next section, Superposition, we'll look at one special method of solving circuits with multiple sources.
How to cite this source: