Solving Linear Systems Using Gaussian Elimination. How can we solve

Similar documents
Matrix decompositions

Matrix decompositions

2.1 Gaussian Elimination

Linear Algebra Section 2.6 : LU Decomposition Section 2.7 : Permutations and transposes Wednesday, February 13th Math 301 Week #4

SOLVING LINEAR SYSTEMS

Linear Algebra Linear Algebra : Matrix decompositions Monday, February 11th Math 365 Week #4

Chapter 4 No. 4.0 Answer True or False to the following. Give reasons for your answers.

Gaussian Elimination and Back Substitution

Numerical Analysis Fall. Gauss Elimination

MATH 3511 Lecture 1. Solving Linear Systems 1

Direct Methods for Solving Linear Systems. Simon Fraser University Surrey Campus MACM 316 Spring 2005 Instructor: Ha Le

Lecture 12 (Tue, Mar 5) Gaussian elimination and LU factorization (II)

CSE 160 Lecture 13. Numerical Linear Algebra

Chapter 9: Gaussian Elimination

The Solution of Linear Systems AX = B

CS412: Lecture #17. Mridul Aanjaneya. March 19, 2015

LU Factorization. Marco Chiarandini. DM559 Linear and Integer Programming. Department of Mathematics & Computer Science University of Southern Denmark

AMS526: Numerical Analysis I (Numerical Linear Algebra)

1 Multiply Eq. E i by λ 0: (λe i ) (E i ) 2 Multiply Eq. E j by λ and add to Eq. E i : (E i + λe j ) (E i )

Direct Methods for Solving Linear Systems. Matrix Factorization

Gaussian Elimination -(3.1) b 1. b 2., b. b n

Gaussian Elimination without/with Pivoting and Cholesky Decomposition

MAC1105-College Algebra. Chapter 5-Systems of Equations & Matrices

EBG # 3 Using Gaussian Elimination (Echelon Form) Gaussian Elimination: 0s below the main diagonal

Linear System of Equations

COURSE Numerical methods for solving linear systems. Practical solving of many problems eventually leads to solving linear systems.

x 2 b 1 b 2 b 3. x 1 x 3 c n 2 d n 1 e n 1 x n 1 b n 1 5 c n 1 d n x n b n

Ack: 1. LD Garcia, MTH 199, Sam Houston State University 2. Linear Algebra and Its Applications - Gilbert Strang

Chapter 2. Solving Systems of Equations. 2.1 Gaussian elimination

Linear Systems of n equations for n unknowns

CHAPTER 6. Direct Methods for Solving Linear Systems

Solving Consistent Linear Systems

Linear Algebraic Equations

AMS 209, Fall 2015 Final Project Type A Numerical Linear Algebra: Gaussian Elimination with Pivoting for Solving Linear Systems

Computational Linear Algebra

1.5 Gaussian Elimination With Partial Pivoting.

9. Numerical linear algebra background

LU Factorization a 11 a 1 a 1n A = a 1 a a n (b) a n1 a n a nn L = l l 1 l ln1 ln 1 75 U = u 11 u 1 u 1n 0 u u n 0 u n...

Numerical Analysis FMN011

Dense LU factorization and its error analysis

Chapter 4. Solving Systems of Equations. Chapter 4

Math 304 (Spring 2010) - Lecture 2

Lectures on Linear Algebra for IT

Lecture 2e Row Echelon Form (pages 73-74)

MODULE 7. where A is an m n real (or complex) matrix. 2) Let K(t, s) be a function of two variables which is continuous on the square [0, 1] [0, 1].

Numerical Methods I: Numerical linear algebra

Linear Equations in Linear Algebra

Chapter 4 No. 4.0 Answer True or False to the following. Give reasons for your answers.

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 1 x 2. x n 8 (4) 3 4 2

Parallel Scientific Computing

Roundoff Analysis of Gaussian Elimination

1.4 Gaussian Elimination Gaussian elimination: an algorithm for finding a (actually the ) reduced row echelon form of a matrix. A row echelon form

Lecture 3: Gaussian Elimination, continued. Lecture 3: Gaussian Elimination, continued

1 Determinants. 1.1 Determinant

GAUSSIAN ELIMINATION AND LU DECOMPOSITION (SUPPLEMENT FOR MA511)

Determinants. Chia-Ping Chen. Linear Algebra. Professor Department of Computer Science and Engineering National Sun Yat-sen University 1/40

Column 3 is fine, so it remains to add Row 2 multiplied by 2 to Row 1. We obtain

The System of Linear Equations. Direct Methods. Xiaozhou Li.

Matrix notation. A nm : n m : size of the matrix. m : no of columns, n: no of rows. Row matrix n=1 [b 1, b 2, b 3,. b m ] Column matrix m=1

Numerical Linear Algebra Primer. Ryan Tibshirani Convex Optimization /36-725

22A-2 SUMMER 2014 LECTURE 5

Practical Linear Algebra: A Geometry Toolbox

1 GSW Gaussian Elimination

9. Numerical linear algebra background

DEN: Linear algebra numerical view (GEM: Gauss elimination method for reducing a full rank matrix to upper-triangular

Review. Example 1. Elementary matrices in action: (a) a b c. d e f = g h i. d e f = a b c. a b c. (b) d e f. d e f.

Review of matrices. Let m, n IN. A rectangle of numbers written like A =

Draft. Lecture 12 Gaussian Elimination and LU Factorization. MATH 562 Numerical Analysis II. Songting Luo

Chapter 1: Systems of linear equations and matrices. Section 1.1: Introduction to systems of linear equations

POLI270 - Linear Algebra

Calculating determinants for larger matrices

Lecture 12: Solving Systems of Linear Equations by Gaussian Elimination

Problem Sheet 1 with Solutions GRA 6035 Mathematics

Linear algebra I Homework #1 due Thursday, Oct Show that the diagonals of a square are orthogonal to one another.

Illustration of Gaussian elimination to find LU factorization. A = a 11 a 12 a 13 a 14 a 21 a 22 a 23 a 24 a 31 a 32 a 33 a 34 a 41 a 42 a 43 a 44

Example: Current in an Electrical Circuit. Solving Linear Systems:Direct Methods. Linear Systems of Equations. Solving Linear Systems: Direct Methods

Matrix Algebra and Inverses

Scientific Computing

Fundamentals of Engineering Analysis (650163)

MA 1B PRACTICAL - HOMEWORK SET 3 SOLUTIONS. Solution. (d) We have matrix form Ax = b and vector equation 4

14.2 QR Factorization with Column Pivoting

Notes on Row Reduction

Gaussian Elimination for Linear Systems

CS475: Linear Equations Gaussian Elimination LU Decomposition Wim Bohm Colorado State University

Chapter 2. Solving Systems of Equations. 2.1 Gaussian elimination

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Solving Dense Linear Systems I

Solving linear equations with Gaussian Elimination (I)

Numerical Linear Algebra

Program Lecture 2. Numerical Linear Algebra. Gaussian elimination (2) Gaussian elimination. Decompositions, numerical aspects

A Review of Matrix Analysis

A Primer on Solving Systems of Linear Equations

LU Factorization. LU Decomposition. LU Decomposition. LU Decomposition: Motivation A = LU

Introduction to Mathematical Programming

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Today s class. Linear Algebraic Equations LU Decomposition. Numerical Methods, Fall 2011 Lecture 8. Prof. Jinbo Bi CSE, UConn

CME 302: NUMERICAL LINEAR ALGEBRA FALL 2005/06 LECTURE 6

Next topics: Solving systems of linear equations

Engineering Computation

Inverses. Stephen Boyd. EE103 Stanford University. October 28, 2017

Transcription:

Solving Linear Systems Using Gaussian Elimination How can we solve? 1

Gaussian elimination Consider the general augmented system:

Gaussian elimination Step 1: Eliminate first column below the main diagonal. Subtract a j1 a 11 the first row from the j th row, j =,,...,n. Pivot!

Gaussian elimination Step : Eliminate second column below the main diagonal. Subtract a(1) j a (1) the second row from the j th row, j =,,...,n.!

Gaussian elimination Repeat:. Subtract a() j a (). Subtract a() j a () the third row from the j th row, j =,,...,n:! (A () b () ) the fourth row from the j th row, j =,,...,n:! (A () b () ) n 1. Subtract a (n ) a j,n 1 (n ) n 1,n 1. the (n 1) row from the j th row, j = n:! (A (n 1) b (n 1) )

Gaussian Elimination After n 1 steps an upper triangular system is obtained: This system can now be solved using backward substitution.

Backward Substitution Upper triangular system Backward substitution: For k = n, n 0 x k = 1 nx (k 1) @b (k 1) k a kj a kk j=k+1 (k 1) x j 1,...,1 compute 1 A

Cost of Gaussian elimination The cost of eliminating entries below the 1 st pivot: Pivot a 11 a 1 a 1 a 1 a 1 b 1 a 1 a a a a b a 1 a a a a b a 1 a a a a b a 1 a a a a b n = 8

Cost of Gaussian elimination The cost of eliminating entries below the 1 st pivot: Pivot 11 1 1 1 1 1 1 1 1 1 n = Each row operation costs n + 1 multiplies/divides and n subtractions: Total operations per row: n +1 There are n 1 rows to eliminate: Total operations: (n + 1)(n 1) = n(n 1) + n 1 9

Cost of Gaussian elimination The cost of eliminating entries below the nd pivot: Pivot 11 1 1 1 1 1 0 a (1) a (1) a (1) a (1) b (1) 0 a (1) a (1) a (1) a (1) b (1) 0 a (1) a (1) a (1) a (1) b (1) 0 a (1) a (1) a (1) a (1) b (1) n = Each row operation costs n multiplies/divides and n 1 subtractions: Total operations per row: n 1 There are n rows to eliminate: Total operations: (n 1)(n ) = (n 1)(n ) + n 10

Cost of Gaussian elimination The cost of eliminating entries below the rd pivot: 11 1 1 1 1 1 0 a (1) a (1) a (1) a (1) b (1) a () a () b () Pivot 0 0 a () 0 0 a () a () a () b () 0 0 a () a () a () b () n = Each row operation costs n 1 multiplies/divides and n subtracts: Total operations per row: n There are n rows to eliminate: Total operations: (n )(n ) = (n )(n ) + n 11

Cost of Gaussian elimination The cost of eliminating entries below the th pivot: 11 1 1 1 1 1 0 a (1) a (1) a (1) a (1) b (1) 0 0 a () Pivot 0 0 0 a () a () a () b () a () b () 0 0 0 a () a () b () n = Each row operation costs n multiplies/divides and n subtracts: Total operations per row: n There are n rows to eliminate: Total operations: (n )(n ) = (n )(n ) + n 1

Cost of Gaussian elimination After the (n 1) st step the matrix is in upper triangular form: 11 1 1 1 1 1 0 a (1) a (1) a (1) a (1) b (1) 0 0 a () a () a () b () 0 0 0 a () a () b () 0 0 0 0 a () b () n = 1

Cost of Gaussian elimination We can count the total floating point operations (FLOPs): Total FLOPs = = nx k=1 ((n k + 1)(n k)+(n k)) nx 1 (n k + 1)(n k)+ k=1 = n(n 1) + 1 n(n 1) = n + 1 n n nx 1 (n k) k=1 n we ignore lower order powers of n We say that elimination is an n algorithm, which is considered expensive. 1

What about the back solve? a 11 a 1 a a1 a 1 a 1 0 a a a a 0 0 a a a 0 0 0 a a x 1 x x x = b 1 b b b 0 0 0 0 a x b x = b /a! 1 op x =(b a x )/a! ops One op is a multiplication or divide; Ignore subtractions for now; we will add them in momentarily. x =(b a x x a x )/a! ops x =(b a x a x x a x )/a! ops x 1 =(b 1 a 1 x a 1 x a 1 x x a 1 x )/a 11! ops 1

What about the cost of the back solve? Step k in the back solve requires k multiplications and k additions. So the total work for a back solve is : nx k=1 k = n(n + 1) 1 n Ignore lower order powers of n, but pay attention to the coefficient of the highest order power of n. or 1 n = n if we include subtractions, as well as divisions and multiplications. We say that a back solve is an order n operation, which is considerably cheaper than the original elimination. 1

Pivoting What happens when one of the diagonals is zero? We have to pivot! Partial pivoting Complete pivoting 1