THE UNIVERSITY OF JORDAN
School of Engineering
Department of Civil Engineering
(0951301): Numerical Methods
Dr. Ramia Al-Ajarmeh
Gauss Elimination
Roots of System of Linear Algebraic Equations
Refer to the Textbook, Chapters 9, 10, 11 & 12
Methods for solving roots of system of linear algebraic equations:
• Gauss Elimination: Cramer’s Rule, Naïve Gauss Elimination
and Gauss Jordan (Textbook: Chapter 9)
• LU Decomposition (Textbook: Chapter 10)
• Gauss-Seidel and Jacobi’s iterative methods (Textbook:
Chapter 11)
• Civil Engineering Case Study (Textbook: Chapter 12 / Truss
Analysis)
Gauss Elimination
Refer to the Textbook, Chapter 9
Solving small numbers of equations (2 or 3 equations):
• Graphical solution
• Cramer’s Rule: Solution technique which is best suited to small
numbers of equations.
Solving larger numbers of equations (more than 3 equations):
• Naïve Gauss Elimination
• Gauss-Jordan
Cramer’s Rule
• The Concept of the determinant is used to implement Cramer’s
rule.
• Determinant (e.g. three equations):
[A]{X} = {B}
a11 a12 a13
[A] = a21 a22 a23
a31 a32 a33
Determinant of this system is formed from the coefficients of the
equations:
a11 a12 a13
D = a21 a22 a23
a31 a32 a33
[A] And D are different
Cramer’s Rule
(2nd Order)
a11 a12
D= is calculated by: D = (a11) (a22) – (a12) (a21)
a21 a22
(3rd Order)
a22 a23 a a a a
D = a11 - a12 21 23 + a13 21 22
a32 a33 a31 a33 a31 a32
Cramer’s Rule:
a11 X1 + a12 X2 + a13 X3 = b1
a21 X1 + a22 X2 + a23 X3 = b2
a31 X1 + a32 X2 + a33 X3 = b3
b1 a12 a13
b2 a22 a23
b3 a32 a33
X1 = same for X2 and X3
D
Cramer’s Rule
Example:
Solve the system with three variables using Cramer’s rule:
X1 + 2 X2 + 3X3 = -5
3 X1 + X2 - 3X3 = 4
-3 X1 + 4 X2 + 7X3 = -7
Solution:
1 2 3
D = 3 1 −3 = 40
−3 4 7
−5 2 3 1 −5 3
X1 = 4 1 −3 / 40 = -1, X2 = 3 4 −3 / 40 = 1,
−7 4 7 −3 −7 7
1 2 −5
X3 = 3 1 4 / 40 = -2
−3 4 −7
Cramer’s Rule
Exercise:
Solve the system with three variables using Cramer’s rule:
-2X1 - X2 - 3X3 = 3
2X1 - 3X2 + X3 = -13
2X1 - 3X3 = -11
Cramer’s Rule vs. Elimination of Unknowns
• For more than 3 equations, Cramer’s rule becomes impractical,
D- computations are time consuming.
• Alternative: the elimination of unknowns.
• Strategy (2 equations): to multiply the equations by constants
so that one of the unknowns will be eliminated when the two
equations are combined, this will result single equation that can
be solved for the remaining unknown.
Elimination of Unknowns
(non-computer solution method)
Elimination of Unknowns
Example:
Solve this system of equations by elimination:
X1 + X2 = 4
2X1 - 3X2 = 6
Solution:
2X1 + 2X2 = 8
-
2X1 - 3X2 = 6
-------------------------
5X2 = 2
X2 = 0.4
X1 = 3.6
Elimination of unknowns can be extended to systems with more
than two or three equations → by programming
Naïve Gauss Elimination
• Develop systematic scheme or algorithm to eliminate
unknowns and to back-substitute.
• Gauss elimination → most basic of these schemes.
• The technique for (n) equations consists of two phases:
✓ Elimination of unknowns (forward elimination)
✓ Solution through back substitution
• Suited for implementation on computers.
• It’s called “Naïve” because it does not avoid the problem of
division by zero.
Naïve Gauss Elimination
• The approach is designed to solve a general set of n
equations:
• The first phase is designed to reduce the set of equations to an
upper triangular system. The initial step will be to eliminate the
first unknown, x1, from the second through the nth equations.
• The procedure is then repeated for the remaining equations.
• The first equation in the system is called “pivot equation” and
the coefficient a11 is called “pivot coefficient or element”.
Naïve Gauss Elimination
Naïve Gauss Elimination
Example:
A civil engineer involved in construction requires 4800, 5800, and
5700 m3 of sand, fine gravel, and coarse gravel respectively for a
building project. There are three pits from which these materials can
be obtained, the composition of these pits is:
Sand % Fine gravel % Coarse gravel %
Pit 1 55 30 15
Pit 2 25 45 30
Pit 3 25 20 55
How many cubic meters must be hauled from each pit in order to
meet the engineer’s needs? (Use Naïve Gauss elimination)
Naïve Gauss Elimination
Example Solution:
Naïve Gauss Elimination
Example Solution:
Naïve Gauss Elimination
Example Solution:
Naïve Gauss Elimination
Pitfalls of Naïve Gauss elimination:
• Division by zero
• Round-off errors
• ill-conditioned systems
Naïve Gauss Elimination
Pitfalls of Naïve Gauss elimination:
• ill-conditioned systems:
✓ They are those where small changes in coefficients results
in large changes in solution (i.e. a wide range of answers
can approximately satisfy the equations).
✓ Because round-off errors can induce small changes in the
coefficients, these artificial changes can lead to large
solution errors for ill-conditioned systems.
Naïve Gauss Elimination
Pitfalls of Naïve Gauss elimination:
• ill-conditioned systems:
Example:
solve the following systems:
X1 + 2X2 = 10 X1 + 2X2 = 10
1.1X1 + 2X2 = 10.4 1.05X1 + 2X2 = 10.4
X1 = 4, X2 = 3 X1 = 8, X2 = 1
Gauss-Jordan Method
• The Gauss-Jordan method is a variation of Gauss
elimination.
• The major difference is that when an unknown is eliminated in
the Gauss-Jordan method, it is eliminated from all other
equations rather than just the subsequent ones.
• All rows are normalized by dividing them by their pivot
elements. Thus, the elimination step results in an identity
matrix rather than a triangular matrix.
• It is not necessary to employ back substitution to obtain the
solution.
Gauss-Jordan Method
The superscript (n) means that
the elements of the right-hand
side vector have been modified n
times. (for this case, n = 3)
Gauss-Jordan Method
Example:
Use Gauss-Jordan to solve the following system of linear equations:
2y + Z = 4
X + y + 2Z = 6
2X + y + Z = 7
Gauss-Jordan Method
Example Solution:
Gauss-Jordan Method
Example Solution: