Handout CIV 208 Analisis Numerik CIV 208 P4 5 6

Respect, Professionalism, & Entrepreneurship
Mata Kuliah : Analisis Numerik
Kode
: CIV - 208
SKS
: 3 SKS

Metode Eliminasi
Pertemuan – 4, 5, 6

Respect, Professionalism, & Entrepreneurship
• Sub Pokok Bahasan :
 Eliminasi Gauss
 Eliminasi Gauss Jordan
 Dekomposisi LU
 Iterasi Gauss-Seidel
 Iterasi Jacobi

Respect, Professionalism, & Entrepreneurship

• This topic deals with simultaneous linear algebraic

equations that can be represented generally as
a11.x1 + a12.x2 + … + a1n.xn = b1
a21.x1 + a22.x2 + … + a2n.xn = b2
……
an1.x1 + an2.x2 + … + ann.xn = bn

• where the a’s are constant coefficients and the b’s are
constants.
• The technique described in this chapter is called Gauss
elimination because it involves combining equations to
eliminate unknowns.

Respect, Professionalism, & Entrepreneurship

• Before proceeding to the computer methods,
we will describe several methods that are
appropriate for solving small (n≤3) sets of
simultaneous equations and that do not
require a computer.
• These are the graphical method, Cramer’s

rule, and the elimination of unknowns.

Respect, Professionalism, & Entrepreneurship

• For example : solve
3x1 + 2x2 = 18
- x1 + 2x2 = 2
• The solution is the
intersection of the two lines
at x1=4 and x2=3.
• This result can be checked by
substituting these values into
the original equations to yield
3(4)+2(3)=18
−(4)+2(3) =2

Respect, Professionalism, & Entrepreneurship

• Another method is use elimination
• The elimination of unknowns by combining

equations is an algebraic approach that can
be illustrated for a set of two equations:
a11x1+a12x2=b1 (1)
a21x1+a22x2=b2 (2)

Respect, Professionalism, & Entrepreneurship

• Eq. (1) might be multiplied by a21and Eq. (2)
by a11to give
a11a21x1+a12a21x2=b1a21 (3)
a21a11x1+a22a11x2=b2a11 (4)
• Subtracting Eq. (3) from Eq. (4) will, therefore,
eliminate the x1 term from the equations to
yield
a22a11x2−a12a21x2=b2a11−b1a21

Respect, Professionalism, & Entrepreneurship

• which can be solved for
x2 


a11b2  a 21b1
a11 a 22  a12 a 21

• x2 can then be substituted into Eq. (1), which can be
solved for
a 22b1  a12b2
x1 
a11 a22  a12 a 21

• example : Use the elimination to solve
3x1 + 2x2 = 18
- x1 + 2x2 = 2

Respect, Professionalism, & Entrepreneurship

Respect, Professionalism, & Entrepreneurship

Gauss Elimination
• In the previous section, the elimination of unknowns was used to solve

a pair of simultaneous equations. The procedure consisted of two steps:
1. The equations were manipulated to eliminate one of the unknowns
from the equations. The result of this elimination step was that we had
one equation with one unknown.
2. Consequently, this equation could be solved directly and the result
back-substituted into one of the original equations to solve for the
remaining unknown.
• This basic approach can be extended to large sets of equations by
developing a systematic scheme or algorithm to eliminate unknowns
and to back-substitute.
• Gauss elimination is the most basic of these schemes.

Respect, Professionalism, & Entrepreneurship

• The Gauss Elimination is designed to solve a
general set of n equations:
a11.x1 + a12.x2 + … + a1n.xn = b1
a21.x1 + a22.x2 + … + a2n.xn = b2
……
an1.x1 + an2.x2 + … + ann.xn = bn


(5.a)
(5.b)
(5.c)

• As was the case with the solution of two
equations, the technique for n equations
consists of two phases: elimination of unknowns
and solution through back substitution.

Respect, Professionalism, & Entrepreneurship
• The initial step will be to eliminate the first unknown, x1, from
the second through the nth equations.
• To do this, multiply Eq. (5.a) by a21/a11to give
a 21
a 21
a21
a21 x1 
a12 x2  ... 
a1n xn 

b1
a11
a11
a11

• Subtracted from Eq. (5.b) to give




a
a
a
 a 22  21 a12  x2  ...   a2 n  21 a1n  xn b2  21 b1
a11
a11
a11






• Or :

 x2  ...  a 2n x n b2
a 22

Respect, Professionalism, & Entrepreneurship

• The procedure is then repeated for the
remaining equations.
• For instance, Eq. (5.a) can be multiplied by
a31/a11and the result subtracted from the third
equation.
• Repeating the procedure for the remaining
equations results in the following modified
system:

Respect, Professionalism, & Entrepreneurship


a11.x1 + a12.x2 + a13.x3 + …. + a1n.xn = b1
a/22.x2 + a/23.x3 + …. + a/2n.xn = b/2
a/32.x2 + a/33.x3 + …. + a/3n.xn = b/3
………
a/n2.x2 + a/n3.x3 + …. + a/nn.xn = b/n

(6.a)
(6.b)
(6.c)
(6.d)

• Eq. (5.a) is called the pivot equation and a11 is
called the pivot coefficient or element

Respect, Professionalism, & Entrepreneurship

• Now repeat the above to eliminate the
second unknown from Eq. (6.c) through (6.d).
• To do this multiply Eq. (6.b) by a’32/a’22, and
subtract the result from Eq. (6.c).

• Perform a similar elimination for the
remaining equations to yield

Respect, Professionalism, & Entrepreneurship

a11.x1 + a12.x2 + a13.x3 + …. + a1n.xn = b1
a/22.x2 + a/23.x3 + …. + a/2n.xn = b/2
a//33.x3 + …. + a//3n.xn = b//3
………
a//n3.x3 + …. + a//nn.xn = b//n

• The procedure can be continued using the
remaining pivot equations.
• The final manipulation in the sequence is to
use the (n−1)th equation to eliminate the
xn−1term from the nth equation.

Respect, Professionalism, & Entrepreneurship
a11.x1 + a12.x2 + a13.x3 + …. + a1n.xn = b1
a/22.x2 + a/23.x3 + …. + a/2n.xn = b/2

a//33.x3 + …. + a//3n.xn = b//3
………
a(n-1)nn.xn = b(n-1)n

• now solve for xn :

xn 

bn  n  1

a nn  n  1

• This result can be back-substituted into the
(n−l)th equation to solve for xn−1.

Respect, Professionalism, & Entrepreneurship

• The procedure, which is repeated to evaluate
the remaining x’s, can be represented by the
following formula:
bi
xi 

( i 1 )

n





aij ( i  1 ) .x j

j i 1
aii ( i  1 )

• For i =n−1,n−2,...,1

Respect, Professionalism, & Entrepreneurship

Respect, Professionalism, & Entrepreneurship

Example 1
Use Gauss elimination to solve
x1 − 2x2 + 2x3= 1
2x1 + x2 − 3x3= −3
−3x1 + x2 − x3 = 4
Carry six significant figures
during the computation.

Respect, Professionalism, & Entrepreneurship

Gauss-Jordan Elimination
• 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.
• In addition, 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
• Consequently, it is not necessary to employ
back substitution to obtain the solution.

Respect, Professionalism, & Entrepreneurship

Example 2
Use Gauss-Jordan elimination
to solve
x1 − 2x2 + 2x3= 1
2x1 + x2 − 3x3= −3
−3x1 + x2 − x3 = 4
Last step in Gauss Elimination :

Respect, Professionalism, & Entrepreneurship

LU Decomposition
• As described in previous lesson, Gauss elimination
is designed to solve systems of linear algebraic
equations,
[A]{X}={B}
(1)
• Although it certainly represents a sound way to
solve such systems, it becomes inefficient when
solving equations with the same coefficients [A],
but with different right-hand-side constants (the
b’s).

Respect, Professionalism, & Entrepreneurship

• LU decomposition methods separate the
time-consuming elimination of the matrix [A]
from the manipulations of the right-hand side
{B}.
• Thus, once [A] has been “decomposed,”
multiple right-hand-side vectors can be
evaluated in an efficient manner.
• Interestingly, Gauss elimination itself can be
expressed as an LU decomposition

Respect, Professionalism, & Entrepreneurship
• Equation (1) can be rearranged to give
[A]{X}−{B}=0
(2)
• Suppose that Eq. (2) could be expressed as an upper
triangular system:

u11 u12 u13   x1   d1 
  
 0 u 22 u 23   x(3)
2   d 2 
0
 x   d 
0
u
33   3 
 3

• Equation (3) can also be expressed in matrix notation and
rearranged to give
[U]{X}−{D}=0
(4)

Respect, Professionalism, & Entrepreneurship

• Assume that there is a lower diagonal matrix
with 1’s on the diagonal,
1
0
 L l21 1
l
 31 l32

0
0
1

(5)

• That has the property that when Eq. (4) is
premultiplied by it, Eq. (2) is the result. That
is,
[L]{[U]{X}−{D}} =[A]{X}−{B}
(6)

Respect, Professionalism, & Entrepreneurship

• If this equation holds, it follows from the rules
for matrix multiplication that
[L][U]=[A]
(7)
• and
[L]{D}={B}
(8)

Respect, Professionalism, & Entrepreneurship

Respect, Professionalism, & Entrepreneurship
• Gauss elimination can be used to decompose [A] into [L] and
[U]. For example :
 a11
a
 21
 a31

a12
a 22
a32

a13   x1   c1 
a 23  (9)
x 2  c 2 
a33   x3   c3 

• The first step in Gauss elimination is to multiply row 1 by the
factor
a 21
f 21 
a11
• and subtract the result from the second row to eliminate a21.

Respect, Professionalism, & Entrepreneurship
• Similarly, row 1 is multiplied by
a31
f 31 
a11
• And the result subtracted from the third row to eliminate a31
• The final step is to multiply the modified second row by

a32
f 32 

a 22
• and subtract the result from the third row to eliminate a’32

Respect, Professionalism, & Entrepreneurship

• The value of f21, f31, f32 actually are the
element of [L].
• So we can rewrite Eq.(9) into the form of :
 1
 f 21
f
 31

0
1
f 32

0  a11
0  0
1  0

a12

a 22
0

a13   x1   c1 
   
a 23   x2   c2 
   x3   c3 
a33

Respect, Professionalism, & Entrepreneurship

Example 1
• Solve the equation below, using LU
decomposition method
 3  0 ,1  0,2  x1   7 ,85 
 0 ,1
7
 0 ,3  x2    19,3
0 ,3  0 ,2 10   x   71,4 
 3

Respect, Professionalism, & Entrepreneurship

Crout Decomposition
• An alternative approach involves a [U]
matrix with 1’s on the diagonal.
• This is called Crout decomposition.
• The Crout decomposition approach
generates [U] and [L] by sweeping
through the matrix by columns and rows,
as depicted in Fig

Respect, Professionalism, & Entrepreneurship
• Crout Decomposition can be implemented by the following
concise series of formulas
• li1 = ai1 for i = 1,2,3, …, n
• u1 j  a1 j
for j = 2,3, …, n
l11

• for j = 2,3,……., n1

and :

j 1

lij aij 

 lik .u kj

k 1

For i = j, j+1, …., n

j 1

a jk 
u jk 

 l ji .uik

i 1

l jj

For k = j+1, j+2, …, n

n 1

l nn a nn 

 lnk .u kn

k 1

Respect, Professionalism, & Entrepreneurship

Example 2
• Repeat example 1 using Crout Decomposition
method

Respect, Professionalism, & Entrepreneurship

Gauss-Seidel Iteration
• Iterative or approximate methods provide an
alternative to the elimination methods
• The Gauss-Seidel method is the most
commonly used iterative method.
• Assume that we are given a set of n
equations:
[A]{X}={B}

(1)

Respect, Professionalism, & Entrepreneurship
• Suppose that for conciseness we limit ourselves to a 3×3 set
of equations.
• If the diagonal elements are all nonzero, the first equation
can be solved for x1, the second for x2, and the third for x3 to
yield
b1  a12 x2  a13 x3
(2.a)
x1 
a11

b2  a 21 x1  a 23 x3
x2 
a 22

(2.b)

b3  a31 x1  a32 x2
x3 
a33

(2.c)

Respect, Professionalism, & Entrepreneurship

• Now, we can start the solution process by choosing
guesses for the x’s.
• A simple way to obtain initial guesses is to assume that
they are all zero.
• These zeros can be substituted into Eq. (2.a), which can
be used to calculate a new value for x1 = b1/a11.
• Then, we substitute this new value of x1 along with the
previous guess of zero for x3 into Eq. (2.b) to compute a
new value for x2.
• The process is repeated for Eq. (2.c) to calculate a new
estimate for x3.

Respect, Professionalism, & Entrepreneurship

• Then we return to the first equation and
repeat the entire procedure until our solution
converges closely enough to the true values.
• Convergence can be checked using the
criterion
 a ,i 

xi j  xi j  1
xi

j

.100%   s

Respect, Professionalism, & Entrepreneurship

Example 1
Use the Gauss-Seidel method to obtain the
solution of the system
3x1− 0.1x2− 0.2x3 =7.85
0.1x1+ 7x2− 0.3x3 = −19.3
0.3x1− 0.2x2+ 10x3 =71.4
Recall that the true solution is x1=3, x2=−2.5, and x3=7.

Respect, Professionalism, & Entrepreneurship

Jacobi Iteration
• An alternative approach, called Jacobi
iteration, utilizes a somewhat different tactic.
• Rather than using the latest available x’s, this
technique uses Eq. (2) to compute a set of
new x’s on the basis of a set of old x’s.
• Thus, as new values are generated, they are
not immediately used but rather are retained
for the next iteration.

Respect, Professionalism, & Entrepreneurship

Gauss-Seidel

Jacobi

Respect, Professionalism, & Entrepreneurship

Example 2
Use the Jacobi Iteration method to obtain the
solution of the system
3x1− 0.1x2− 0.2x3 =7.85
0.1x1+ 7x2− 0.3x3 = −19.3
0.3x1− 0.2x2+ 10x3 =71.4
Recall that the true solution is x1=3, x2=−2.5, and x3=7.

Respect, Professionalism, & Entrepreneurship

Homework

Respect, Professionalism, & Entrepreneurship

Homework
• Calculate each member force for each system