CSCI 2033 Spring 2016 ELEMENTARY COMPUTATIONAL LINEAR ALGEBRA

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

MAC Module 1 Systems of Linear Equations and Matrices I

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

CSCI 8314 Spring 2017 SPARSE MATRIX COMPUTATIONS

March 19 - Solving Linear Systems

Lecture 12: Solving Systems of Linear Equations by Gaussian Elimination

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

1 - Systems of Linear Equations

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

Properties of Linear Transformations from R n to R m

Matrices and systems of linear equations

Elementary Linear Algebra

web: HOMEWORK 1

1300 Linear Algebra and Vector Geometry

Columbus State Community College Mathematics Department Public Syllabus

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

Lecture Notes in Linear Algebra

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

Math 346 Notes on Linear Algebra

Lectures on Linear Algebra for IT

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

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

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

Homework 1.1 and 1.2 WITH SOLUTIONS

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

Linear Equations in Linear Algebra

Lecture 22: Section 4.7

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

(Linear equations) Applied Linear Algebra in Geoscience Using MATLAB

MTH 2032 Semester II

Math 3C Lecture 20. John Douglas Moore

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

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.

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

ELEMENTARY LINEAR ALGEBRA

Matrices and Systems of Equations

Solving Linear Systems

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:

Lecture 7: Introduction to linear systems

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

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

ELEMENTARY LINEAR ALGEBRA

COURSE OF STUDY MATHEMATICS

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

MATH10212 Linear Algebra B Homework Week 5

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

System of Linear Equations

Section Matrices and Systems of Linear Eqns.

2.3 Terminology for Systems of Linear Equations

Linear Equations in Linear Algebra

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

MTH 464: Computational Linear Algebra

MATH 3511 Lecture 1. Solving Linear Systems 1

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

Maths for Signals and Systems Linear Algebra for Engineering Applications

Math 1553, Introduction to Linear Algebra

MAT 2037 LINEAR ALGEBRA I web:

Linear equations in linear algebra

Algebraic Methods in Combinatorics

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

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

Systems of Linear Equations and Matrices

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

Math 1314 Week #14 Notes

9.1 - Systems of Linear Equations: Two Variables

Introduction to Systems of Equations

GAUSSIAN ELIMINATION AND LU DECOMPOSITION (SUPPLEMENT FOR MA511)

LINEAR ALGEBRA W W L CHEN

Graduate Mathematical Economics Lecture 1

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

36 What is Linear Algebra?

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

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

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

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 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.

LECTURES 4/5: SYSTEMS OF LINEAR EQUATIONS

ANALYTICAL MATHEMATICS FOR APPLICATIONS 2018 LECTURE NOTES 3

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

Linear Algebra. Preliminary Lecture Notes

Linear Algebra March 16, 2019

Systems of Linear Equations and Matrices

MATH2210 Notebook 2 Spring 2018

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

SYMBOL EXPLANATION EXAMPLE

Prerequisite: Qualification by assessment process or completion of Mathematics 1050 or one year of high school algebra with a grade of "C" or higher.

Numerical Linear Algebra Homework Assignment - Week 2

Exercise Sketch these lines and find their intersection.

MH1200 Final 2014/2015

CHAPTER 7: Systems and Inequalities

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

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

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

Numerical Methods Lecture 2 Simultaneous Equations

COURSE OUTLINE CHAFFEY COLLEGE

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

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

Number of solutions of a system

ICS141: Discrete Mathematics for Computer Science I

Linear Algebra. Preliminary Lecture Notes

Transcription:

CSCI 2033 Spring 2016 ELEMENTARY COMPUTATIONAL LINEAR ALGEBRA Class time : MW 4:00-5:15pm Room : Vincent Hall 16 Instructor : Yousef Saad URL : www-users.cselabs.umn.edu/classes/spring-2016 /csci2033 afternoon February 7, 2016

About this class Me: TAs: Yousef Saad 1. Dimitrios Kottas 2. James Cannalte 3. Alex Dahl 1-2 Start

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 1-3 Start

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-4 Start

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 1-5 Start

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-6 Start

Set 3 Linear algebra in applications See how numerical linear algebra arises in a few computer science -related applications. 1-7 Start

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-8 Start

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. You can substitute 2033 for something else See UG adviser if you are in this situation. 1-9 Start

Logistics: We will use Moodle only to post grades Main class web-site is : www-users.cselabs.umn.edu/classes/spring-2016/ csci2033 afternoon/ There you will find : Lecture notes Homeworks [and solutions] Additional exercises [do before indicated class].. and more 1-10 Start

Three Recitation Sections: sec 011 which we will call Sec. 1 sec 012 which we will call Sec. 2 sec 013 which we will call Sec. 3 All in Keller Hall 2-260 All lead by Dimitrios Kottas - 2:30 3:20 pm - 3:35 4:25pm - 4:40 5:30pm 1-11 Start

About lecture notes: 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-12 Start

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...... prepare for an occasional follow-up Quiz I will usually start the class with these practice exercises On occasion a quiz will follow There may also be quizzes at other times 1-13 Start

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-14 Start

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. 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. 1-15 Start

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-16 intro

Proof by contradiction: Idea: prove that the contrary of the statement implies an impossible ( absurd ) conclusion Example: 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. 1-17 intro

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 Example: Show that 1 + 2 + 3 + + n = n(n + 1)/2 [Challenge] Show: 1 2 + 2 2 + + n 2 = n(n+1)(2n+1) 6 1-18 intro

By counter-example [to [prove a statement is not true] Example: Proof by construction All students in MN are above average. (constructive proof) The statement is that some object exists. We need to construct this object. a b By a purely logical argument Example: Pythagoras theorem from a purely geometric argument b a b c c c Behold! a c a b Show that for two sets A, B we have A B = A B 1-19 intro

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-20 intro

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: Finding the square root of a number. Method: calculate x new = 0.5 ( x old + a x old )... until x new no longer changes much. Start with x = a 1-21 intro

There are different ways of implementing this Some ways may be more economical than others Some ways will lead to more numerical errors [not in this particular case] ALGORITHM : 1 Algorithm for Square Root Finding 0. Input: a, tolerance tol 1. Start: xn := a 2. Do : 3. x := xn [To save xn] 4. xn := 0.5 (x + a/x) 5. until ( xn x < xn tol) [stopping criterion] 1-22 intro

Matlab function for square root Matlab functions will be seen later [recitations or class] this is given just as an illustration. function x = mysqrt(a, tol, maxits) % x = mysqrt(a, tol, maxits) % computes the square root of a (a must be > 0 ) if (a <0) error( *** a < 0 ) end %%-------------------- main loop for i=1:maxits x = xn ; xn = 0.5*(x+a/x) if (abs(xn-x) < tol*xn) break end end You can find slightly better implementations 1-23 intro

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. 1-24 intro

Example: 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 1 2 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-25 intro

Cost = number of operations to complete a given algorithm = function of n the problem size Will find something like [example] C(n) = 2n 3 + n 2 3n 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-26 intro

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? 1-27 intro

LINEAR EQATIONS [1.1] +

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, b and the coefficients a 1,, a n are known real or complex numbers. Example: 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-29 Text: 1.1 Systems1

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. Example: 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-30 Text: 1.1 Systems1

Example: 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-31 Text: 1.1 Systems1

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-32 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-33 Text: 1.1 Systems1

Example: Consider the following three systems of equations: { x1 x 2 = 1 x 1 +2x 2 = 4 { x 1 x 2 = 1 2x 1 +2x 2 = 2 { x 1 x 2 = 1 2x 1 +2x 2 = 2 1 x x = 1 1 2 x + 2 x = 4 1 2 2 x + 2 x = 2 1 2 x x = 1 1 2 x x = 1 1 2 2 x + 2 x = 2 1 2 2 Exactly one solution No solution Inifinitely many solutions Consistent Inconsistent Consistent 1-34 Text: 1.1 Systems1

Matrix Notation The essential information of a linear system is recorded compactly in a rectangular array called a matrix. For the following system of equations: The array to the right is called the coefficient matrix of the system: x 1 +x 2 +x 3 = 30 x 1 x 2 x 3 = 0 x 1 2x 2 +x 3 = 0 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-35 Text: 1.1 Systems1

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. 1-36 Text: 1.1 Systems1

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-37 Text: 1.1 Systems1

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. 1-38 Text: 1.1 Systems1

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-39 Text: 1.1 Systems1

Triangular linear systems are easy to solve Example: 2x 1 + 4x 2 + 4x 3 = 2 5x 2 2x 3 = 1 2x 3 = 4 2 4 4 2 0 5 2 1 0 0 2 4 One equation can be trivially solved: the last one. x 3 = 2 x 3 is known we can now solve the 2nd equation: 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 1-40 Text: 1.1 Systems1

Triangular linear systems - Algorithm Upper triangular system of size n ALGORITHM : 2 Back-Substitution algorithm 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 We must require that each a ii 0 1-41 Text: 1.1 Systems1

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 a 33 x 3 + a 34 x 4 + a 35 x 5 }{{} known = b 3 x 3 = b 3 a 34 x 4 a 35 x 5 a 33 1-42 Text: 1.1 Systems1

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)? 1-43 Text: 1.1 Systems1