Matrix Algebra for Electrical Engineers

## Introduction - Linear Equations

[edit | edit source]

Let us illustrate through examples what linear equations are. We will also be introducing new notation wherever appropriate.

For example:

3 x − y = 14 {\displaystyle 3x-y=14}
2 x + y = 11 {\displaystyle 2x+y=11}

You could solve for  x {\displaystyle x} or  y {\displaystyle y} in one equation and substitute it into the other. But what if you had three variables, and three equations, such as:

12 x + 2 y + 15 z = 25 {\displaystyle 12x+2y+15z=25}
23 x + 12 y + 45 z = 46 {\displaystyle 23x+12y+45z=46}
32 x + 68 y + 10 z = 8 {\displaystyle 32x+68y+10z=8}

Substitution is still viable, but it would take a while, and you have many opportunities to make a mistake. In this page, we will talk about turning linear equations into a matrix, and then using properties of matrices to solve them. Note that we're skipping most of the theory involved, and are solely focusing on their practical usage.

Now let's examine those first two problems. The first thing we need to do is turn the systems of equations into matrices. To do that, we make each row correspond to an equation, and each column (vertical) correspond to a single variable. So for the first equation:

3 x − y = 14 {\displaystyle 3x-y=14}
2 x + y = 11 {\displaystyle 2x+y=11}

So we have:

[ 3 − 1 14 2 1 11 ] {\displaystyle \left[{\begin{array}{ccc}3&-1&14\\\2&1&11\end{array}}\right]}

Where the first row is the first equation, and the second row is the second. The first column corresponds to  x {\displaystyle x} , the second to  y {\displaystyle y} , and the third to  z {\displaystyle z} .

Let's try doing that to the second one now too:

[ 12 2 15 25 23 12 45 46 32 68 10 8 ] {\displaystyle \left[{\begin{array}{cccc}12&2&15&25\\\23&12&45&46\\\32&68&10&8\end{array}}\right]}

## Matrices

[edit | edit source]

Suppose that you have a linear system of equations

a 11 x 1 + a 12 x 2 + a 13 x 3 + a 14 x 4 = b 1 a 21 x 1 + a 22 x 2 + a 23 x 3 + a 24 x 4 = b 2 a 31 x 1 + a 32 x 2 + a 33 x 3 + a 34 x 4 = b 3 a 41 x 1 + a 42 x 2 + a 43 x 3 + a 44 x 4 = b 4   . {\displaystyle {\begin{aligned}a_{11}x_{1}+a_{12}x_{2}+a_{13}x_{3}+a_{14}x_{4}&=b_{1}\\\a_{21}x_{1}+a_{22}x_{2}+a_{23}x_{3}+a_{24}x_{4}&=b_{2}\\\a_{31}x_{1}+a_{32}x_{2}+a_{33}x_{3}+a_{34}x_{4}&=b_{3}\\\a_{41}x_{1}+a_{42}x_{2}+a_{43}x_{3}+a_{44}x_{4}&=b_{4}\end{aligned}}~.}

Matrices provide a simple way of expressing these equations. Thus, we can instead write

[ a 11 a 12 a 13 a 14 a 21 a 22 a 23 a 24 a 31 a 32 a 33 a 34 a 41 a 42 a 43 a 44 ] [ x 1 x 2 x 3 x 4 ] = [ b 1 b 2 b 3 b 4 ]   . {\displaystyle {\begin{bmatrix}a_{11}&a_{12}&a_{13}&a_{14}\\\a_{21}&a_{22}&a_{23}&a_{24}\\\a_{31}&a_{32}&a_{33}&a_{34}\\\a_{41}&a_{42}&a_{43}&a_{44}\end{bmatrix}}{\begin{bmatrix}x_{1}\\\x_{2}\\\x_{3}\\\x_{4}\end{bmatrix}}={\begin{bmatrix}b_{1}\\\b_{2}\\\b_{3}\\\b_{4}\end{bmatrix}}~.}

Here  A {\displaystyle \mathbf {A} } is a  4 × 4 {\displaystyle 4\times 4} matrix while  x {\displaystyle \mathbf {x} } and  b {\displaystyle \mathbf {b} } are  4 × 1 {\displaystyle 4\times 1} matrices. In general, an  m × n {\displaystyle m\times n} matrix  A {\displaystyle \mathbf {A} } is a set of numbers arranged in  m {\displaystyle m} rows and  n {\displaystyle n} columns.

A = [ a 11 a 12 a 13 … a 1 n a 21 a 22 a 23 … a 2 n ⋮ ⋮ ⋮ ⋱ ⋮ a m 1 a m 2 a m 3 … a m n ]   . {\displaystyle \mathbf {A} ={\begin{bmatrix}a_{11}&a_{12}&a_{13}&\dots &a_{1n}\\\a_{21}&a_{22}&a_{23}&\dots &a_{2n}\\\\\vdots &\vdots &\vdots &\ddots &\vdots \\\a_{m1}&a_{m2}&a_{m3}&\dots &a_{mn}\end{bmatrix}}~.}

## Determinant of a matrix

[edit | edit source]

The next thing we will discuss is the meaning of the  determinant of a matrix. Note that a determinant is only defined for square matrices.

For a  2 × 2 {\displaystyle 2\times 2} matrix  A {\displaystyle \mathbf {A} } , we have

A = [ a 11 a 12 a 21 a 22 ] ⟹ det ( A ) = | a 11 a 12 a 21 a 22 | = a 11 a 22 − a 12 a 21   . {\displaystyle \mathbf {A} ={\begin{bmatrix}a_{11}&a_{12}\\\a_{21}&a_{22}\end{bmatrix}}\implies \det(\mathbf {A} )={\begin{vmatrix}a_{11}&a_{12}\\\a_{21}&a_{22}\end{vmatrix}}=a_{11}a_{22}-a_{12}a_{21}~.}

For a  n × n {\displaystyle n\times n} matrix, the determinant is calculated by expanding into  minors as

det ( A ) = | a 11 a 12 a 13 … a 1 n a 21 a 22 a 23 … a 2 n a 31 a 32 a 33 … a 3 n ⋮ ⋮ ⋮ ⋱ ⋮ a n 1 a n 2 a n 3 … a n n | = a 11 | a 22 a 23 … a 2 n a 32 a 33 … a 3 n ⋮ ⋮ ⋱ ⋮ a n 2 a n 3 … a n n | − a 12 | a 21 a 23 … a 2 n a 31 a 33 … a 3 n ⋮ ⋮ ⋱ ⋮ a n 1 a n 3 … a n n | + ⋯ ± a 1 n | a 21 a 23 … a 2 ( n − 1 ) a 31 a 33 … a 3 ( n − 1 ) ⋮ ⋮ ⋱ ⋮ a n 1 a n 3 … a n ( n − 1 ) | {\displaystyle {\begin{aligned}&\det(\mathbf {A} )={\begin{vmatrix}a_{11}&a_{12}&a_{13}&\dots &a_{1n}\\\a_{21}&a_{22}&a_{23}&\dots &a_{2n}\\\a_{31}&a_{32}&a_{33}&\dots &a_{3n}\\\\\vdots &\vdots &\vdots &\ddots &\vdots \\\a_{n1}&a_{n2}&a_{n3}&\dots &a_{nn}\end{vmatrix}}\\\&=a_{11}{\begin{vmatrix}a_{22}&a_{23}&\dots &a_{2n}\\\a_{32}&a_{33}&\dots &a_{3n}\\\\\vdots &\vdots &\ddots &\vdots \\\a_{n2}&a_{n3}&\dots &a_{nn}\end{vmatrix}}-a_{12}{\begin{vmatrix}a_{21}&a_{23}&\dots &a_{2n}\\\a_{31}&a_{33}&\dots &a_{3n}\\\\\vdots &\vdots &\ddots &\vdots \\\a_{n1}&a_{n3}&\dots &a_{nn}\end{vmatrix}}+\dots \pm a_{1n}{\begin{vmatrix}a_{21}&a_{23}&\dots &a_{2(n-1)}\\\a_{31}&a_{33}&\dots &a_{3(n-1)}\\\\\vdots &\vdots &\ddots &\vdots \\\a_{n1}&a_{n3}&\dots &a_{n(n-1)}\end{vmatrix}}\end{aligned}}}

In short, the determinant of a matrix  A {\displaystyle \mathbf {A} } has the value

det ( A ) = ∑ i = 1 n ( − 1 ) i + j a i j M i j {\displaystyle {\det(\mathbf {A} )=\sum _{i=1}^{n}(-1)^{i+j}a_{ij}M_{ij}}}

where  M i j {\displaystyle M_{ij}} is the determinant of the submatrix of  A {\displaystyle \mathbf {A} } formed by eliminating row  i {\displaystyle i} and column  j {\displaystyle j} from  A {\displaystyle \mathbf {A} } .

Mathematics Cramer's Rule

| Subject classification: this is a mathematics resource.

|

| Educational level: this is a secondary education resource.

|

| Educational level: this is a tertiary (university) resource.

|

## Cramers Rule

[edit | edit source]

Now we're going to unify our (basic) knowledge of turning a set of linear equations into a matrix, and calculating their determinant, as a method for solving linear equations.

Cramer's rule is an elegant formula for the solutions of a system of linear equations. A typical linear system (also known as a set of "simultaneous linear equations") is a set of N linear equations in N variables (or "unknowns".)

For N=3, it might look like this:

A x + B y + C z = P {\displaystyle Ax+By+Cz=P\,}
D x + E y + F z = Q {\displaystyle Dx+Ey+Fz=Q\,}
G x + H y + I z = R {\displaystyle Gx+Hy+Iz=R\,}

The numbers A...I (the "coefficient matrix") are given, as are the numbers P, Q, R (the "right-hand-sides".) The values of x, y, z (the "unknowns") are to be found. A system of N linear equations in N unknowns has a uniquely determined solution except in unusual circumstances (the coefficient matrix having determinant zero, as will be shown below.)

If the number of equations were greater than the number of unknowns, there would be no solutions except in unusual circumstances. If the number of equations were less than the number of unknowns, there would be infinitely many solutions. Neither of those cases is covered by Cramer's rule.

Cramer's rule gives the solution in terms of the determinants of the coefficient matrix and the coefficient matrix with individual columns replaced. It says that the value of the nth unknown is the quotient of the determinant of the coefficient matrix with its nth column replaced by the right-hand-side numbers, divided by the determinant of the unmodified coefficient matrix.

For the 3-equation example given above:

x = | P B C Q E F R H I | | A B C D E F G H I |         y = | A P C D Q F G R I | | A B C D E F G H I |         z = | A B P D E Q G H R | | A B C D E F G H I | {\displaystyle x={\frac {\begin{vmatrix}\color {Red}P&B&C\\\\\color {Red}Q&E&F\\\\\color {Red}R&H&I\end{vmatrix}}{\begin{vmatrix}A&B&C\\\D&E&F\\\G&H&I\end{vmatrix}}}\ \ \ \ y={\frac {\begin{vmatrix}A&\color {Red}P&C\\\D&\color {Red}Q&F\\\G&\color {Red}R&I\end{vmatrix}}{\begin{vmatrix}A&B&C\\\D&E&F\\\G&H&I\end{vmatrix}}}\ \ \ \ z={\frac {\begin{vmatrix}A&B&\color {Red}P\\\D&E&\color {Red}Q\\\G&H&\color {Red}R\end{vmatrix}}{\begin{vmatrix}A&B&C\\\D&E&F\\\G&H&I\end{vmatrix}}}}

This works for any number of equations.

## Basic examples

[edit | edit source]

Now, let's try that with our previous two examples:

Let's do the simpler one first:

[ 3 − 1 14 2 1 11 ] {\displaystyle \left[{\begin{array}{ccc}3&-1&14\\\2&1&11\end{array}}\right]}

The Coefficient matrix is given as:
[ 3 − 1 2 1 ] {\displaystyle \left[{\begin{array}{ccc}3&-1\\\2&1\end{array}}\right]}

As per Cramer's Rule, the variable of the nth column can be solved by taking the determinant of the matrix with the nth column replaced with the solution, and dividing it by the coefficient matrix. Let's do that. Lets first write out the matrix for calculating the first columns variable,  x {\displaystyle x} . Substituting the solutions (14 and 11) into the first column gives us the matrix:

[ 14 − 1 11 1 ] {\displaystyle \left[{\begin{array}{ccc}14&-1\\\11&1\end{array}}\right]}

Now, we need to divide the matrix with the substitution by the original matrix:

[ 14 − 1 11 1 ] [ 3 − 1 2 1 ] = 14 ∗ 1 − ( − 1 ∗ 11 ) 3 ∗ 1 − ( − 1 ∗ 2 ) = 25 5 = 5 {\displaystyle {\frac {\left[{\begin{array}{cc}14&-1\\\11&1\end{array}}\right]}{\left[{\begin{array}{cc}3&-1\\\2&1\end{array}}\right]}}={\frac {14*1-(-1*11)}{3*1-(-1*2)}}={\frac {25}{5}}=5}

From this we can see that the value of the variable in the first column,  x {\displaystyle x} is equal to 5.

Now let's do the same for the second column. Replacing the -1 and 1 with the 14 and 11, and dividing the determinants:

[ 3 14 2 11 ] [ 3 − 1 2 1 ] = 3 ∗ 11 − ( 14 ∗ 2 ) 3 ∗ 1 − ( − 1 ∗ 2 ) = 5 5 = 1 {\displaystyle {\frac {\left[{\begin{array}{cc}3&14\\\2&11\end{array}}\right]}{\left[{\begin{array}{cc}3&-1\\\2&1\end{array}}\right]}}={\frac {3*11-(14*2)}{3*1-(-1*2)}}={\frac {5}{5}}=1}
From this we can see that the value of the variable in the second column,  y {\displaystyle y} is equal to 1.