You are on page 1of 35

Mathematics I

Pharmaceutical
Engineering

MATH 102
Lecture 17

Dr. Phoebe Edward Nashed


Lecture 17 - Outline
1. Introduction to LSE – Graphical Representation
2. Gauss Elimination and Gauss–Jordan methods
3. The Rank Theorem
4. Applications
 Chemical Reactions
 Traffic Flow

Dr. Phoebe Edward 2


Introduction to Solving LSE
 For a simple LSE such as the following
3 𝑥1 + 2 𝑥2 = 18
−𝑥1 + 2 𝑥2 = 2
 We can rewrite each of the equations in the form of the equation of
a straight line and then plot them on a single graph
3
𝑥2 = 9 − 𝑥1
2
1
𝑥2 = 1 + 𝑥1
2
 The solution would then be the intersection of the 2 lines, at 𝑥1 = 4
and 𝑥2 = 3 (see Fig. in the next slide)

Dr. Phoebe Edward 3


Introduction to Solving LSE - Graphically

 Graphical solution of a set of 2 simultaneous linear algebraic equations. The


intersection of the lines represents the solution.
 Source: Chapra, Canale, Numerical Methods for Engineers, 6th Ed. McGraw–Hill.

Dr. Phoebe Edward 4


Examples of 2D LSE

Dr. Phoebe Edward 5


Introduction – Graphical representation
of LSE Solution

 The above figure depicts 3 cases that can pose problems when solving sets of
linear equations.
 Two parallel lines represent a case of no solutions, as the lines never cross (as
shown in Figure number (a)).
 Two coincident lines represent a case of an infinite number of solutions (as shown
in Figure number (b)).
 Both of these cases are referred to as singular.
Dr. Phoebe Edward 6
Introduction – Graphical representation
of LSE Solution

 In addition, systems that are very close to being singular can also
cause problems. These are called ill–conditioned (as shown in Figure
number (c)).
 Graphically, it is very difficult to identify the exact point at which the
lines intersect in an ill–conditioned system.

Dr. Phoebe Edward 7


Introduction to Solving LSE - Graphically
 For 3 simultaneous equations,
each of them would be
represented by a plane in a 3D
coordinate system.
 The point where the 3 planes
intersect would represent the
solution.
 Beyond 3 equations, graphical
methods are no longer possible to
employ.
 However, graphical methods still
prove useful in visualizing
properties of the solutions.

Dr. Phoebe Edward 8


Consistent and Inconsistent LSE

Dr. Phoebe Edward 9


Augmented Matrices From LSE
 A system of 𝑚 linear equations in 𝑛 variables

can be written in matrix form as 𝐴 𝒙 = 𝒃, such that

Dr. Phoebe Edward 10


Augmented Matrix

 This form can be further changed into what is called an augmented


matrix

Dr. Phoebe Edward 11


Equivalent LSE
 2 LSE are called equivalent if they have precisely the same solution
set.
 Note that each of the following operations on a LSE produces an
equivalent system:
1. Interchanging 2 equations.
2. Multiplying an equation by a non–zero constant.
3. Adding a multiple of an equation to another equation.

Dr. Phoebe Edward 12


Examples of Equivalent LSE
 The following LSEs are equivalent, as the first 2 equations are
interchanged
2𝑥 + 𝑦 + 𝑧 = 1 3𝑥 + 2𝑦 + 𝑧 = 2
3𝑥 + 2𝑦 + 𝑧 = 2 | 2𝑥 + 𝑦 + 𝑧 = 1
2𝑥 + 𝑦 + 2𝑧 = −1 2𝑥 + 𝑦 + 2𝑧 = −1
 The following LSEs are equivalent, as the first equation of the LSE
on the right is simply multiplied by 2
2𝑥 + 𝑦 + 𝑧 = 1 4𝑥 + 2𝑦 + 2𝑧 = 2
3𝑥 + 2𝑦 + 𝑧 = 2 | 3𝑥 + 2𝑦 + 𝑧 = 2
2𝑥 + 𝑦 + 2𝑧 = −1 2𝑥 + 𝑦 + 2𝑧 = −1

Dr. Phoebe Edward 13


Examples of Equivalent LSE
 The following LSEs are equivalent, as the first and second equations
of the LSE on the left are added together, resulting in the first
equation of the LSE on the right
2𝑥 + 𝑦 + 𝑧 = 1 5𝑥 + 3𝑦 + 2𝑧 = 3
3𝑥 + 2𝑦 + 𝑧 = 2 | 3𝑥 + 2𝑦 + 𝑧 = 2
2𝑥 + 𝑦 + 2𝑧 = −1 2𝑥 + 𝑦 + 2𝑧 = −1

Dr. Phoebe Edward 14


Elementary Row Operations
 In dealing with an augmented matrix, we can carry out the
following elementary row operations:
1. Interchange 2 rows: 𝑅𝑖 ↔ 𝑅𝑗
2. Multiply a row by a non–zero constant: 𝑘 𝑅𝑖 → 𝑅𝑖
3. Add a multiple of a row to another row: 𝑘 𝑅𝑖 + 𝑅𝑗 → 𝑅𝑗
 2 matrices are said to be row equivalent if one can be obtained from
the other by a finite sequence of elementary row operations (EROs)

Dr. Phoebe Edward 15


Row–Echelon Form and Reduced Row–
Echelon Form
 To obtain the row–echelon form of a matrix, carry out steps 1, 2 and 3:
 To obtain the reduced row–echelon form of a matrix, carry out steps 1, 2, 3 and
4:
1. All rows consisting entirely of zeros occur at the bottom of the matrix.
2. For each row that does not consist entirely of zeros, the first non–zero entry is 1
(we call this a leading 1 or a pivot).
3. For 2 successive non–zero rows, the leading 1 in the higher row is farther to the
left than the leading 1 in the lower row (stair-case).
4. Every column that has a leading 1 has zeros in every position above and below its
leading 1.
1 2 5 7 1 0 0 7
0 1 −3 8 0 1 0 8
ተ ተ
0 0 1 −9 0 0 1 −9
0 0 0 0 0 0 0 0
Row-Echelon Form Reduced Row-Echelon Form
Dr. Phoebe Edward 16
Examples
 Which is row-Echelon Form and which is in reduced row-Echelon
Form ?
Row-Echelon Row-Echelon

Reduced Row- Row-Echelon


Echelon

Reduced Row- Reduced Row-


Echelon Echelon

Dr. Phoebe Edward 17


Gauss and Gauss–Jordan Elimination
Methods
 Gauss elimination: the process of reducing a matrix to its row–
echelon form
 Gauss–Jordan elimination: the process of reducing a matrix to its
reduced row–echelon form
 Notes:
 Every matrix has a unique reduced row–echelon form
 A row–echelon form of a given matrix is not unique, as different sequences of
row operations can produce different row–echelon forms

Dr. Phoebe Edward 18


Exercise 1
 Solve the following LSE using the Gauss–Jordan elimination method
𝑥 − 2𝑦 + 3𝑧 = 9
−𝑥 + 3𝑦 = −4
2𝑥 − 5𝑦 + 5𝑧 = 17

Dr. Phoebe Edward 19


Exercise 1 – Sol.
 We start off by forming the augmented matrix
𝑥 − 2𝑦 + 3𝑧 = 9 1 −2 3 9
−𝑥 + 3𝑦 = −4 → −1 3 0 | −4
2𝑥 − 5𝑦 + 5𝑧 = 17 2 −5 5 17
 Next, we carry out a number of elementary row operations, to reach
the row–echelon form
1 −2 3 9 1 −2 3 9
𝑅1 + 𝑅2 → 𝑅2 0 1 3 | 5 − 2R1 + R 3 → R 3 0 1 3 | 5
2 −5 5 17 0 −1 −1 −1
1 −2 3 9 1 1 −2 3 9
𝑅2 + 𝑅3 → 𝑅3 0 1 3 |5 𝑅3 → 𝑅3 0 1 3 | 5
2
0 0 2 4 0 0 1 2
Row-Echelon Form
Dr. Phoebe Edward 20
Exercise 1 – Sol.
 We continue carrying out the necessary elementary row operations,
to reach the reduced row–echelon form:
1 −2 3 9 1 0 9 19
0 1 3 |5 2𝑅2 + 𝑅1 → 𝑅1 0 1 3 | 5
0 0 1 2 0 0 1 2
1 0 9 19 1 0 0 1
−3𝑅3 + 𝑅2 → 𝑅2 0 1 0 | −1 − 9𝑅3 + 𝑅1 → 𝑅1 0 1 0 | −1
0 0 1 2 0 0 1 2
Reduced Row-Echelon Form

 Thus, the variables are 𝑥 = 1, 𝑦 = −1 and 𝑧 = 2.

Dr. Phoebe Edward 21


Exercise 2
 Solve the following LSE using the Gauss–Jordan elimination method
2𝑥1 + 4𝑥2 − 2𝑥3 = 0
3𝑥1 + 5𝑥2 = 1

Dr. Phoebe Edward 22


Exercise 2 – Sol.
 We start off by forming the augmented matrix
2𝑥1 + 4𝑥2 − 2𝑥3 = 0 2 4 −2 0
→ |
3𝑥1 + 5𝑥2 = 1 3 5 0 1
 Next, we carry out a number of elementary row operations, to reach
the row–echelon form
1 1 2 −1 0 1 2 −1 0
𝑅1 → 𝑅1 | − 3R1 + R 2 → R 2 |
2 3 5 0 1 0 −1 3 1
1 2 −1 0
−𝑅2 → 𝑅2 |
0 1 −3 −1
Row-Echelon Form

Dr. Phoebe Edward 23


Exercise 2 – Sol.
 We continue carrying out the necessary elementary row operations, to reach the
reduced row–echelon form:
1 2 −1 0 1 0 5 2
| − 2𝑅2 + 𝑅1 → 𝑅1 |
0 1 −3 −1 0 1 −3 −1
Reduced Row-Echelon Form
 Now with the augmented matrix in the reduced row–echelon form, its
corresponding LSE is
𝑥1 + 5𝑥3 = 2
𝑥2 − 3𝑥3 = −1
 N.B. The number of variables are greater than the number of equations (non-zero
rows), therefore there are infinitely many solutions:
 such that the leading variables are 𝑥1 and 𝑥2, while 𝑥3 is the free variable:
𝑥1 = 2 − 5𝑥3
𝑥2 = −1 + 3𝑥3

Dr. Phoebe Edward 24


Exercise 2 – Sol.
𝑥1 = 2 − 5𝑥3
𝑥2 = −1 + 3𝑥3
 By letting 𝑥3 = 𝑡, we can represent the variables as
𝑥1 = 2 − 5𝑡
𝑥2 = −1 + 3𝑡
𝑥3 = 𝑡, 𝑡∈ℝ
 Thus, this LSE has infinitely many solutions
 A common way of representing the variables is
𝑥1 2 − 5𝑡 2 −5
𝒙 = 𝑥2 = −1 + 3𝑡 = −1 + 𝑡 3 , 𝑡∈ℝ
𝑥3 𝑡 0 1

Dr. Phoebe Edward 25


Applications
 Solutions of LSEs have a wide array of applications in science and
engineering
 Applications include:
1. Balancing chemical equations
2. Traffic Flow

Dr. Phoebe Edward 26


Applications: Balancing Chemical
Equations

 When methane gas (𝐶𝐻4 ) combines with oxygen (𝑂2 ) and burns,
carbon dioxide (𝐶𝑂2 ) and water (𝐻2 𝑂) form
 Chemists represent this process by a chemical equation of the form
𝑥1 𝐶𝐻4 + 𝑥2 𝑂2 → 𝑥3 𝐶𝑂2 + 𝑥4 𝐻2 𝑂

Dr. Phoebe Edward 27


Applications: Balancing Chemical
Equations
𝑥1 𝐶𝐻4 + 𝑥2 𝑂2 → 𝑥3 𝐶𝑂2 + 𝑥4 𝐻2 𝑂
 Because a chemical reaction can neither create nor destroy atoms,
all of the atoms represented on the left side of the arrow must be
accounted for on the right side of the arrow.
 This is called balancing the chemical equation.
 Example: Balance the above chemical equation (i.e. find the values
of 𝑥1 , 𝑥2 , 𝑥3 and 𝑥4 that would balance the chemical equation).

Dr. Phoebe Edward 28


Applications: Balancing Chemical
Equations – Example – Sol.
𝑥1 𝐶𝐻4 + 𝑥2 𝑂2 → 𝑥3 𝐶𝑂2 + 𝑥4 𝐻2 𝑂
 𝐶: 𝑥1 = 𝑥3
 𝐻: 4𝑥1 = 2𝑥4
 𝑂: 2𝑥2 = 2𝑥3 + 𝑥4
 Now we have a LSE in the form
𝑥1 − 𝑥3 = 0
4𝑥1 − 2𝑥4 = 0
2𝑥2 − 2𝑥3 − 𝑥4 = 0

Dr. Phoebe Edward 29


Applications: Balancing Chemical
Equations – Example – Sol.
𝑥1 − 𝑥3 = 0
4𝑥1 − 2𝑥4 = 0
2𝑥2 − 2𝑥3 − 𝑥4 = 0
 Next, we can use Gauss-Jordan elimination to solve this LSE
1 0 −1 0 0 1 0 −1 0 0
4 0 0 −2 | 0 − 4𝑅1 + 𝑅2 → 𝑅2 0 0 4 −2 | 0
0 2 −2 −1 0 0 2 −2 −1 0
1 0 −1 0 0 1 1 0 −1 0 0
𝑅2 ↔ 𝑅3 0 2 −2 −1 | 0 𝑅2 → 𝑅2 0 1 −1 −1/2 | 0
2
0 0 4 −2 0 0 0 4 −2 0
1 1 0 −1 0 0
𝑅3 → 𝑅3 0 1 −1 −1/2 | 0
4 0 0 1 −1/2 0
Row-Echelon Form
Dr. Phoebe Edward 30
Applications: Balancing Chemical
Equations – Example – Sol.
1 0 −1 0 0
0 1 −1 −1/2 | 0
0 0 1 −1/2 0
1 0 −1 0 0 1 0 0 −1/2 0
𝑅3 + 𝑅2 → 𝑅2 0 1 0 −1 | 0 𝑅3 + 𝑅1 → 𝑅1 0 1 0 −1 | 0
0 0 1 −1/2 0 0 0 1 −1/2 0
Reduced Row-Echelon Form
 Now, we let 𝑥4 = 𝑡, 𝑡 ∈ ℝ, then
1
𝑥1 = 𝑡
2
𝑥2 = 𝑡
1
𝑥3 = 𝑡
2

Dr. Phoebe Edward 31


Applications: Balancing Chemical
Equations – Example – Sol.
 Now, we let 𝑥4 = 𝑡, 𝑡 ∈ ℝ, then
1
𝑥1 = 𝑡
2
𝑥2 = 𝑡
1
𝑥3 = 𝑡
2
 This system has infinitely many solutions, which means that there are infinitely many
choices for balancing this chemical equation.
 The solution can be written in the form:
𝑥1 1/2
𝑥2 1
𝑥3 = 𝑡 ,𝑡 ∈ ℝ
1/2
𝑥4 1

Dr. Phoebe Edward 32


Rank of a Matrix
 The rank of a matrix is the number of non–zero rows in its row–
echelon form (or reduced row echelon form).
 Rank theorem: Let A be the coefficient matrix of a system of linear
equations with n variables. If the system is consistent, then
 the number of free variables = n - rank(A)

Dr. Phoebe Edward 33


Rank and Linear Systems
 For a non–homogeneous LSE if 𝐴 and [𝐴 |𝑏] are the coefficients matrix and
the augmented matrix of this system, respectively, then we have the
following conclusions:
1. If 𝑟𝑎𝑛𝑘(𝐴) < 𝑟𝑎𝑛𝑘([𝐴 |𝑏]) → The system is inconsistent (has no solutions).
2. If 𝑟𝑎𝑛𝑘(𝐴) = 𝑟𝑎𝑛𝑘([𝐴 |𝑏]) = 𝑛, where 𝑛 is the number of variables → The
system has a unique solution.
3. If 𝑟𝑎𝑛𝑘(𝐴) = 𝑟𝑎𝑛𝑘([𝐴 |𝑏]) < 𝑛 → The system has infinitely many solutions
and the number of free variables = n - rank(A).

Dr. Phoebe Edward 34


Thank You 

Dr. Phoebe Edward 35

You might also like