About this class. Yousef Saad 1. Noah Lebovic 2. Jessica Lee 3. Abhishek Vashist Office hours: refer to the class web-page.

Similar documents
CSCI 2033 Spring 2016 ELEMENTARY COMPUTATIONAL LINEAR ALGEBRA

March 19 - Solving Linear Systems

Lecture 12: Solving Systems of Linear Equations by Gaussian Elimination

Fundamentals of Linear Algebra. Marcel B. Finan Arkansas Tech University c All Rights Reserved

1 - Systems of Linear Equations

MAC Module 1 Systems of Linear Equations and Matrices I

CSCI 8314 Spring 2017 SPARSE MATRIX COMPUTATIONS

Elementary Linear Algebra

Columbus State Community College Mathematics Department Public Syllabus

Lecture Notes in Mathematics. Arkansas Tech University Department of Mathematics. The Basics of Linear Algebra

Homework 1.1 and 1.2 WITH SOLUTIONS

Columbus State Community College Mathematics Department. CREDITS: 5 CLASS HOURS PER WEEK: 5 PREREQUISITES: MATH 2173 with a C or higher

Matrices and systems of linear equations

Properties of Linear Transformations from R n to R m

DM559 Linear and Integer Programming. Lecture 2 Systems of Linear Equations. Marco Chiarandini

Linear Equations in Linear Algebra

Lecture Notes in Linear Algebra

Lectures on Linear Algebra for IT

a s 1.3 Matrix Multiplication. Know how to multiply two matrices and be able to write down the formula

web: HOMEWORK 1

MATRICES. knowledge on matrices Knowledge on matrix operations. Matrix as a tool of solving linear equations with two or three unknowns.

Math 346 Notes on Linear Algebra

MTH Linear Algebra. Study Guide. Dr. Tony Yee Department of Mathematics and Information Technology The Hong Kong Institute of Education

1300 Linear Algebra and Vector Geometry Week 2: Jan , Gauss-Jordan, homogeneous matrices, intro matrix arithmetic

1300 Linear Algebra and Vector Geometry

Lecture 7: Introduction to linear systems

COURSE OF STUDY MATHEMATICS

MTH 2032 Semester II

MATH10212 Linear Algebra B Homework Week 5

Solving Linear Systems

MTH 464: Computational Linear Algebra

The value of a problem is not so much coming up with the answer as in the ideas and attempted ideas it forces on the would be solver I.N.

Linear Algebra I Lecture 8

Math 1553, Introduction to Linear Algebra

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

Matrices and Systems of Equations

Chapter 5. Linear Algebra. A linear (algebraic) equation in. unknowns, x 1, x 2,..., x n, is. an equation of the form

Lecture 22: Section 4.7

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

COURSE OUTLINE CHAFFEY COLLEGE

9.1 - Systems of Linear Equations: Two Variables

Math 3C Lecture 20. John Douglas Moore

MAT188H1S LINEAR ALGEBRA: Course Information as of February 2, Calendar Description:

Mathematical Methods in Engineering and Science Prof. Bhaskar Dasgupta Department of Mechanical Engineering Indian Institute of Technology, Kanpur

Pre-Calculus I. For example, the system. x y 2 z. may be represented by the augmented matrix

MATH 2331 Linear Algebra. Section 1.1 Systems of Linear Equations. Finding the solution to a set of two equations in two variables: Example 1: Solve:

(Linear equations) Applied Linear Algebra in Geoscience Using MATLAB

Math 200 A and B: Linear Algebra Spring Term 2007 Course Description

Maths for Signals and Systems Linear Algebra for Engineering Applications

2.3 Terminology for Systems of Linear Equations

Linear Algebra: Lecture Notes. Dr Rachel Quinlan School of Mathematics, Statistics and Applied Mathematics NUI Galway

Vector Spaces. 9.1 Opening Remarks. Week Solvable or not solvable, that s the question. View at edx. Consider the picture

Elementary Matrices. MATH 322, Linear Algebra I. J. Robert Buchanan. Spring Department of Mathematics

Systems of Linear Equations and Matrices

Linear Algebra. The analysis of many models in the social sciences reduces to the study of systems of equations.

System of Linear Equations

Exercise Sketch these lines and find their intersection.

MATH 3511 Lecture 1. Solving Linear Systems 1

Linear Equations in Linear Algebra

MATRICES. a m,1 a m,n A =

Linear equations in linear algebra

Midterm 1 Review. Written by Victoria Kala SH 6432u Office Hours: R 12:30 1:30 pm Last updated 10/10/2015

Contents. 1 Vectors, Lines and Planes 1. 2 Gaussian Elimination Matrices Vector Spaces and Subspaces 124

Algebra & Trig. I. For example, the system. x y 2 z. may be represented by the augmented matrix

ELEMENTARY LINEAR ALGEBRA

A First Course in Linear Algebra

A 2. =... = c c N. 's arise from the three types of elementary row operations. If rref A = I its determinant is 1, and A = c 1

Linear Systems and Matrices

Linear Algebra. Matrices Operations. Consider, for example, a system of equations such as x + 2y z + 4w = 0, 3x 4y + 2z 6w = 0, x 3y 2z + w = 0.

Algebra 2 Secondary Mathematics Instructional Guide

Introduction to Systems of Equations

Algebraic Methods in Combinatorics

Section 1.1: Systems of Linear Equations

Linear Algebra. Preliminary Lecture Notes

Systems of Linear Equations and Matrices

MATH 2200 Final LC Review

Math 1021, Linear Algebra 1. Section: A at 10am, B at 2:30pm

Chapter 5. Linear Algebra. Sections A linear (algebraic) equation in. unknowns, x 1, x 2,..., x n, is. an equation of the form

MAT 2037 LINEAR ALGEBRA I web:

Math 1314 Week #14 Notes

LECTURES 4/5: SYSTEMS OF LINEAR EQUATIONS

MATH2210 Notebook 2 Spring 2018

OHSx XM511 Linear Algebra: Solutions to Online True/False Exercises

Math 314 Lecture Notes Section 006 Fall 2006

Chapter 5. Linear Algebra. A linear (algebraic) equation in. unknowns, x 1, x 2,..., x n, is. an equation of the form

SYMBOL EXPLANATION EXAMPLE

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

CHAPTER 7: Systems and Inequalities

Section 1.1 System of Linear Equations. Dr. Abdulla Eid. College of Science. MATHS 211: Linear Algebra

ICS141: Discrete Mathematics for Computer Science I

MH1200 Final 2014/2015

Linear Algebra. Preliminary Lecture Notes

Matrix Basic Concepts

LINEAR ALGEBRA W W L CHEN

Chapter 2: Approximating Solutions of Linear Systems

2 Systems of Linear Equations

Linear Algebra Done Wrong. Sergei Treil. Department of Mathematics, Brown University

ELEMENTARY LINEAR ALGEBRA

Numerical Linear Algebra Homework Assignment - Week 2

Linear Algebra March 16, 2019

Transcription:

CSCI 2033 Spring 2018 ELEMENTARY COMPUTATIONAL LINEAR ALGEBRA Class time : MWF 10:10-11:00am Room : Blegen Hall 10 Instructor : Yousef Saad URL : www-users.cselabs.umn.edu/classes/spring-2018 /csci2033-morning/ About this class Me: TAs: Yousef Saad 1. Noah Lebovic 2. Jessica Lee 3. Abhishek Vashist Office hours: refer to the class web-page 4. Shashanka Ubaru 5. Jungseok Hong January 16, 2018 1-1 Start 1-0 1-1 What you will learn and why Course is about Basics of Numerical Linear Algebra, a.k.a. matrix computations Topic becoming increasingly important in Computer Science. Many courses require some linear algebra Course introduced in 2011 to fill a gap. In the era of big-data you need 1) statistics and 2) linear algebra CSCI courses where csci2033 plays an essential role: CSCI 5302 Analysis Num Algs * CSCI 5304 Matrix Theory * CSCI 5607 Computer Graphics I * CSCI 5512 Artif Intelligence II CSCI 5521 Intro to Machine Learning * CSCI 5551 Robotics * CSCI 5525 Machine Learning CSCI 5451 Intro Parall Comput * = csci2033 prerequisite for this course 1-2 Start 1-3 Start 1-2 1-3

Courses for which csci2033 can be helpful CSCI 5221 Foundations of Adv Networking CSCI 5552 Sensing/Estimation in Robotics CSCI 5561 Computer Vision CSCI 5608 Computer Graphics II CSCI 5619 VR and 3D Interaction CSCI 5231 Wireless and Sensor Networks CSCI 5481 Computational Techs. Genomics Objectives of this course Set 1 Fundamentals of linear algebra Vector spaces, matrices, [theoretical] Understanding bases, ranks, linear independence - Improve mathematical reasoning skills [proofs] set 2 Computational linear algebra Understanding common computational problems Solving linear systems Get a working knowledge of matlab Understanding computational complexity 1-4 Start 1-5 Start 1-4 1-5 Set 3 Linear algebra in applications See how numerical linear algebra arises in a few computer science -related applications. The road ahead: Plan in a nutshell Solving linear Systems of Equations Vector equations 1 2 Echelon Form 3 Linear Mappings Matrices, Matrix operations Matrix inverse 7 Linear Independance l 4 Column Spaces, Null Spaces, Rank 6 Eigenvalue problems Singular Value Decomposition Othogonality and Least squares problems 5 Determinants 1-6 Start 1-7 Start 1-6 1-7

Math classes Students who already have had Math 2243 or 2373 (Linear Algebra and Differential Equations) or a similar version of a linear algebra course : There is a good overlap with this course [about 40-50%] - but the courses are different.. You may be able to substitute 2033 for something else (by adding a course) See: https://www.cs.umn.edu/academics/undergraduate/guide/cs-requirements/acceptable-substitutes or UG adviser if you are in this situation. Logistics: We will use Moodle only to post grades Main class web-site is : www-users.cselabs.umn.edu/classes/spring-2018/ csci2033-morning/ There you will find : Lecture notes Homeworks [and solutions] Additional exercises [do before indicated class].. and more 1-8 Start 1-9 Start 1-8 1-9 Three Recitation Sections: About lecture notes: sec 002 which we will call Sec. 2 sec 003 which we will call Sec. 3 sec 004 which we will call Sec. 4 All in Amundson Hall 240... - 10:10 11:00am - 11:15 12:05pm - 12:20 1:10pm Lecture notes will be posted on the class web-site usually before the lecture. [if I am late do not hesitate to send me e-mail] Review them and try to get some understanding if possible before class. Read the relevant section (s) in the text Lecture note sets are grouped by topics (sections in the textbook) rather than by lecture. In the notes the symbol indicates suggested easy exercises or questions often [not always] done in class. 1-10 Start 1-11 Start 1-10 1-11

In-class Practice Exercises Posted in advance see HWs web-page You should do them before class (!Important). No need to turn in anything. But...... beware that quizzes could be quite similar I will often start the class with these practice exercises The quizzes are like short mid-terms. There will be 8 of them [ 20mn each] Matlab You will need to use matlab for testing algorithms. Limited lecture notes on matlab + Other documents will be posted in the matlab web-site. Most important:.. I post the matlab diaries used for the demos (if any). First few recitations will cover tutorials on matlab If you do not know matlab at all and have difficulties with it see me or one of the TAs at office hours. This ought to help get you started. 1-12 Start 1-13 Start 1-12 1-13 One final point on lecture notes These notes are evolving. You can help make them better report errors and provide feedback. There will be much more going on in the classroom - so the notes are not enough for studying! Sometimes they are used as a summary. Recommendation: start with lecture notes - then study relevant parts in text. There are a few topics that are not covered well in the text (e.g., complexity). Rely on lectures and the notes (when available) for these. Introduction. Math Background We will often need proofs in this class. A proof is a logical argument to show that a given statement in true One of the stated goals of csci2033 is to improve mathematical reasoning skills You should be able to prove simple statements Here are the most common types of proofs 1-14 Start 1-15 intro 1-14 1-15

Proof by contradiction: Idea: prove that the contrary of the statement implies an impossible ( absurd ) conclusion Show that 2 is not a rational number [famous proof dating back to Pythagoras] Proof: Assume the contrary is true. Then 2 = p/q. If p and q can be divided by the same integer divide them both by this integer. Now p and q cannot be both even. The equality 2 = p/q implies p 2 = 2q 2. This means p 2 is even. However p is also even because the square of an odd number is odd. We now write p = 2k. Then 4k 2 = 2q 2. Hence q 2 = 2k 2 and so q is also even. Contradiction. Proof by induction Problem: to prove that a certain property P n is true for all n. Method: (a) Base: Show that P init is true (b) Induction Hypothesis: Assume that P n is true for some n (n init). With this assumption prove that P n+1 is true.. Important point: A big part of the proof is to clearly state P n Show that 1 + 2 + 3 + + n = n(n + 1)/2 [Challenge] Show: + 2 2 + + n 2 = n(n+1)(2n+1) 6 1-16 intro 1-17 intro 1-16 1-17 By counter-example Proof by construction [to prove a statement is not true] All students in MN are above average. (constructive proof) The statement is that some object exists. We need to construct this object. By a purely logical argument Pythagoras theorem from a purely geometric argument b a b c a c c Behold! Show that for two sets A, B we have A B = A B 1-18 intro a c b a b A few terms/symbols used x X x belongs to set X x n i=1 for all x Summation from i = 1 to i = n A B Assertion A implies assertion B A iff B A is true If and only if B is true [i.e., A B and B A] Greek letters α, β, γ,... represent scalars Lower case latin letters u, v,... often represent vectors Upper case letters A, B,.. often represent matrices More will be introduced on the way 1-19 intro 1-18 1-19

Algorithms - complexity Not emphasized in text Find (google) the origin of the word Algorithm An algorithm is a sequence of instructions given to a machine (typically a computer) to solve a given problem An example: Method: calculate Finding the square root of a number. x new = 0.5 ( x old + a x old ) There are different ways of implementing this Some ways may be more economical than others Some ways will lead to more numerical errors than others [not in this particular case] xn = a; while(abs(xn*xn - a) > 1.e-06 * a) xn = 0.5*(xn+a/xn) end Try this for a = 5. How many steps are needed? What is the total number of operations (+,*,/)?... until x new no longer changes much. Start with x = a 1-20 intro 1-21 intro 1-20 1-21 The issue of cost ( complexity ) For small problems cost may not be important - except when the operation is repeated many times. For systems of equations in the thousands, then the algorithm could make a huge difference. What to count? Memory copy / move. Comparisons of numbers (integers, floating-points) Floating point operations: add, multiply, divide (more expensive) Intrinsic functions: sin, cos, exp,, etc.. a few times more expensive than add/ multiply. Assume we have 4 algorithms whose costs (number of operations) are n3 6, n2 2, n log 2 n, and n respectively, where n is the size of the problem. Compare the times for the 4 algorithms to execute when n = 1000 Answer: [assume one operation costs 1µsec ] n 3 109 6 6 n 2 2 106 2 µsec sec. n log n n 1 ms. µsec = 1000 6 sec 2.78mn 10 3 log n µsec 10 3 10 µsec = 10ms In matrix computations (this course) we only count floating point operations: (, +, /) 1-22 intro 1-23 intro 1-22 1-23

Cost = number of operations to complete a given algorithm = function of n the problem size Will find something like [example] C(n) = 2n 3 + 6n 2 + 3n Compare C(100), C(200) and 8C(100). Explain Suppose it takes 1 sec. run the algorithm for a certain value of n (large), how long would it take to run the same algorithm on a problem of size 2n? We are interested in cases with large values of n Major point: only the leading term 2n 3 matters - because the rest is small (relatively to 2n 3 ) when n is large. We will say that the cost is of order 2n 3 or even order n 3 [meaning that it increases like the cube of n as n increases] 1-24 intro 1-25 intro 1-24 1-25 Linear systems A linear equation in the variables x 1,, x n is an equation that can be written in the form a 1 x 1 + a 2 x 2 + + a n x n = b, LINEAR EQATIONS [1.1] + b and the coefficients a 1,, a n are known real or complex numbers. x 1 + 2x 2 = 1 In the above equation x 1 and x 2 are the unknowns or variables. The equation is satisfied when x 1 = 1, x 2 = 1. It is also satisfied for x 1 = 3, x 2 =? 1-27 Text: 1.1 Systems1 1-26 1-27

A system of linear equations (or a linear system) is a collection of one or more linear equations involving the same variables say, x 1,..., x n. A solution of the system is a list (s 1, s 2,..., s n ) of values for x 1, x 2,..., x n, respectively, which make the equations satisfied. Here is a system involving 2 unknowns: { 2x1 +x 2 = 4 x 1 +2x 2 = 3 The values x 1 = 1, x 2 = 2 satisfy the system of equations. s 1 = 1, s 2 = 2 is a solution. The equation 2x 1 + x 2 = 4 represents a line in the plane. x 2 + 2x 2 = 3 represents another line. The solution represents the point where the two lines intersect. 1-28 Text: 1.1 Systems1 Three winners of a competition labeled G, S, B (for gold, silver, bronze) are to share as a prize 30 coins. The conditions are that 1) G s share of the coins should equal the shares of S and B combined and 2) The difference between the shares of G and S equals the difference between the shares of S and B. How many coins should each of G, S, B receive? Should formulate as a system of equations: 3 conditions result will be 3 equations 3 unknowns (# coins for each of winner) 1-29 Text: 1.1 Systems1 1-28 1-29 Let x 1 = number of coins to be won by G, x 2 = number of coins to be won by S, and x 3 = number of coins to be won by B The conditions give us 3 equations which are: 1) Total number of coins = 30 2) G s share = sum of S and B 3) differences G -S same as S-B System of equations: We will see later how to solve this system x 1 +x 2 +x 3 = 30 x 1 = x 2 + x 3 x 1 x 2 = x 2 x 3 x 1 +x 2 +x 3 = 30 x 1 x 2 x 3 = 0 x 1 2x 2 +x 3 = 0 The set s 1 = 15, s 2 = 10, s 3 = 5 is a solution It is the only solution 1-30 Text: 1.1 Systems1 The set of all possible solutions is called the solution set of the linear system. Two linear systems are called equivalent if they have the same solution set. A system of linear equations can have: 1. no solution, or 2. exactly one solution, or 3. infinitely many solutions. [The above result will be seen in detail later in this class] Definition: A system of linear equations is said to be inconsistent if it has no solution (Case 1 above). It is consistent if it has at least one solution (Case 2 or Case 3 above). 1-31 Text: 1.1 Systems1 1-30 1-31

Consider the following three systems of equations: Matrix Notation { x1 x 2 = 1 x 1 +2x 2 = 4 1 2 x x = 1 x + 2 x = 4 { x 1 x 2 = 1 2x 1 +2x 2 = 2 2 x + 2 x = 2 x x = 1 { x 1 x 2 = 1 2x 1 +2x 2 = 2 x x = 1 2 x + 2 x = 2 Exactly one solution No solution Inifinitely many solutions Consistent Inconsistent Consistent 1-32 Text: 1.1 Systems1 The essential information of a linear system is recorded compactly in a rectangular array called a matrix. For the following x 1 +x 2 +x 3 = 30 system of equations: x 1 x 2 x 3 = 0 x 1 2x 2 +x 3 = 0 The array to the right is called the coefficient matrix of the system: 1 1 1 1 1 1 1 2 1 And the right-hand side is: 30 0 0 An augmented matrix of a system consists of the coefficient matrix with the R.H.S. added as a last column Note: R.H.S. or RHS = short for right-hand side column. 1-33 Text: 1.1 Systems1 1-32 1-33 For the above system the augmented matrix is 1 1 1 30 1 1 1 0 or 1 1 1 30 1 1 1 0 1 2 1 0 1 2 1 0 You can think of the array on the left as the set of 3 rows each representing an equation: x 1 x 2 x 3 b 1 1 1 1 30 x 1 x 2 x 3 b 2 1 1 1 0 x 1 x 2 x 3 b 3 1 2 1 0 To solve systems of equations we manipulate these rows to get equivalent equations that are easier to solve. Can we add two equations/rows? Add equations 1 and 2. What do you get? Now add equations 2 and 3. What do you get? Can you compute x 2? Finally obtain x 3 This shows an ad-hoc [intuitive] way of manipulating equations to solve the system. Gaussian Elimination [coming shortly] shows a systematic way Basic Strategy: replace a system with an equivalent system (i.e., one with the same solution set) that is easier to solve. 1-34 Text: 1.1 Systems1 1-35 Text: 1.1 Systems1 1-34 1-35

Terminology on matrices An m n matrix is a rectangular array of numbers with m rows and n columns. We say that A is of size m n (The number of rows always comes first.) In matlab: [m, n] = size(a) returns the size of A If m = n the matrix is said to be square otherwise it is rectangular The case when n = 1 is a special case where the matrix consists of just one column. The matrix then becomes a vector and this will be revisited later. The right-hand side column is one such vector. Thus a linear system consists of a coefficient matrix A and a right-hand side vector b. Equivalent systems We do not change the solution set of a linear system if we * Permute two equations * Multiply a whole equation by a nonzero scalar * Add an equation to another. Text: Two systems are row-equivalent if one is obtained from the other by a succession of the above operations Eliminating an unknown consists of combining rows so that the coefficients for that unknown in the equations become zero. Gaussian Elimination: performs eliminations to reduce the system to a triangular form 0 0 0 0 0 0 1-36 Text: 1.1 Systems1 1-37 Text: 1.1 Systems1 1-36 1-37 Triangular linear systems are easy to solve One equation can be trivially solved: the last one. 2x 1 + 4x 2 + 4x 3 = 2 5x 2 2x 3 = 1 2x 3 = 4 x 3 = 2 x 3 is known we can now solve the 2nd equation: 2 4 4 2 0 5 2 1 0 0 2 4 5x 2 2x 3 = 1 5x 2 2 2 = 1 x 2 = 1 Finally x 1 can be determined similarly: 2x 1 + 4 1 + 4 2 = 2 x 1 = 5 Triangular linear systems - Algorithm Upper triangular system of size n ALGORITHM : 1 For i = n : 1 : 1 do: t := b i For j = i + 1 : n do t := t a ij x j End x i = t/a ii End Back-Substitution algorithm We must require that each a ii 0 1-38 Text: 1.1 Systems1 1-39 Text: 1.1 Systems1 1-38 1-39

i = 5 i = 4 i = 3 i = 2 i = 1 x 1 x 2 x 2 x 4 x 5 b a 11 a 12 a 13 a 14 a 15 b 1 a 22 a 23 a 24 a 25 b 2 a 33 a 34 a 35 b 3 a 44 a 45 b 4 a 55 b 5 x 5 = b 5 /a 55 x 4 = [b 4 a 45 x 5 ]/a 44 x 3 = [b 3 a 34 x 4 a 35 x 5 ]/a 33 x 2 = [b 2 a 23 x 3 a 24 x 4 a 25 x 5 ]/a 22 x 1 = [b 2 a 12 x 2 a 13 x 3 a 14 x 4 a 15 x 5 ]/a 11 For example, when i = 3, x 4, x 5 are already known, so Write a matlab version of the algorithm Cost: How many operations (+,, /) are needed altogether to solve a triangular system? [Hint: visualize the operations on the augmented array. What does step i cost?] If n is large and the n n system is solved in 2 seconds, how long would it take you to solve a new system of size (2n) (2n)? a 33 x 3 + a} 34 x 4 {{ + a 35 x} 5 = b 3 x 3 = b 3 a 34 x 4 a 35 x 5 a 33 known 1-40 Text: 1.1 Systems1 1-41 Text: 1.1 Systems1 1-40 1-41