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:

  • Elimination method. Systems of 2 linear equations can be solved easily using the elimination method
  • 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.

Elimination method

The elimination method is usually used to solve systems of two equations with two unknowns. To use the elimination method we multiply the two equations by different numbers such that the coefficients of one of the unknowns is equal in both equations. Then, if we subtract the two equations the unknows cancels and we are left with a simple linear equation in only only variable.

For instance, let's solve the system $$\begin{aligned} 2x+5y &= 16\\ 3x+y &= 11 \end{aligned} $$ There are two ways to solve this problem. In the first way, we multiply the first equation by $3$ and the second equation by $2$ to get $$ \begin{aligned} 6x+15y &= 48\\ 6x+2y &= 22 \end{aligned} $$ Since the coefficients of $x$ are equal, we can now subtract the two equations to get $15y-2y=48-22$, which gives $$y=3$$ To compute the value of $x$, we substitute the value of $y$ in the first equation $2x + 5\cdot 3=16$ to obtain $$x=2$$ The second way to solve this problem is to multiply the second equation by $5$ $$ \begin{aligned} 2x+5y &= 16\\ 15x+5y &= 55 \end{aligned} $$ Subtracting the two equations, we obtain $2x-15x=16-55$, which gives again $x=2$ The value of $y$ can be obtined by substiution the above value of $x$ in the first equation. We obtain $x=3$.

Substitution method

The substitution method is often used to solve system of two or more equations. The method consists in extracting one unknown from the first equation as a function of the other $n-1$ unknowns (where $n$ is the number of equations) and substituting its value in the other $n-1$ equations. In this way, we obtain a system of $n-1$ equations. Repeating this process recursively we can reduce the number of equations to only one equation that can be solved easily. Then, we proceed backwards we compute each unknown.

For instance, let's solve the system $$\begin{aligned} 2x+5y &= 16\\ 3x+y &= 11 \end{aligned} $$ using substition. There are again multiple ways to solve this problem. We could extract $x$ or $y$ from the first equation and substitute it in the second equation. Or, we could extract $x$ or $y$ from the second equation and substitute it in the first equation. Either way, we eventually obtain the same solution for $x$ and $y$.

Let us start by extracting $x$ from the first equation. We obtain $$x=\frac{16}{2}-\frac{5}{2}y$$ Substituting this value in the second equation we obtain $$3\left(8-\frac{5}{2}y\right)+y=11$$ $$24-\frac{15}{2}y+y=11$$ $$13=\frac{13}{2}y$$ which gives $y=2$. Then, we compute $$x=8-\frac{5}{2}\cdot 2=3$$

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

Solving systems of linear equations numerically is important because it 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, Mathematica, Maple, Maxima, etc. can also be used to solve systems of linear equations.

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
See also
Read more

Systems of linear equations
Cramer's rule'
Maxima'