Tutorial: More Nodal Analysis Revisited with Matricies

The questions below are due on Tuesday February 17, 2026; 10:00:00 PM.
 
You are not logged in.

Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.

In lecture and recitation we have seen the node method presented with resistance/equations and conductances/matricies. For this problem, we will solve a circuit using conductance and with matricies to aid in seeing how different methods can be useful and yield the same answer.

Matricies

First, let's talk about matricies. In general, a matrix is a way of formatting numbers or elements in rows and columns.

Here is a generic matrix, A:

A = \begin{bmatrix} a_{1,1} & a_{1,2}\\ a_{2,1} & a_{2,2} \end{bmatrix}

This matrix is a 2x2 matrix, meaning there are two rows and two columns. Each element in A is denoted with a subscript showing the row, column location. For example, a_{2,1} represents the element at the second row and first column.

Most system of equations can be re-written in matrix format. This makes solving a large system of equations much simpler, particularly when utilizing tools like MATLAB, python, a TI-84, etc., compared to solving by hand.

Let's take an example, unrelated to a circuit to show simple matrix math.

Pretend we solved some system and we got the following equations (four equations with four unknowns: x_1, x_2, x_3, x_4):

x_1 - 2x_2+3x_3-6x_4 = 8
x_1 - 10x_3 + x_4 = 11
4x_1 + x_2 -4x_4 = 8
3x_1 + 5x_2 -7x_3 = 6

We can rewrite this system of equations in matrix format:

AX = C

Where A is a 4x4 matrix representing the coefficients of each variable for each equation. For our example, that means A is:

A = \begin{bmatrix} 1 & -2& 3&-6\\ 1 & 0 & -10 & 1\\ 4 & 1 & 0 & -4\\ 3 & 5 & -7 & 0 \end{bmatrix}

X is a 4x1 vector (4 rows and 1 column) formed of all of the unknowns:

X = \begin{bmatrix} x_1\\ x_2\\ x_3\\ x_4 \end{bmatrix}

C is a 4x1 vector (4 rows and 1 column) built up of all of the constants in our system of equations (any term not multiplied by an unknown).

So we can rewrite our system of equations like this:

\begin{bmatrix} 1 & -2& 3&-6\\ 1 & 0 & -10 & 1\\ 4 & 1 & 0 & -4\\ 3 & 5 & -7 & 0 \end{bmatrix}\begin{bmatrix} x_1\\ x_2\\ x_3\\ x_4 \end{bmatrix} = \begin{bmatrix} 8\\ 11\\ 8\\ 6 \end{bmatrix}

To solve for our unknowns, we can rewrite our matrix equation such that we are solving for the X vector: First, we multiply both sides of the equation by the inverse of matrix A, denoted A^{-1}.

A^{-1}AX = A^{-1}C

The inverse of a matrix times the matrix is equal to the identity matrix: A^{-1}A=I. Where I is the identity matrix (all zeros except for ones on the diagnols). Any matrix multiplied by the identity matrix is equal to the original matrix (it is the matrix equivalent of a 1). So we can then rewrite the equation as:

X = A^{-1}C

This means we need to take the inverse of our A matrix. In this class, we will assume that we can take the inverse and that we have an easy method (Python, MATLAB, etc) to do so. This gives us the following matrix equation for our example.

\begin{bmatrix} x_1\\ x_2\\ x_3\\ x_4 \end{bmatrix} = \begin{bmatrix} 1 & -2& 3&-6\\ 1 & 0 & -10 & 1\\ 4 & 1 & 0 & -4\\ 3 & 5 & -7 & 0 \end{bmatrix}^{-1}\begin{bmatrix} 8\\ 11\\ 8\\ 6 \end{bmatrix}

Using any solver we can then solve for the X vector. Here is the code I used in MATLAB to solve:

A = [1 -2 3 -6; 1 0 -10 1; 4 1 0 -4; 3 5 -7 0];
C = [8;11;8;6];
X = inv(A)*C

\begin{bmatrix} x_1\\ x_2\\ x_3\\ x_4 \end{bmatrix} = \begin{bmatrix} 0.70\\ -0.88\\ -1.18\\ -1.51 \end{bmatrix}

Applying Matrix Math to Nodal Analysis

Now let's apply matrix math to a circuit, here we will use the same circuit as "More Nodal Analysis". The circuit is shown below but instead of resistance we have written the resistors in terms of conductance (G).

Conductance is the inverse of resistance (1/R), the units of conductance are Siemens (more commonly used) or mhos (because its the opposite of Ohms).

Note, we can rewrite Ohm's law using conductance. So V= IR is equivalent to V = I/G or VG = I.

Now we are going to walk through writing the node equations and then moving to matrix format.

Let's start by writing the node equations, but instead of directly solving for e_1 and e_2, we are going to write the equation for each node in the following format:

(G_x)e_1 + (G_y)e_2 = I_z

Where G_x, G_y and I_z will be dependent on your circuit and each node.

Let's start by walking through the equation for node e_1 together.

Picking polarity such that all currents flow into e_1 we have the following equation:

(V_s-e_1)G_1 + (0-e_1)G_2 + I_s + (e_2 - e_1)G_3= 0

Now, let's rewrite the equation, lumping together all of the terms multipling e_1 and e_2:

(G_1+G_2+G_3)e_1 + (-G_3)e_2 = V_sG_1 + I_s

Note, the right hand side of the equation is equal to a conductance times a voltage (which is equal to current) plus a current.

So the format of this equation now matches the format we selected above, where G_x = G_1 + G_2 + G_3, G_y = -G_3 and I_z = V_sG_1 + I_S.

Now you try the same thing for node e_2, writing the node equation using conductance and then reformating the equation to match the format above.

Note, the answer checker is set up assuming that you define currents going into the node.

For node e_2, using the format above what is G_x? Enter your answer in terms of G_1, G_2, G_3, G_4, V_s, and/or I_s.

G_x =~

For node e_2, what is G_y? Enter your answer in terms of G_1, G_2, G_3, G_4, V_s, and/or I_s.

G_y =~

For node e_2, what is I_z? Enter your answer in terms of G_1, G_2, G_3, G_4, V_s, and/or I_s.

I_z =~

So now we have two equations (one for each node) that are formated in a particular way.

For node e_1:

(G_{x,1})e_1 + (G_{y,1})e_2 = I_{z,1}

For node e_2:

(G_{x,2})e_1 + (G_{y,2})e_2 = I_{z,2}

This enables us to write the equations in matrix format.

GE = I_z
Where G is the conductance matrix, E is a vector with our unknown node voltages and I_z are the constants in our system of equations.
\begin{bmatrix} G_{x,1} & G_{y,1}\\ G_{x,2} & G_{y,2} \end{bmatrix} \begin{bmatrix} e_1\\ e_2 \end{bmatrix} = \begin{bmatrix} I_{z,1}\\ I_{z,2} \end{bmatrix}

To solve for e_1 and e_2 we can then rearrange the equation like:

\begin{bmatrix} e_1\\ e_2 \end{bmatrix} = \begin{bmatrix} G_{x,1} & G_{y,1}\\ G_{x,2} & G_{y,2} \end{bmatrix}^{-1}\begin{bmatrix} I_{z,1}\\ I_{z,2} \end{bmatrix}

For this example circuit, the resulting matrix equation is:

\begin{bmatrix} e_1\\ e_2 \end{bmatrix} = \begin{bmatrix} G_1+G_2+G_3 & -G_3\\ -G_3& G_3 + G_4 \end{bmatrix}^{-1}\begin{bmatrix} V_sG_1+I_s\\ 0 \end{bmatrix}

You can then directly solve or use MATLAB, desmos, python, TI-84, etc to solve for e_1 and e_2.

Depending on how comfortable you are with matricies, this method may seem like more work than the just solving the node equations directly. Especially since we only have two nodes in this circuit.

However, if we take a closer look at the conductance matrix (G) we notice a really interesting pattern. The 1,1 entry is a sum of all of the conductances connected to node e_1. The 2,2 entry is a sum of all of the conductances connected to node e_2. The 1,2 and 2,1 entry are the negative of the conductance connected node e_1 and node e_2.

This pattern continues even for much more complicated circuits, with hundreds of nodes and how we typically solve more complicated systems (like the power grid!).

In summary, the conductance matrix (G), has the following format:

  • The matrix is square with dimensions of n x n, (equal number of rows and columns). Where n is equal to the number of nodes with unknown voltages in the circuit.
  • Every diagnol element a_{m,m} (i.e. the row index equals the column index) is equal to the sum of all conductances connected to node m.
  • The matrix is symmetric, meaning that any element a_{k,j} = a_{j,k}.
  • The non-diagnol elements a_{k,j} are equal to the negative of the conductances connected between the node j and node k.

Let's take a look at a quick example to try out creating the conductance matrix based on this pattern.

Here we have two unknown node voltages (e_1 and e_2) so we should have a 2x2 conductance matrix:

G = \begin{bmatrix} G_{1,1} & G_{1,2}\\ G_{2,1} & G_{2,2} \end{bmatrix}

According to the pattern we found above, the first element G_{1,1} should be a sum of all of the conductances connected to node 1 (e_1).

G_{1,1} = G_1 + G_3 + G_2

What is G_{2,2}? Enter your answer in terms of G_1, G_2, G_3, G_4, V_s, and/or I_s.

G_{2,2} =~

The off-diagnol terms G_{1,2} and G_{2,1} will be equal and the inverse of the conductance between the two nodes.

What is G_{1,2}=G_{2,1} ? Enter your answer in terms of G_1, G_2, G_3, G_4, V_s, and/or I_s.

G_{1,2} =~

That is it, we have made the conductance matrix without having to set up our system of equations! This is a neat trick but it is always good to write out the equations and solve manually since in this course we won't have systems with crazy large number of nodes.