Linear Circuit Analysis


Systems of linear equations

A general system of $n$ linear equations withe $m$ unknowns can be written as $$ \begin{aligned} a_{11}x_1+a_{12}x_2+ \ldots +a_{1n}x_n &= b_1\\ a_{21}x_1+a_{22}x_2+ \ldots +a_{2n}x_n &= b_2\\ \ldots\\ a_{n1}x_1+a_{n2}x_2+ \ldots +a_{nn}x_n &= b_n \end{aligned} $$ or, in matrix form $$A x =b$$ where $A$ is the matrix of the system ($n\times n$), $x$ is the vector of unknowns, and $b$ is the right-hand side vector. Both $x$ and $b$ are column vectors. Such linears often appear in the analysis of linear circuits and students should be familiar with solving them. A few methods to solve them are:

  • Substitution method. Systems of 2-4 linear equations can usually be solved efficiently using the substituion method
  • Cramer's rule.' Cramer's rule involves the use of determinants to solve the linear system
  • Numerical solution. E.g. Use calculators such as TI-84, Matlab, Python, etc.

These methods can be applied to both real and complex systems of linear equations.

Substitution method (elimination of variables)

Perhaps the simplest method for solving a system of linear equations is to repeatedly eliminate variables, as follows:

  • Solve the first equation of the linear system for one of the variables in terms of the others.
  • Substitute this expression into the remaining equations. This yields a system of equations with one fewer equation and unknown.
  • Solve this equation, and then back-substitute until the entire solution is found.

Cramer's rule

The solution of a system of linear equations can be written as $$x_i = \frac{\left|A_i\right|}{\left|A\right|}$$ where $A_i$ is the matrix formed by replacing the i-th column of matrix $A$ by the column vector $b$ ($i=1,\ldots ,n$), $det(A_i)$ is the determinant of $A_i$ and $det(A)$ is the determinant of $A$. For instance, in the case of system of 2 linear equations $$ \begin{aligned} a x+b y &= \textcolor{red}{e}\\ c x+d y &= \textcolor{red}{f} \end{aligned} $$ the solution is $$ \begin{aligned} x &= \frac{\begin{vmatrix} \textcolor{red}{e} & b \\ \textcolor{red}{f} & d \end{vmatrix} }{\begin{vmatrix} a & b \\ b & d \end{vmatrix}} = \frac{d \textcolor{red}{e} - b \textcolor{red}{f}}{a d - b c}\\ y &= \frac{\begin{vmatrix} a & \textcolor{red}{e} \\ c & \textcolor{red}{f} \end{vmatrix} }{\begin{vmatrix} a & b \\ b & d \end{vmatrix}} = \frac{a \textcolor{red}{f} - c \textcolor{red}{e}}{a d - b c}\\ \end{aligned} $$

Numerical solution

Being able to solve systems of linear equations numerically is important because it usualy allows us to find the solution of the system relatively fast, without having to solve the equations by hand. Engineering students should be familiar with using hand calculators such as TI-84 to solve systems of linear equations. In addition, common software such as Matlab, Python, Mathamtica, Maple, Maxima, etc. can also be used to solve systems of linear equations. Below we give examples of how to solve a system of linear equations using Python and Matlab.

Systems of linear equations with real coefficients
Assume you want to solve the following system of equations: $$ \begin{aligned} 3 x+ y &= 9\\ x + 2 y &= 8 \end{aligned} $$
  • Python (you can use it for free)
    import numpy as np
    a = np.array([[3,1], [1,2]])
    b = np.array([9,8])
    x = np.linalg.solve(a, b)
    print(x)
  • Matlab
    syms x y z
    eqn1 = 3*x + y == 9;
    eqn2 = x + 2*y == 8;
    sol = solve([eqn1,eqn2,eqn3],[x,y,z]);
  • Maple
    solve({3*x+y=9,2+2*y=8});
  • Mathematica
    Solve[3*x + y == 9 && x + 2*y == 8, {x,y}]
  • Maxima (this is free software)
    solve([3*x+y=5,x+2*y=8], [x,y]);
  • CircuitsU
    For nodal and mesh analysis problems yielding systems with more than three equations, CircuitsU automatically solves the system if the user correctly inputs the system matrix.
Systems of linear equations with complex coefficients
Assume you want to solve the following system of equations: $$ \begin{aligned} (3 \textcolor{blue}{j}+1) x+ y &= 9-2 \textcolor{blue}{j}\\ x + 2 \textcolor{blue}{j} y &= 8+ \textcolor{blue}{j} \end{aligned} $$
  • Python (you can use it for free)
    import numpy as np
    a = np.array([[3j+i,1], [1,2j]])
    b = np.array([9-2j,8+j])
    x = np.linalg.solve(a, b)
    print(x)
  • Matlab
    syms x y z
    eqn1 = (3*i+1)*x + y == 9-2*i;
    eqn2 = x + 2*i*y == 8+i;
    sol = solve([eqn1,eqn2,eqn3],[x,y,z]);
  • Maple
    solve({(3*I+1)*x+y=9-2*I,x+2*I*y=8+I});
  • Mathematica
    Solve[(3*I+1)*x + y == 9-2*I && x + 2*I*y == 8+I, {x,y}]
  • Maxima (this is free software)
    solve([(3*%i+1)*x+y=9-2%i,x+2*%i*y=8+%i], [x,y]);
  • CircuitsU
    For nodal and mesh analysis problems yielding systems with more than three equations, CircuitsU automatically solves the system if the user correctly inputs the system matrix.
Sample Solved Problems
The examples below are randomly generated.
See also
Read more

Systems of linear equations
Cramer's rule'
Maxima'