Linear Systems of Equations: solution and applications

Slides:



Advertisements
Similar presentations
LU Factorization.
Advertisements

Chapter 2 Solutions of Systems of Linear Equations / Matrix Inversion
Linear Algebra Applications in Matlab ME 303. Special Characters and Matlab Functions.
4/26/ LU Decomposition Civil Engineering Majors Authors: Autar Kaw Transforming.
Linear Systems LU Factorization CSE 541 Roger Crawfis.
Autar Kaw Humberto Isaza
MATH 685/ CSI 700/ OR 682 Lecture Notes
Scientific Computing Linear Systems – Gaussian Elimination.
1.5 Elementary Matrices and a Method for Finding
Major: All Engineering Majors Authors: Autar Kaw
Systems of Linear Equations
SOLVING SYSTEMS OF LINEAR EQUATIONS. Overview A matrix consists of a rectangular array of elements represented by a single symbol (example: [A]). An individual.
Lecture 9: Introduction to Matrix Inversion Gaussian Elimination Sections 2.4, 2.5, 2.6 Sections 2.2.3, 2.3.
Solution of linear system of equations
Linear Systems of Equations Ax = b Marco Lattuada Swiss Federal Institute of Technology - ETH Institut für Chemie und Bioingenieurwissenschaften ETH Hönggerberg/
Matrices and Systems of Equations
Ch 7.2: Review of Matrices For theoretical and computation reasons, we review results of matrix theory in this section and the next. A matrix A is an m.
ECIV 520 Structural Analysis II Review of Matrix Algebra.
MOHAMMAD IMRAN DEPARTMENT OF APPLIED SCIENCES JAHANGIRABAD EDUCATIONAL GROUP OF INSTITUTES.
Copyright © Cengage Learning. All rights reserved. 7.6 The Inverse of a Square Matrix.
LU Decomposition 1. Introduction Another way of solving a system of equations is by using a factorization technique for matrices called LU decomposition.
Scientific Computing Linear Systems – LU Factorization.
Square n-by-n Matrix.
MA2213 Lecture 5 Linear Equations (Direct Solvers)
Linear Systems Gaussian Elimination CSE 541 Roger Crawfis.
Chap. 2 Matrices 2.1 Operations with Matrices
2.5 - Determinants & Multiplicative Inverses of Matrices.
Matrices CHAPTER 8.1 ~ 8.8. Ch _2 Contents  8.1 Matrix Algebra 8.1 Matrix Algebra  8.2 Systems of Linear Algebra Equations 8.2 Systems of Linear.
CHAPTER 2 MATRICES 2.1 Operations with Matrices Matrix
Lecture 8 Matrix Inverse and LU Decomposition
Linear algebra: matrix Eigen-value Problems Eng. Hassan S. Migdadi Part 1.
Chapter 5 MATRIX ALGEBRA: DETEMINANT, REVERSE, EIGENVALUES.
1/18/ LU Decomposition Industrial Engineering Majors Authors: Autar Kaw Transforming.
Linear Systems Dinesh A.
3/1/ LU Decomposition Computer Engineering Majors Authors: Autar Kaw Transforming.
Unit #1 Linear Systems Fall Dr. Jehad Al Dallal.
Autar Kaw Benjamin Rigsby Transforming Numerical Methods Education for STEM Undergraduates.
2 - 1 Chapter 2A Matrices 2A.1 Definition, and Operations of Matrices: 1 Sums and Scalar Products; 2 Matrix Multiplication 2A.2 Properties of Matrix Operations;
Matrices, Vectors, Determinants.
Sinwook Lee Digital Media Lab. HYU.  Linear Equations  To gain the appropriate solution, 1..n of equations are necessary.  The num of equations < n.
Numerical Methods.  LU Decomposition is another method to solve a set of simultaneous linear equations  For most non-singular matrix [A] that one could.
Lecture 9 Numerical Analysis. Solution of Linear System of Equations Chapter 3.
Numerical Computation Lecture 6: Linear Systems – part II United International College.
EE611 Deterministic Systems Vector Spaces and Basis Changes Kevin D. Donohue Electrical and Computer Engineering University of Kentucky.
Matrices Introduction.
7.3 Linear Systems of Equations. Gauss Elimination
Chapter 8 Numerical Technique
Gaussian Elimination and Gauss-Jordan Elimination
MAT 322: LINEAR ALGEBRA.
Inverse of a Matrix Hung-yi Lee Textbook: Chapter 2.3, 2.4 Outline:
Matrices and Vector Concepts
Linear Algebraic Equations and Matrices
7.7 Determinants. Cramer’s Rule
Lecture 2 Matrices Lat Time - Course Overview
Part B. Linear Algebra, Vector Calculus
Spring Dr. Jehad Al Dallal
5 Systems of Linear Equations and Matrices
Linear Equations.
Linear Algebraic Equations and Matrices
Linear independence and matrix rank
Systems of First Order Linear Equations
Chapter 10: Solving Linear Systems of Equations
Chemical Engineering Majors Authors: Autar Kaw
Elementary Matrix Methid For find Inverse
Numerical Analysis Lecture14.
Numerical Analysis Lecture10.
Section 9.5 Inverses of Matrices
Linear Systems Numerical Methods.
Major: All Engineering Majors Authors: Autar Kaw
Lecture 8 Matrix Inverse and LU Decomposition
Presentation transcript:

Linear Systems of Equations: solution and applications Chapter 8 section 1: Solution of linear systems by matrix factorization Chapter 12 Data analysis by linear least squares

Matrix notation for system of linear equations: Ax = b, where A is matrix, x and b are “column vectors” A is not necessarily square A x = b mxn nx1 mx1 2x2 example: Reduce to 2 equations in 2 unknowns

Matrix notation for system of linear equations: Ax = b, where A is matrix, x and b are “column vectors” A is not necessarily square A x = b mxn nx1 mx1 2x2 example: Two vectors are equal if and only if their components are equal. a11 x1 + a12 x2 = b1 a21 x1 + a22 x2 = b2

A solution of Ax = b is a column vector x whose components define a linear combination of the columns of A that equals column vector b. There may be no such vector, a unique vector, or multiple vectors. If any x exist (unique or not), then Ax = b is said to by “consistent”. If A is “non singular” then there exist A-1 such that A-1 A = I then the unique solution is A-1 A x = A-1 b  x = A-1 b Explicit calculation of A-1 is not an efficient method to solve linear equations. Objective #1: An efficient method when A is a square matrix. Objective #2: Solve Ax = b when A is not square (discussed in the context of linear least squares problem)

Existence and Uniqueness: nxn matix A is nonsingular if any one of the following is true: (1) A has an inverse (2) det(A)  0 (3) rank(A) = n (rank = max number linearly independent rows or columns) (4) for any z  0, A z  0 If non of these are true, then A is singular. If A is singular then, depending on b, one of the following is true: (1) no solution exist (inconsistent), (2) infinitely many solutions exist (consistent) A is singular and Ax = b has a solution, then there must be a z  0 such that Az = 0 Then A(x + gz) = Ax + gAz = b: x + gz is a solution for any scalar g.

Span of a matrix span(A) is defined as the set of all vectors that can be formed by linear combinations of the columns of A. If A is non-singular and Ax=b, then x=A-1b is the unique vector in span(A) that is the solution of Ax=b if A is singular and A x = b is inconsistent, then b  span(A). if A is singular and A x = b is consistent, then b  span(A).

Solving Linear Systems: General strategy to solve Ax = b is to transform the system in a way that does not effect the solution but renders it easier to calculate. Let M by any nonsingular matrix and z be the solution of MAz = Mb Then z = (MA)-1 Mb = A-1 M-1 M b = A-1 b = x Call “pre-multiplying” or “multiply from the left” by M. Pre-multiplying by a nonsingular matrix does not change the solution of Ax = b By repeated use of this fact Ax = b can be reduced to a “triangular” system

You will need to write both of these codes. Triangular Linear Systems: In general, A in Ax = b is “triangular” if it enables solution by successive substitution. Permutation of rows or columns allows a general triangular matrix to take the upper triangular form defined by (ajk = 0 if j > k) or the lower triangular form defined by (ajk = 0 if j < k) . If A is a upper triangular matrix, solve A x = b by backward substitution (pseudo-code text p252) If A is a lower triangular matrix, solve A x = b by forward substitution x1 = b1/a11 xj = (bj - )/ajj j = 2,3, ...,n You will need to write both of these codes.

Solution of Ax = b by Gaussian Elimination: Gaussian elimination (naïve or with pivoting) uses elementary elimination matrices to find a matrix M such that MAx = Mb is an upper triangular system.

Transform a vector by a matrix to induce selective zeros = ?

What is the general form of Mk? Note similarity of M to the identity matrix In general, if ak is non-zero: mk+1 = ak+1 /ak , etc. What is the general form of Mk?

Define column vector m such that mj (j < k)=0 and mj (j > k) = aj/ak then Mk = I – mekT ,where ek is kth column of I outer product nx1 times 1xn ak is called the “pivot” and must be non-zero

Reduction of linear system Ax=b to upper triangular form (naïve Gauss elimination) Assume a11 is not zero Use a11 as pivot to obtain elementary elimination matrix M1 Multiply both sides of Ax=b by M1 (solution is unchanged) New system, M1Ax=M1b has zeroes in the 1st column except for a11 Assume a22 in M1A is not zero and use as pivot for M2 New system M2M1Ax=M2M1b has zeroes in the 1st and 2nd columns except for a11, a12, and a22 Continue until MAx=Mb, where M=Mn-1…M2M1 MA = U is upper triangular

pivot=1 m=[0,4,4]T pivot=-4 m=[0,0,0.5]T M1 = I – me1T M2 = I – me2T Solve by back substitution

Pseudo-code for naïve Gauss elimination for k=1 to n-1 loop over columns of A matrix for i=k+1 to n loop over rows of submatrix xm = aik/akk calculate multitier for j=k to n loop over columns of submatrix aij = aij-xmakj modify matrix in place end bi = bi – xmbk modify b-vector in place solve Ax=b by back substitution A->U is O(n3)

LU factorization: U=MA by Gauss elimination Let L = M-1 = (Mn-1…M2M1)-1 =M1-1M2-1…Mn-1-1 Then LU = LMA =M-1MA = A A = LU called “LU factorization of A” Show that Lk = Mk-1 = I + mekT Proof: Mk-1Mk = (I+mekT)(I-mekT) = I – mekT + mekT - m(ekTm)ekT = I (ekTm) is a scalar (1xn nx1) = zero because the only non-zero component of ekT is ak and mk is zero.

Construction of L L = M-1 = M1-1M2-1…Mn-1-1 Note: order of Mk-1 in the product increases from left to right Mk-1Mj-1 = (I+mkekT)(I+mjejT) = I + mkekT + mjejT + mk (ekTmj )ejT (ekTmj ) is a scalar = 0 because the only non-zero component of ekT is ak and mj is zero if k < j Mk-1Mj-1 = I + mkekT + mjejT L = M-1 = M1-1M2-1…Mn-1-1 = I + m1e1T + … + mn-1en-1T L = I + all the outer products used in the reduction of A to upper triangular form

1st column of L 2nd column of L pivot=1 m=[0,4,4]T pivot=-4 M1 = I – me1T pivot=-4 m=[0,0,0.5]T 2nd column of L M2 = I – me2T Solve by back substitution

Solving Ax =b by LU factorization of A Given L and U, how do I find x? Let M be the matrix that transforms A to upper triangular MatLab’s lu(A) returns L and U but not M The equation Ux = MAx = Mb = y can be solved by back substitution if y is known. Mb = y cannot be used to find y because M is not known. Multiply Ux = y from the left by L. LUx = Ly Note that A = LU Ax = Ly Note that Ax = b b = Ly solve for y by forward substitution Given y, solve Ux = y by back substitution

Gauss elimination with partial pivoting

e<emach = U = L=M-1

=

Find L explicit lower triangle LU factorization requires permutation = = L = L is not explicitly lower triangle PL is explicitly lower triangle = PLU explicit lower triangle LU factorization requires permutation

Solving Ax = b using MatLab’s [L,U,P]=lu(A) L is explicitly lower triangular P is the permutation matrix such that LU = PA PAx = Pb has the same solution as Ax = b Ux = MPAx = MPb = y Multiply from left by L LUx = Ly Note that PA = LU PAx = Ly Note that PAx = Pb Pb = Ly solved for y by forward substitution Given y, solve Ux = y for x by back substitution

Example: use MatLab’s lu(A) to solve Ax = b [L,U,P]=lu(A); newb=P*b; y=my_forsub(L,newb); x=my_backsub(U,y) test=A\b

Gauss-Jordan and LU factorization are O(n3) G - J requires 3 times as many operations After A-1 calculated solution of Ax = b takes about the same number of n2 operations as LU factorization

factorization “in place”

Problem 8.1-6d p312 Cholesky factorization Above the diagonal, set elements to zero

MatLab codes that you must write: . 1. backward substitution to solve Ax = b if A is a upper triangular 2. forward substitution to solve A x = b if A is a lower triangular 3. Cholesky factorization to solve Ax = b if A is positive definite (see previous slide) xn = bn/ann xj = (bj - )/ajj j = n-1,n-2,…,1 x1 = b1/a11 xj = (bj - )/ajj j = 2,3, ...,n

Use your Cholesky factorization code to solve Ax = b where Assignment 16, Due 4/11/19 Write a MATLAB codes for forward substitution, backward substitution and Cholesky factorization. Use the MATLAB function lu(A) and your forward and backward substitution codes to solve Ax = b where A = and b = Use your Cholesky factorization code to solve Ax = b where and b = A = Test your results using MatLab’s method x = A\b. Hand in copies of your codes and the command window where they were called.