Download Ch3b-Systems of Linear Equations

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

False position method wikipedia , lookup

Linear least squares (mathematics) wikipedia , lookup

Dynamic substructuring wikipedia , lookup

Singular-value decomposition wikipedia , lookup

System of polynomial equations wikipedia , lookup

Matrix multiplication wikipedia , lookup

System of linear equations wikipedia , lookup

Simplex algorithm wikipedia , lookup

Gaussian elimination wikipedia , lookup

Transcript
Chapter: 3b
System of Linear Equations
Dr. Asaf Varol
1
Gaussian Elimination
In the Gaussian Elimination Method, Elementary Row Operations
(E.R.O.'s) are applied in a specific order to transform an augmented
matrix into triangular echelon form as efficiently as possible [6].
This is the essence of the method: Given a system of m equations in n
variables or unknowns, pick the first equation and subtract suitable
multiples of it from the remaining m-1 equations. In each case choose
the multiple so that the subtraction cancels or eliminates the same
variable, say x1. The result is that the remaining m-1 equations contain
only n-1 unknowns (x1 no longer appears) [6].
Now set aside the first equation and repeat the above process with the
remaining m-1 equations in n-1 unknowns [6].
Continue repeating the process. Each cycle reduces the number of
variables and the number of equations. The process stops when either:
2
Gaussian Elimination (Cont’d)
• There remains one equation in one variable. In that case,
there is a unique solution and back-substitution is used to find
the values of the other variables [6].
• There remain variables but no equations. In that case there is
no unique solution [6].
• There remain equations but no variables (ie. the lowest
row(s) of the augmented matrix contain only zeros on the left
side of the vertical line). This indicates that either the system
of equations is inconsistent or redundant. In the case of
inconsistency the information contained in the equations is
contradictory. In the case of redundancy, there may still be a
unique solution and back-substitution can be used to find the
values of the other variables [6].
3
Algorithm for Gaussian Elimination
• Transform the columns of the augmented matrix, one at a time, into
triangular echelon form. The column presently being transformed is
called the pivot column. Proceed from left to right, letting the pivot
column be the first column, then the second column, etc. and finally the
last column before the vertical line. For each pivot column, do the
following two steps before moving on to the next pivot column [6]:
• Locate the diagonal element in the pivot column. This element is called
the pivot. The row containing the pivot is called the pivot row. Divide
every element in the pivot row by the pivot (ie. use E.R.O. #1) to get a
new pivot row with a 1 in the pivot position [6].
• Get a 0 in each position below the pivot position by subtracting a
suitable multiple of the pivot row from each of the rows below it (ie. by
using E.R.O. #2).
• Upon completion of this procedure the augmented matrix will be in
triangular echelon form and may be solved by back-substitution [6].
4
Example
• Use Gaussian
elimination to solve
the system of
equations[6]:
5
Solution
Perform this sequence of E.R.O.'s on the augmented
matrix. Set the pivot column to column 1. Get a 1 in the
diagonal position (underlined):
6
Solution (Cont’d)
7
Solution (Cont’d)
8
Results
It is solved by back-substitution.
Substituting z = 3 from the third equation
into the second equation gives y = 5, and
substituting z = 3 and y = 5 into the first
equation gives x = 7. Thus the complete
solution is [6]:
{x = 7, y = 5, z = 3}.
9
Example
• Express the following system in augmented
matrix form and find an equivalent uppertriangular system and the solution [4].
10
Example (Cont’d)
• The augmented matrix is
11
Example (Cont’d)
• The first row is used to eliminate elements in the first
column below the diagonal. We refer to the first row as
pivotal row and the element a11=1 is called the pivotal
element. The values mk1 are the multiples of row 1 then are
to be subtracted from row k for k=2,3,4. The result after
elimination is [4]
12
Example (Cont’d)
• The second row is used to eliminate elements in the second
column that lie below the diagonal. The second row is the
pivotal row and the values mk2 are the multiples of row 2
that are to be subtracted from row k for k=3,4. The result
after elimination is [4]
13
Example (Cont’d)
• Finally, the multiple m43=-1.9 of the third row is
subtracted from the fourth row, and the result is the
upper- triangular system [4].
14
Example (Cont’d)
• The back-substitution algorithm can be used
to solve the previous matrix, and we get
• X4=2
• X3=4
• X2=-1
• X1=3
15
Example
• a) Use MATLAB to construct the augmented matrix for the
linear system of the below given matrix.
• b) Use the max command to find the element of greatest
magnitude in the first column of the coefficient matrix A.
• C) Break the augmented matrix into the coefficient matrix
U and constant matrix Y of the upper-triangular system
UX=Y [4].
16
Answers a)
• >>A=[1 2 1 4;2 0 4 3;4 2 2 1;-3 1 3 2];
• >>B=[13 28 20 6]’;
• >>Aug=[A B]
17
Answer b)
• In the following MATLAB display, a is the
element of greatest magnitude in the first column
of A and j is the row number
• >>[a,j]=max(abs(A(1:4,1)))
18
Answer c)
• Let Augup=[U|Y] be the upper-triangular matrix.
19
References
1.
2.
3.
4.
5.
6.
Celik, Ismail, B., “Introductory Numerical Methods for Engineering Applications”,
Ararat Books & Publishing, LCC., Morgantown, 2001
Fausett, Laurene, V. “Numerical Methods, Algorithms and Applications”, Prentice
Hall, 2003 by Pearson Education, Inc., Upper Saddle River, NJ 07458
Rao, Singiresu, S., “Applied Numerical Methods for Engineers and Scientists, 2002
Prentice Hall, Upper Saddle River, NJ 07458
Mathews, John, H.; Fink, Kurtis, D., “Numerical Methods Using MATLAB” Fourth
Edition, 2004 Prentice Hall, Upper Saddle River, NJ 07458
Varol, A., “Sayisal Analiz (Numerical Analysis), in Turkish, Course notes, Firat
University, 2001
http://mathonweb.com/help/backgd3e.htm
20