These tutorials were developed by Mr. Roaldi in 2000 to assist students in taking circuit courses. On May 23, 2011, there was an e-mail inquiry on matrix inversion. Unfortunately, the e-mail was accidentaly purged. Basically, to determine values of N indepedent variables, one needs N linear equations. Coefficients of these equations form an NxN matrix. The determinant, D, of the matrix must not be zero. Otherwise, the matrix is singular and can't be inverted. Either there exist no consistent solutions or values of some indepdent variables can't be determined.

The two main methods of circuit analysis presented in the book, mesh and nodal analysis, both result in a number of unknowns and the same number of equations. These equations are usually much easier to solve using the various properties of matrices than they would be by hand. This section will first show how the equations with the unknowns can be put into vector-matrix form and then three different ways to solve the matrix and find the unknowns.

A matrix is a rectangular list of values with m rows and n columns (m and n
may be different). The values in each row and ordered from left to right
according to their column number, 1 to n. The values in each column are
ordered from top to bottom according to their row numbers, 1 to m. Each
value in the matrix has two subscripts, row then column. For example, a_{22}
is the value in the second row and second column.

In order to use one of the three methods of solving the
unknown variables using matrix methods, the equations must be put
in vector-matrix form. To understand this form it is necessary to
understand how matrices are multiplied. Only conformable matrices can be multiplied. In order to be conformable, the
number of columns in the left matrix must equal the number of
rows in the right matrix. Matrix multiplication is carried out in
the following way. To find each element of the resulting matrix,
you look at each of the rows of the first matrix and the
corresponding column of the second matrix. You then take the
leftmost element in the row of the first matrix and multiply it
with the topmost element of the column of the second matrix. Then
move right one in the row and down one in the column and find
their product. For example, when multiplying two matrices, A * B, the first step
is to multiply a_{11} by b_{11}. The next step is to
multiply a_{12} by b_{21}. Continue until no more rows or columns remain in
the corresponding matrices (this will happen at the same time
for each matrix if they are conformable). Add all of the products
together to get the element's value. If A and B each had three rows and columns,
the resulting matrix's first element would be

r_{11} = (a_{11})(b_{11}) + (a_{12})(b_{21})
+ (a_{13})(b_{31})

Here is an example.

To aid in the multiplication, write the second matrix above and to the right of the first and the resulting matrix at the intersection of the two.

Now, to find the first element of the resulting matrix, r_{11}, take the leftmost number in the corresponding row of the first
matrix, 4, multiply it with the topmost number in the
corresponding column of the second matrix, 1, and then add the
product of the next number to the right in the first matrix and
the next number down in the second matrix. For the top left
element, it would be the following.

(4)(1) + (3)(3) = 13

For the top-right element of the resulting matrix, we will still use row 1 of the first matrix but now use column 2 of the second matrix. This element is solved below.

(4)(2) + (3)(1) = 11

Doing the same with the rest of the numbers leaves the following matrix.

When mesh or nodal analysis is used to create equations which describe a circuit, the analysis results is some number of unknowns with an equal number of equations. It will look something like this.

- 3a - b = 7
- -a + 7b - 6c = 2
- -3b + 4c = 0

A vector is simply a matrix with one column. The preceding equations can also be expressed in the following way:

Since multiplication is inferred by the lack of a sign, the form is usually shown like this.

This is simply an equation created using matrix multiplication. If you multiply the first matrix with the vector containing the unknowns, you can get the left side of the equations back, as shown here.

Since each equation states that the left side is equal to the right, it is valid to substitute a vector containing the right side of each equation for the side with the variables, and the vector-matrix form results.

The first way to solve for the unknowns in a matrix is called Cramer's Rule. It is usually used if there are only two or three unknowns to solve. The first step is to find the determinant. The determinant is found by taking a square matrix (the first matrix in the vector-matrix form should always be a square) and finding the result when the products of the downward left diagonal numbers is subtracted from the products of the downward right diagonals. Since we can't use Greek letters, we will represent the determinant by D.

Note: In matrices with 3 or more rows and columns, the diagonals will wrap around.

Take the matrix from the last example.

First, find the sum of the downward right diagonals, then subtract the sum of the downward left diagonals.

- D = (3)(7)(4) + (-1)(-6)(0) + (0)(-1)(-3) - (0)(7)(0) - (-3)(-6)(3) - (-1)(-1)(4) = 84 - 58 = 26

The determinant is 26.

Next, to find each variable, replace the corresponding column with the solution vector (the vector on the right side of the equal sign in vector-matrix form) and perform the same operation used to find the determinant. Then divide the result by the determinant to find the answer. For example, to find a, the first variable in the example, replace column one with the solution vector and perform the diagonal multiplication.

Compute the determinant of this matrix

- (7)(7)(4) + (-1)(-6)(0) + (0)(2)(-3) - (0)(7)(0) - (2)(-1)(4) - (7)(-3)(-6) = 78

Then divide by the original determinant.

- a = 78 / 26 = 3

The other two variables can be computed in a similar way.

b = ( (3)(2)(4) + (7)(-6)(0) + (0)(-1)(0) - (0)(2)(0) - (-1)(7)(4) - (0)(-6)(3) ) / 26 = 52 / 26 = 2

c = ( (3)(7)(0) + (-1)(-3)(7) + (-1)(2)(0) - (0)(7)(7) - (-1)(-1)(0) - (3)(-3)(2) ) / 26 = 39 / 26 = 3/2

The second method of solving for the unknowns is called matrix inversion. The first step in this method is also finding the determinant of the original matrix. The next step involves finding the cofactors of all the matrix's elements. The cofactor is found by eliminating the row and column corresponding to the indices of the desired element and then finding the determinant of the resulting matrix. For example, to find the cofactor of the first element, eliminate the first row and column and then find the determinant of the resulting matrix. There is also an additional step of multiplying the result by -1 raised to the sum of the indices. This basically means if the sum of the indices is even, the sign of the determinant is unchanged, if the sum is odd, the sign is changed. In finding the cofactor of the first row and first column the sign of the number would not be changed since 1+1 equals 2 and 2 is even. Taking the previous problem.

First, find the determinant of the original matrix. We already know this to be 26. Next find each cofactor.

C_{11} = -1^{2} * ( (7)(4) - (-3)(-6) ) = (1) (10) = 10

Similarly, find the C_{12} by eliminating the first row and
second column, finding the determinant of the resulting matrix
and then multiplying by -1^{(1+2)}

C_{12} = -1^{3} * ( (-1)(4) - (0)(-6) ) = (-1) (-4) = 4

After finding all the cofactors, put them in a matrix
according to their indices (C_{11} in the top left corner, C_{12}, to
its right and so on). The matrix of cofactors for this problem
looks like this.

The next step is to find the transpose of the cofactor matrix. The transpose of a matrix is the matrix flipped around the main axis (the diagonal from top left to bottom right). The transpose of the cofactor matrix is:

Dividing this matrix by the determinant yields the following equation.

The unknowns can now be found by matrix multiplication and division by the original determinant, 26.

- a = 78 / 26 = 3
- b = 52 / 26 = 2
- c = 39 / 26 = 3/2

These results agree with the results from Cranmer's Method.

The final matrix method uses the basic idea of equations to solve for each unknown. Since one side of the equation is equal to the other (hence the term, equation) subtracting one equation from another must yield a third valid equation. The basic idea behind the gauss elimination method it to subtract the equations or multiples of the equations from each other until each equation has only one non-zero unknown.

Here is an example.

First, we want to get rid of the first unknown in every row but the first row. The third row already has a zero there, but the second does not. Therefore, we will add 1/3 of the first row to the second row.

As you can see, 1/3 of 3 gave 1 which left us with 0 when added to the second row. 1/3 of -1 added to 7 gave 20/3, 1/3 of 0 added to -6 left 0, and 1/3 of 7 added to 6 gave 13/3.

Next, we want to eliminate the second unknown in the last equation so that the last equation only has one unknown. This can be accomplished by adding 9/20 of the second row to the third.

Next, we want to find the actual value of the third unknown, so multiply the third row by 10/13 to simplify it.

From this we see that c is equal to 3/2. Next we need to get rid of the third unknown in the second row. Adding 6 times the 3rd row to the second will do this.

Multiply the second row by 3/20 to simplify.

Now add the first and second rows to get rid of the second unknown in the first row.

Finally, divide the first row by 3.

- a = 3
- b = 2
- c = 3/2

These results agree with both the other matrix methods.