0% found this document useful (0 votes)
151 views26 pages

CE2407B Lecture 2 PDF

This document contains lecture notes on Gaussian elimination. It begins with an introduction to systems of linear equations and the operations that can be performed on them. These include multiplying an equation by a constant, adding two equations, and swapping equations. The notes then explain the Gaussian elimination method, which transforms a system of equations into an upper triangular form through a series of row operations. This reduced row echelon form can then be used to solve the system. An example applying the row operations of Gaussian elimination to a 3x3 system is provided.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
151 views26 pages

CE2407B Lecture 2 PDF

This document contains lecture notes on Gaussian elimination. It begins with an introduction to systems of linear equations and the operations that can be performed on them. These include multiplying an equation by a constant, adding two equations, and swapping equations. The notes then explain the Gaussian elimination method, which transforms a system of equations into an upper triangular form through a series of row operations. This reduced row echelon form can then be used to solve the system. An example applying the row operations of Gaussian elimination to a 3x3 system is provided.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

CE2407 Engineering and Uncertainty Analysis

Lecture Notes 2
Gaussian Elimination

Kevin Kuang Sze Chiang


Department of Civil and Environmental Engineering
Room E2-04-11, Tel: 6516 4683, Email: [email protected]

Lecture 2 PG1
• There are three grades of
grain: top, medium and low.
• Three sheaves of top-grade,
two sheaves of medium-grade
and one sheaf of low-grade
are 39 Dous.
• Two sheaves of top-grade,
three sheaves of medium-
grade and one sheaf of low-
grade are 34 Dous.
• One sheaf of top-grade, two
sheaves of medium-grade
and three sheaves of low-
Liu Hui (225–295)
grade are 26 Dous.
• How many Dous does one
sheaf of top-grade, medium-
grade and low-grade grain
yield respectively? Lecture 2 PG2
Lecture 2 PG3
Displacement of joints
a of crane

Ideal fluid flow past a cylinder


Flow through a network of pipes

Lecture 2 PG4
CE2407 Engineering and Uncertainty Analysis

Lecture Notes 2
Gaussian Elimination

Kevin Kuang Sze Chiang


Department of Civil and Environmental Engineering
Room E2-04-11, Tel: 6516 4683, Email: [email protected]

Lecture 2 PG5
Lecture 2- Systems of Linear Equation

CE3155 Structural Analysis P= K X


4 20
B K = Structure stiffness matrix
EI = 20,000
2EI, 2EA X = Joint displacement vector
6 EA = 200,000 P = Joint load vector
A EI, EA
EI, EA
4 D Take FBD of planer frame and solve linear
system of 7 equations with 7 unknowns
8 10 6

 8000 4000 − 720 960 0 0 0   x1   0 


 4000 24000 − 720
 − 1440 8000 0 2400   x2   28.8 
− 720 − 720 52886.4 9484.8 0 − 40000 0   x3   0 
    
 960 − 1440 9484.8 7833.6 − 2400 0 − 480   x4  = − 12.96
 0 8000 0 − 2400 24000 − 960 1680   x5   − 19.2 
    
 0 0 − 40000 0 x
− 960 47353.6 − 9484.8  6   0 
 0
 2400 0 − 480 1680 − 9484.8 13366.4   x7   − 7.04 
Stiffness Matrix, K X P
Lecture 2 PG6
Operations of Systems of Equations

Consider the following system of n linear equations in n unknowns:


 a11 x1 + a12 x2 + ....... + a1n xn = b1 ( E1 )
a x + a x + ....... + a2 n xn = b2 ( E2 )
 21 1 22 2

 . . . .

Sn =  . . . .
 . . . .

 . . . .
a x
 n1 1 + an 2 x2 + ....... + ann xn = bn ( En )
Three operations are permitted on a system of equations (Sn)
(λEi)  (Ei) Equation Ei can be multiplied by any
nonzero constant λ, with the resulting
equation used in place of Ei.

(Ei+λEj)  (Ei) Equation Ej can be multiplied by any


constant λ, added to Ei and the
resulting equation used in place of Ei.

(Ei)  (Ej) Equations Ei and Ej can be swapped in order.


Lecture 2 PG7
Operations of Systems of Equations

Example 1 Consider the following system of two equations in 2 unknowns S2:

 3 x1 + 2 x2 = 18. E1
S2 = 
- x1 + 2 x2 = 2 E2

x2

E1
Solution x1=4, x2=3

E2

x1

Lecture 2 PG8
Operations of Systems of Equations

Example 2 Consider the following system of three equations in 3 unknowns S3:

4 x1 + 3 x2 − x3 = −5.7 E1

S3 =  5 x1 + x2 + 3 x3 = 2.8 E2
 x − x + 2 x = 3.8 E3
 1 2 3

Can be solved with graphical method, each equation representing a plane is


a 3D space. The point where the 3 planes intersect would represent the
solution. If the system of equation is more than 3, this method is not practical
and no use for solving simultaneous equation.

Alternatively, we can develop a systematic scheme or algorithm to eliminate


the unknowns and back substitute into original equation for the remaining
unknowns.

Most basic of known scheme is the Gaussian Elimination Method

Lecture 2 PG9
Gaussian Elimination Method

We start of by writing the system equation in the form of a matrix


4 x1 + 3 x2 − x3 = −5.7 E1

4 3 − 1  x1  − 5.7  S 3 =  5 x1 + x2 + 3 x3 = 2.8
 x − x + 2 x = 3.8
E2

5 1 3   x  =  2.8   1 2 3 E3

   2  
1 − 1 2   x3   3.8 
A X b

Then, we form an augmented coefficient matrix by including the constants


as an extra column in the matrix

A ‘ha(r)d’ – signifiy 4 3 − 1 − 5.7  E1


 
augmented [ ]
Aˆ = A, b = 5 1 3 2.8  E2
matrix A
1 − 1 2 3.8  E3

Lecture 2 PG10
Gaussian Elimination Method

The objective is to transform the system equation into a reduced form:

a11 a12 a13 a14  E1


 
The reduced general form :  0 a22 a23 a24  E2
 0 0 a33 a34  E3

The first 3 columns form a upper triangular matrix, which is what we


want. This is called the reduced form, or triangular form or echelon form.

Note that the elements of the main diagonals is non-zero i.e. a ii = 0


This is an important note, so you must pay attention to this.
More details later.

Lecture 2 PG11
Gaussian Elimination Method

4 3 − 1 − 5.7  E1
SO….
Aˆ = [ A, b] = 5 1

3 2.8  E2

1 − 1 2 3.8  E3
Notice the choice of constant used
What can you say? (Do the Envelope Thing)

4 3 −1 − 5.7  E1
5  
E2 − E1 → E2
4 0 − 2.75 4.25 9.925 E2
1
E3 − E1 → E3 0 − 1.75 2.25 5.225 E3
4

4 3 −1 − 5.7  E1
 
-1.75 0 − 2.75 4.25 9.925  E2
E3 − E 2 → E3 0 0 − 0.4545 − 1.0909 E3
-2 .75

Lecture 2 PG12
Gaussian Elimination Method

The final matrix can now be transformed into its corresponding linear system:

4 x1 + 3 x2 − x3 = −5.7 E1

S3 =  − 2.75 x2 + 4.25 x3 = 9.925 E2
 − 0.4545 x3 = −1.0909 E3

− 1.0909
x3 = = 2 .4
− 0.4545

9.925 − 4.25(2.4 )
x2 = = 0 .1
− 2.75

− 5.7 − ( − 1)( 2 .4 ) − 3( 0 .1)


x1 = = − 0 .9
4 #
Lecture 2 PG13
Gaussian Elimination Method- Potential Pitfall

General form:
 a11 a12 ..... a1i ..... a1n a1,n +1  E1
Make 1 element zero  
 a21 a22 ..... a2i ..... a2 n a2,n +1  E2
Aˆ = [ A, b] =  
a j1  
Ej − E1 → E j a j1 a j 2 ..... a ji ..... a jn a j ,n +1  E j
a11  
 
=
for j 2,3,..., n an1 an 2 ..... ani ..... ann an ,n +1  En

Make the next element


 a11 a12 ..... a1i ..... a1n a1,n +1  E1
zero etc….  
 a21 a22 ..... a2i ..... a2 n a2,n +1  E2
Aˆ = [ A, b] =  
a j2  
Ej − E2 → E j a j1 a j 2 ..... a ji ..... a jn a j ,n +1  E j
a22  
for j = 2,3,..., n a an 2 ..... ani ..... ann

an ,n +1  En
 n1
Lecture 2 PG14
Gaussian Elimination Method- Potential Pitfall

Even more general form:

 a11 a12 ..... a1i ..... a1n a1,n +1  E1


 
 a21 a22 ..... a2i ..... a2 n a2,n +1  E2
Aˆ = [ A, b] =  
aii
a ji  
Ej − Ei → E j  a j1 a j2 ..... a ji ..... a jn a j ,n +1  E j
aii  
for i = 2,3,..., n − 1 
 an1 an 2 ..... ani ..... ann an ,n +1  En
and j = i + 1,..., n
(J are the sub-diagonal elements)

In this operation aii is called the pivot element. In performing the Gaussian
Elimination the pivot elements aii are assumed nonzero.
•If for some i, aii = 0, then a search is performed to find the smallest integer p
with i ≤ p ≤ n such that api ≠ 0, then we perform Ep ↔ Ei.
•In English it means: Just find the nearest row (below) where the pivot
element is not zero!
Lecture 2 PG15
Gaussian Elimination Method- Potential Pitfall

So, check if the diagonal contains any zero element. If any one of the diagonals
is zero, then do a swap with the next nearest line down.

E.g. 4 3 − 1 1 − 5.7  E1
 
ˆ  0 0 3 2 2.8  E2 a22 = 0
A= i =2 i≤ p≤n
0 − 1 2 − 9 3.8  E3
  Smallest integer p=3
0 7 2 8 1.2  E4 a32 ≠ 0
If we perform E3 ↔ E2.then we get:

4 3 − 1 1 − 5.7  E1
 
ˆ  0 −1 2 − 9 3.8  E2
A=
0 0 3 2 2.8  E3
 
0 7 2 8 1.2  E4
Gaussian Elimination can now continue on Â.
Lecture 2 PG16
Gaussian Elimination Method- General Form Recap

Obtain the following triangular form of Â


a11 a12 ..... a1i ..... a1n a1,n +1  E1
 
 0 a 22 ..... a 2i ..... a 2n
a 2 , n +1  E2
 
ˆ
A = [ A, b] =  
 a ii ..... a in
a i , n +1  Ei
 
 
 0 0 a nn
a  En
n , n +1 

Transformed into its corresponding linear system:


a11 x1 + a12 x2 + ....... + a1,n −1 xn −1 + a1n xn = a1,n +1 ( E1 )
 a22 x2 + ....... + a2,n −1 xn −1 + a 2 n xn = a2,n +1 ( E2 )

 . . . . .

Sn =  . . . . .
 . . . . .

 an −1,n −1 xn −1 + an −1,n xn . = an −1,n +1 ( En −1 )
 ann xn = an ,n +1 ( En )

Lecture 2 PG17
Gaussian Elimination Method- General Form Recap

Backward substitution can now be performed. Solving the nth equation for xn
gives bottom-most equation…
a11 x1 + a12 x2 + ....... + a1,n −1 xn −1 + a1n xn = a1,n +1 ( E1 )
From En an ,n +1  a22 x2 + ....... + a2,n −1 xn −1 + a2 n xn = a2,n +1 ( E2 )
xn = 
 . . . . .
ann 
Sn =  . . . . .
 . . . . .

From En-1  an −1,n −1 xn −1 + an −1,n xn . = an −1,n +1 ( En −1 )

an −1,n +1 − an −1,n xn  ann xn = an,n +1 ( En )
xn −1 =
an −1,n −1
Sum up all the products
of ax ahead of xi
ai ,n +1 − ∑ j =i +1 aij x j
From Ei n

xi =
aii

Lecture 2 PG18
Gaussian Elimination Method- Worked Example 2

 x1 + 3 x2 -2x 3 + x4 = −1 E1

S 4  2 x1 -2x2 + x 3 -2 x 4
= = 1 E2
 x1 + x2 − 3 x3 + x4 = 6 E3
 3x1 − x2 + 2x3 − x4 = 3 E4

1 3 -2 1 -1  E1
 
ˆA = 2 -2 1 -2 1  E2
1 1 -3 1 6  E3
 
3 -1 2 -1 3  E4

Answers: x1= 2 ; x2=-3 ;x3=-1 ;x4=4

Lecture 2 PG19
Gaussian Elimination Method- Worked Example

1 3 − 2 1 − 1
2 − 2 1 − 2 1 
 
1 1 − 3 1 6
 
3 − 1 2 − 1 3 
1 3 − 2 1 − 1
 
E2-(2/1)xE1 0 − 8 5 −4 3 
E3-1xE1 0 -2 -1 0 7
 
E4-3xE1 0 − 10 8 -4 6 
1 3 − 2 1 − 1
 − 
 0 -8 5 4 3 
E3-(-2/-8)E2 0 0 -2.25 1 6.25
 
E4-(-10/-8)E2 0 0 1.75 1 2.25

Lecture 2 PG20
Gaussian Elimination Method- Worked Example

1 3 − 2 1 − 1
 − 4 
0 -8 5 3 
0 0 -2.25 1 6.25 
 
E4-(1.75/-2.25)E3  0 0 0 1.778 7.111


 -1 

1 3 -2 1   x1 
   
−8 x2 3 

0 5 -4 

  = 
0 0 -2.25 1   x3  6.25 
0   
0 0 x4 7.111 

1.778 

x1= 2 ; x2=-3 ;x3=-1 ;x4=4


#
Lecture 2 PG21
So, how can I make use of what I
have learnt here ?

Lecture 2 PG22
Displacement of joints
a of crane

Ideal fluid flow past a cylinder


Flow through a network of pipes

Lecture 2 PG23
If it is a set/system of linear equations
If
(meaning can be express using linear
equations only, we can use GE to solve)
4 20
B K = Structure stiffness matrix
EI = 20,000
2EI, 2EA X = Joint displacement vector
6 EA = 200,000 P = Joint load vector
A EI, EA
EI, EA
4 D

8 10 6

 8000 4000 − 720 960 0 0 0   x1   0 


 4000 24000 − 720
 − 1440 8000 0 2400   x2   28.8 
− 720 − 720 52886.4 9484.8 0 − 40000 0   x3   0 
    
 960 − 1440 9484.8 7833.6 − 2400 0 − 480   x4  = − 12.96
 0 8000 0 − 2400 24000 − 960 1680   x5   − 19.2 
    
 0 0 − 40000 0 x
− 960 47353.6 − 9484.8  6   0 
 0
 2400 0 − 480 1680 − 9484.8 13366.4   x7   − 7.04 

Lecture 2 PG24
Gaussian Elimination Method- Exercise

Copy this down and try it yourself. Gaussian Elimination in Excel

x1 − 2 x2 − x3 + 3 x4 = 4
2 x1 + x 2 + x3 − 4 x4 = 3
3 x1 − x 2 −2 x 3 +2 x4 = 6
x1 + 3 x2 − x3 + x4 = 8

Answers:
x1 = 4, x2 = 2, x3 = 5, x4 = 3

Lecture 2 PG25
Lecture 2 PG26

You might also like