Chapter two
1. System of Linear Equations
1.1. Matrix representation of linear equations
One of the uses of matrix algebra is to find solution for a system of linear equations. Therefore,
for a system of equations where the number of equations equals the number of variables involved
we can have a solution using matrix algebra, expressing the equations in their matrix equivalent.
Consider; 3X+4Y-2Z=10
X+2Y-Z = 2
5X-3Y+2Z= -5…………………………………………….. (2.1)
The above systems of equations could be represented by using matrices as;
3 4 −2 𝑥 10
(1 2 −1) (𝑦) = ( 2 )
5 −3 2 𝑧 −5
1.2. Solving system of linear equations
2.1.1. Cramer rule
Cramer’s rule provides a simplified method of solving a system of linear equations by using
determinants. Given a system of linear equations with equal number of equations and variables
where the matrix expression is given as;
AX=B……where, A = the coefficient matrix
X = the variable matrix
B = the constant matrix
Cramer’s rule states that
|𝐴𝑖 |
𝑋𝑖 =
|𝐴|
Where, 𝑋𝑖 = the ith unknown variable i9n the series of equations
|𝐴| = the determinant of the original coefficient matrix
|𝐴𝑖 | =the determinatnt of a special matrix formed from the original coefficient matrix A by
replacing the coefficients of 𝑋𝑖 with the column vector of constants.
Given; 𝑎𝑥1 + 𝑏𝑥2 = ℎ
𝑐𝑥1 + 𝑑𝑥2 = 𝑔
The equations can be represented as;
𝑎 𝑏 𝑥1 ℎ 𝑎 𝑏
( ) (𝑥 ) = ( )……….where, | |≠0
𝑐 𝑑 2 𝑔 𝑐 𝑑
1
ℎ 𝑏
| | ℎ𝑑 − 𝑔𝑏
𝑔 𝑑
𝑥1 = =
𝑎 𝑏 𝑎𝑑 − 𝑏𝑐
| |
𝑐 𝑑
𝑎 ℎ
| | 𝑎𝑔 − 𝑐ℎ
𝑐 𝑔
𝑥2 = =
𝑎 𝑏 𝑎𝑑 − 𝑏𝑐
| |
𝑐 𝑑
Example-1; Solve using Cramer’s rule:
2x + y – z = 0
x+y+z=0
y–z=1
A = +2 1 1 -1 1 1 + (-1) 1 1
1 -1 0 -1 0 1 = -4
Example: Solve the following system of equations using Cramer’s rule.
6𝑥1 + 5𝑥2 = 49
3𝑥1 + 4𝑥2 = 32
2
Exercise: Solve the following system of equations using Cramer’s rule.
1. 7𝑝1 − 𝑝2 − 𝑝3 = 0
10𝑝1 − 2𝑝2 + 𝑝3 = 8
6𝑝1 + 3𝑝2 − 2𝑝3 = 7
2.1.2. Inverse method
If a given system of linear equations is expresses as; AX = B, pre-multiplying both sides by A-1
gives, A-1 AX = A-1 B hence X = A-1 B.
Example: use inversion method to solve the system of linear equations below.
6𝑥1 + 5𝑥2 = 49
3𝑥1 + 4𝑥2 = 32
Example 2: solve the following sets of equations using inversion method.
7𝑝1 − 𝑝2 − 𝑝3 = 0
10𝑝1 − 2𝑝2 + 𝑝3 = 8
6𝑝1 + 3𝑝2 − 2𝑝3 = 7
Exercise: find the solution for the following system of linear equations by using Cramer’s rule or
inversion method.
1. 3x+4y-2z=10
X+2y-z = 2
5x-3y+2z = -5
2. 11𝑝1 − 𝑝2 − 𝑝3 = 31
𝑝1 − 6𝑝2 − 2𝑝3 = 26
−2𝑝2 + 7𝑝3 − 𝑝1 = 24
3. 2𝑥1 + 3𝑥2 + 4𝑥3 = 16
𝑥2 = 8 − 8𝑥3 − 𝑥1
𝑥1 + 𝑥3 = 8 − 2𝑥2
4. 2𝑥1 + 2𝑥2 + 3𝑥3 = 3
𝑥2 + 𝑥3 = 2
𝑥1 + 𝑥2 + 𝑥3 = 4
3
2.1.3. Gaussian elimination
Suppose we have the following set of equations
𝑋 + 2𝑦 − 𝑧 = 2
3𝑥 + 4𝑦 − 2𝑧 = 10
5𝑥 − 3𝑦 + 2𝑧 = −5 …………………………………2.2.
We first try to eliminate x from the last two equations by adding to each of these equations a proper
multiple of the first equation. To eliminate the 3x term in (2.2), we multiply [2.2a) by -3 and add
this new equation to (2.2b). The result is the following calculation:
−3𝑥 − 6𝑦 + 3𝑧 = −6
3𝑥 + 4𝑦 − 2𝑧 = 10
−2𝑦 + 𝑧 = 4
Similarly, by adding -5 times (2.2a) to (2.2c), we obtain a new third equation −13𝑦 + 7𝑧 = −15.
Our system is transformed to give;
𝑥 + 2𝑦 − 𝑧 = 2
−2𝑦 + 𝑧 = 4
−13𝑦 + 7𝑧 = −15……………………………………2.3
In transforming system of equations (from 2.2 to 2.3) we used only one operation: we added a
multiple of one equation to another. This operation is reversible. There are two other reversible
operations one often uses to transform a system of equations: 1) multiplying both sides of an
equation by a nonzero scalar and 2) interchanging two equations.
These three operations are called the elementary equation operations. Since equals arc always
added to or subtracted from equals or multiplied by the same scalar, the set of solutions which
solve the original system will also solve the transformed system. In fact, since these three
operations are reversible, any solution of the transformed system will also be a solution of the
original system. Consequently, both systems will have the exact same set of solutions.
Fact: if one system of linear equations is derived from another by elementary equation operations,
then both systems have the same solutions; that is, the systems are equivalent.
Let us return to our elimination procedure and continue working on system (2.3). Having
eliminated x from the last two equations, we now want to eliminate y from the last equation. Hence
we will get;
𝑥 + 2𝑦 − 𝑧 = 2
4
−2𝑦 + 𝑧 = 4
1
𝑧 = −41……………………………………2.4
2
Since each equation in (2.4) has one fewer variable than the previous one, this system is
particularly amenable to solution by substitution. Using the so called back substitution method we
solve [2.4], hence 𝑧 = −82, 𝑦 = −43 𝑎𝑛𝑑 𝑥 = 6.
This method of reducing a given system of equations by adding a multiple of one equation to
another or by interchanging equations until one reaches a system of the form (2.4) and then solving
(2.4) via back substitution is called Gaussian elimination. The important characteristic of system
(2.4) is that each equation contains fewer variables than the previous equation. At each stage of
the Gaussian elimination process, we want to change some coefficient of our linear system to 0 by
adding a multiple of an earlier equation to the given one.
For example, if you want to use the coefficient 𝑎3𝑘 , in the third equation to eliminate the
coefficient 𝑎5𝑘 in the fifth equation, we add (-- 𝑎5𝑘 / 𝑎3𝑘 ) times the third equation to the fifth
equation, to get a new fifth equation whose kth coefficient is 0. The coefficient 𝑎3𝑘 is then called
a pivot. And we say that we “pivot on 𝑎3𝑘 to eliminate 𝑎5𝑘 .” At each stage of the elimination
procedure; we use a pivot to eliminate all coefficients directly below: it.
Zero can never be a pivot in this process. If you want to eliminate 𝑥𝑖 from a subsystem of
equations and if the coefficient of 𝑥𝑖 is zero in the first equation of this subsystem and nonzero
in a subsequent equation, you will have to reverse the order of these two equations before
proceeding.
2.1.4. Gauss-Jordan method (for n×n) system of equations
We did not use the operation of transforming an equation by simply multiplying it by a nonzero
scalar. There is a variant of Gaussian elimination, called Gauss- Jordan eliminations which use
all three elementary equation operations. This method starts like Gaussian elimination, by
transforming (2.2) to (2.4). After reaching system (2.4), multiply each equation in (2.4) by a scalar
so that the first nonzero coefficient is 1:
𝑥 + 2𝑦 − 𝑧 = 2
1
𝑦 − 𝑧 = −2
2
𝑧 = −82……………………………………2.5
5
Now, instead of using back substitution, use Gaussian elimination methods from the bottom
equation to the top to eliminate all but the first term on the left-hand side in each equation in (2.5).
This operation results in 𝑥 = 6, 𝑦 = −43 𝑎𝑛𝑑 𝑧 = −82, which needs no further work to see the
solution.
To use the gauss Jordan elimination method for solving linear equation systems, express the system
of linear equations as augmented matrix and apply repeated row operations to the augmented
matrix until the coefficient matrix is reduced to identity matrix. Then the solution can be read from
the remaining elements in the column vector. An augmented matrix (𝐴/𝐵) is the coefficient matrix
A with the column vector of constants B set alongside it separated by a line.
Example: ax+by = C
dx-ey = F
𝑎 𝑏 𝑥 𝐶
Then A = ( ) and X = (𝑦) and B=( ) the augmented matrix could be written as;
𝑑 −𝑒 𝐹
𝑎 𝑏 𝑐
A/B = ( )
𝑑 −𝑒 𝑓
If we use elementary row operations so that we generate the following matrix in the process;
1 0 ℎ
A/B = ( )
0 1 𝑔
The solution to the system will then be; x = h and y = g.
Example; solve the following system of linear equations by Gauss-Jordan elimination method.
a) 2𝑥1 + 3𝑥2 = 17
𝑥1 + 2𝑥2 = 10
b) 2𝑥1 + 2𝑥2 + 3𝑥3 = 3
𝑥2 + 𝑥3 = 2
𝑥1 + 𝑥2 + 𝑥3 = 4
The following are some possible scenarios which may result from Gauss-Jordan elimination result
for a system of n×n equations.
i. Unique solution exists
1 0 0 𝑎
(0 1 0 𝑏)
0 0 1 𝑐
ii. No solution may be obtained
6
1 0 0 𝑎
(0 1 𝑒 𝑏)
0 0 0 𝑐
example: 𝑥 + 𝑦 = 9
𝑥+𝑦 =8
Where a, b, c, e ≠ 0
iii. Infinite number of solutions may exist
1 0 𝑑 𝑎
(0 1 𝑒 𝑏)
0 0 0 0
𝑒𝑥𝑎𝑚𝑝𝑙𝑒: 2𝑥 + 𝑦 = 12
4𝑥 + 2𝑦 = 24
Where a, b, c, d, e ≠ 0
2.2. Economic applications
1. Assume there are two commodities in a market system of an economy. Suppose also that the
demand and supply functions of the two goods are provided below.
𝑄𝑑𝑥 = 10 − 2𝑝1 + 𝑝2
𝑄𝑑𝑦 = 15 + 𝑝1 − 𝑝2
𝑄𝑠𝑥 = −2 + 3𝑝1
𝑄𝑠𝑦 = −1 + 2𝑝2
What is the general equilibrium solution for the above two commodity market model?