CS537
Numerical Analysis
Lecture 4
System of Linear Equations
Professor Jun Zhang
Department of Computer Science University of Kentucky Lexington, KY 40506-0633
February 20, 2019 System of Linear Equations
a x + a x ++ a x = b 11 1 + 12 2 + + 1n n = 1 a21 x1 a22 x2 a2n xn b2 + + + = an1 x1 an2 x2 ann xn bn where aij are coefficients, xi are unknowns, and bi are right-hand sides. Written in a compact form is n = = aij x j bi , i 1,,n j=1 The system can also be written in a matrix form Ax = b where the coefficient matrix is a11 a12 a1n a a a A = 21 22 2n an1 an2 ann and x = [x , x ,, x ]T ,b = [b ,b ,b ]T 1 2 n 1 2 n 2 An Upper Triangular System
The solution of a general linear system is not easily available
The solution can be obtained easily from an upper triangular system
+ + + + = a11 x1 a12 x2 a13 x3 a1n xn b1 + + + = a22 x2 a23 x3 a2n xn b2 + + = a33 x3 a3n xn b3 + = an−1,n−1 xn−1 an−1,n xn bn−1 = ann xn bn
Objective: Modify a general linear system into an upper triangular system
Three elementary operations on a linear system do not change its solution
3 Karl Friedrich Gauss (April 30, 1777 – February 23, 1855) German Mathematician and Scientist
4 Gaussian Elimination
Linear systems are solved by Gaussian elimination, which involves repeated procedure of multiplying a row by a number and adding it to another row to eliminate a certain variable
For a particular step, this amounts to ← − aik ≤ ≤ aij aij akj (k j n) akk ← − aik bi bi bk akk
th After this step, the variable xk, is eliminated in the (k + 1) and in the later equations
The Gaussian elimination modifies a matrix into an upper triangular form such that aij = 0 for all i > j. The solution of an upper triangular system is then easily obtained by a back substitution procedure
5 Illustration of Gaussian Elimination
6 7 Back Substitution
The obtained upper triangular system is + + + + = a11 x1 a12 x2 a13 x3 a1n xn b1 + + + = a22 x2 a23 x3 a2n xn b2 + + = a33 x3 a3n xn b3 + = an−1,n−1 xn−1 an−1,n xn bn−1 = ann xn bn We can compute = bn xn ann From the last equation and substitute its value in other equations and repeat the process n = 1 − xi bi aij x j aii j=i+1 For i = n –1, n – 2,…, 1 8 9 Condition Number and Error
A quantity used to measure the quality of a matrix is called condition number, defined as − ρ(A) = A A 1
The condition number measures the transfer of error from the matrix A to the right-hand side vector b. If A has a large condition number, small error in A or b may yield large error in the solution x = A-1b. Such a matrix is called ill-conditioned
The error e is defined as the difference between a computed solution and the exact solution e = x − x~ Since the exact solution is generally unknown, we measure the residual r = b − A x~
As an indicator of the size of the error
10 Error Correction
If the error can be found, then the approximate solution can be corrected: = + (1) You cannot solve the residual equation to get the error = In many modern iterative methods, we aim to solve an approximate equation of them form =
Where is a “good” approximate to A, so that will be a good approximate to the error e, we can correct the approximate the solution as: