Section 6.5. Least Squares Problems

Similar documents
Announcements Monday, November 26

Math 2802 Applications of Linear Algebra. School of Mathematics Georgia Institute of Technology

To find the least-squares solution to Ax = b, we project b onto Col A to obtain the vector ) b = proj ColA b,

EK102 Linear Algebra PRACTICE PROBLEMS for Final Exam Spring 2016

Chapter 6. Orthogonality and Least Squares

Announcements Monday, November 19

Chapter 12 Review Vector. MATH 126 (Section 9.5) Vector and Scalar The University of Kansas 1 / 30

Week Quadratic forms. Principal axes theorem. Text reference: this material corresponds to parts of sections 5.5, 8.2,

Section 6.4. The Gram Schmidt Process

Conic Sections. Geometry - Conics ~1~ NJCTL.org. Write the following equations in standard form.

SKILL BUILDER TEN. Graphs of Linear Equations with Two Variables. If x = 2 then y = = = 7 and (2, 7) is a solution.

1.6 and 5.3. Curve Fitting One of the broadest applications of linear algebra is to curve fitting, especially in determining unknown coefficients in

Notes 10-3: Ellipses

Orthogonal Complements

Announcements Monday, November 26

The coordinates of the vertex of the corresponding parabola are p, q. If a > 0, the parabola opens upward. If a < 0, the parabola opens downward.

Pure Math 30: Explained! 81

Announcements Monday, November 19

Math 3191 Applied Linear Algebra

Math 3191 Applied Linear Algebra

Announcements Wednesday, November 15

Section 6.1. Inner Product, Length, and Orthogonality

Orthonormal Bases; Gram-Schmidt Process; QR-Decomposition

8.6 Translate and Classify Conic Sections

3. A( 2,0) and B(6, -2), find M 4. A( 3, 7) and M(4,-3), find B. 5. M(4, -9) and B( -10, 11) find A 6. B(4, 8) and M(-2, 5), find A

Linear Algebra. Chapter 8: Eigenvalues: Further Applications and Computations Section 8.2. Applications to Geometry Proofs of Theorems.

Solutions to Review Problems for Chapter 6 ( ), 7.1

Conic Sections and Polar Graphing Lab Part 1 - Circles

Linear Algebra Final Exam Study Guide Solutions Fall 2012

Math 290, Midterm II-key

Announcements Wednesday, November 15

MAT 242 CHAPTER 4: SUBSPACES OF R n

Review Notes for Linear Algebra True or False Last Updated: February 22, 2010

Orthogonality and Least Squares

Rotation of Axes. By: OpenStaxCollege

Lecture 9: Vector Algebra

Final Examination 201-NYC-05 - Linear Algebra I December 8 th, and b = 4. Find the value(s) of a for which the equation Ax = b

Chapter 6 - Orthogonality

Chapter Practice Test Name: Period: Date:

Vector Spaces, Orthogonality, and Linear Least Squares

Worksheet for Lecture 25 Section 6.4 Gram-Schmidt Process

Least squares problems Linear Algebra with Computer Science Application

LINEAR ALGEBRA QUESTION BANK

Chapter 5. Eigenvalues and Eigenvectors

Tuesday, 3/28 : Ch. 9.8 Cubic Functions ~ Ch. 9 Packet p.67 #(1-6) Thursday, 3/30 : Ch. 9.8 Rational Expressions ~ Ch. 9 Packet p.

Announcements Monday, October 29

1. Determine by inspection which of the following sets of vectors is linearly independent. 3 3.

3. A( 2,0) and B(6, -2), find M 4. A( 3, 7) and M(4,-3), find B. 5. M(4, -9) and B( -10, 11) find A 6. B(4, 8) and M(-2, 5), find A

Final A. Problem Points Score Total 100. Math115A Nadja Hempel 03/23/2017

Announcements Wednesday, November 7

College Algebra. Basics to Theory of Equations. Chapter Goals and Assessment. John J. Schiller and Marie A. Wurster. Slide 1

Lecture 6 Positive Definite Matrices

7. Dimension and Structure.

Worksheet for Lecture 15 (due October 23) Section 4.3 Linearly Independent Sets; Bases

Section 5.5. Complex Eigenvalues (Part II)

Math 54 HW 4 solutions

Projections and Least Square Solutions. Recall that given an inner product space V with subspace W and orthogonal basis for

Lesson 6: Switching Between Forms of Quadratic Equations Unit 5 Quadratic Functions

Circles. Example 2: Write an equation for a circle if the enpoints of a diameter are at ( 4,5) and (6, 3).

A A x i x j i j (i, j) (j, i) Let. Compute the value of for and

2-7 Solving Quadratic Inequalities. ax 2 + bx + c > 0 (a 0)

Assignment 1 Math 5341 Linear Algebra Review. Give complete answers to each of the following questions. Show all of your work.

MATH 20F: LINEAR ALGEBRA LECTURE B00 (T. KEMP)

Math 2940: Prelim 1 Practice Solutions

Linear Algebra MATH20F Midterm 1

Systems of Nonlinear Equations and Inequalities: Two Variables

Announcements Wednesday, November 7

Transpose & Dot Product

Problem Set (T) If A is an m n matrix, B is an n p matrix and D is a p s matrix, then show

SOLUTIONS FOR PROBLEMS 1-30

Distance and Midpoint Formula 7.1

ORTHOGONALITY AND LEAST-SQUARES [CHAP. 6]

complex dot product x, y =

Homework 5. (due Wednesday 8 th Nov midnight)

Honors Precalculus Chapter 8 Summary Conic Sections- Parabola

Transpose & Dot Product

APPLICATIONS The eigenvalues are λ = 5, 5. An orthonormal basis of eigenvectors consists of

Span & Linear Independence (Pop Quiz)

MATH 1553 PRACTICE FINAL EXAMINATION

10/22/16. 1 Math HL - Santowski SKILLS REVIEW. Lesson 15 Graphs of Rational Functions. Lesson Objectives. (A) Rational Functions

Section 6.2, 6.3 Orthogonal Sets, Orthogonal Projections

Linear Systems. Class 27. c 2008 Ron Buckmire. TITLE Projection Matrices and Orthogonal Diagonalization CURRENT READING Poole 5.4

Practice Problems for Exam 3 (Solutions) 1. Let F(x, y) = xyi+(y 3x)j, and let C be the curve r(t) = ti+(3t t 2 )j for 0 t 2. Compute F dr.

3. Identify and find the general solution of each of the following first order differential equations.

Math 5630: Iterative Methods for Systems of Equations Hung Phan, UMass Lowell March 22, 2018

Please do not start working until instructed to do so. You have 50 minutes. You must show your work to receive full credit. Calculators are OK.

For each problem, place the letter choice of your answer in the spaces provided on this page.

Ch 9/10/11/12 Exam Review

1 The Derivative and Differrentiability

Section 4.5. Matrix Inverses

Linear algebra I Homework #1 due Thursday, Oct. 5

7. Symmetric Matrices and Quadratic Forms

x 1 x 2. x 1, x 2,..., x n R. x n

Video 15: PDE Classification: Elliptic, Parabolic and Hyperbolic March Equations 11, / 20

x y + z = 3 2y z = 1 4x + y = 0

Absolute Value Equations and Inequalities. Use the distance definition of absolute value.

Lecture 11: Finish Gaussian elimination and applications; intro to eigenvalues and eigenvectors (1)

1. Projective geometry

Math 2331 Linear Algebra

Precalculus Conic Sections Unit 6. Parabolas. Label the parts: Focus Vertex Axis of symmetry Focal Diameter Directrix

Transcription:

Section 6.5 Least Squares Problems

Motivation We now are in a position to solve the motivating problem of this third part of the course: Problem Suppose that Ax = b does not have a solution. What is the best possible approximate solution? To say Ax = b does not have a solution means that b is not in Col A. The closest possible b for which Ax = b does have a solution is b = proj Col A (b). Then A x = b is a consistent equation. A solution x to A x = b is a least squares solution.

Least Squares Solutions Let A be an m n matrix. Definition A least squares solution of Ax = b is a vector x in R n such that for all x in R n. b A x b Ax Note that b A x is in (Col A). b b A x Ax Ax Ax Col A [interactive] A x = b = proj Col A (b) In other words, a least squares solution x solves Ax = b as closely as possible. Equivalently, a least squares solution to Ax = b is a vector x in R n such that A x = b = proj Col A (b). This is because b is the closest vector to b such that A x = b is consistent.

Least Squares Solutions Computation Theorem The least squares solutions to Ax = b are the solutions to (A T A) x = A T b. This is just another Ax = b problem, but with a square matrix A T A! Note we compute x directly, without computing b first. Why is this true? We want to find x such that A x = proj Col A (b). This means b A x is in (Col A). Recall that (Col A) = Nul(A T ). So b A x is in (Col A) if and only if A T (b A x) = 0. In other words, A T A x = A T b. Alternative when A has orthogonal columns v 1, v 2,..., v n: n b v i b = proj Col A (b) = v i v i v i i=1 ( b v1 The right hand side equals A x, where x =, v 1 v 1 b v 2 v 2 v 2,, ) b v n. v n v n

Least Squares Solutions Example Find the least squares solutions to Ax = b where: 1 0 6 A = 1 1 b = 0. 1 2 0 We have and A T A = A T b = ( 1 1 1 0 1 2 Row reduce: ( 3 3 6 3 5 0 ( 1 1 1 0 1 2 ) 1 0 1 1 = 1 2 ) 6 0 = 0 ( ) 3 3 3 5 ( ) 6. 0 ) ( 1 0 5 0 1 3 ( ) 5 So the only least squares solution is x =. 3 ).

Least Squares Solutions Example, continued How close did we get? 1 0 ( ) 5 b = A x = 1 1 5 = 2 3 1 2 1 The distance from b is 6 5 b A x = 0 2 0 1 = 1 2 1 = 1 2 + ( 2) 2 + 1 2 = 6. z y x [interactive] v 2 5v 1 6 3v 2 v 1 Col A b ( ) 5 b = A 3 Let 1 v 1 = 1 and 0 v 2 = 1 1 2 be the columns of A, and let B = {v 1, v 2}. Note x = ( 5 3) is just the B-coordinates of b, in Col A = Span{v1, v 2}.

Least Squares Solutions Second example Find the least squares solutions to Ax = b where: 2 0 1 A = 1 1 b = 0. 0 2 1 We have and A T A = ( ) 2 0 2 1 0 1 1 = 0 1 2 0 2 A T b = ( ) 1 2 1 0 0 = 0 1 2 1 ( 5 ) 1 1 5 ( ) 2. 2 Row reduce: ( ) ( ) 5 1 2 1 0 1/3. 1 5 2 0 1 1/3 ( ) 1/3 So the only least squares solution is x =. [interactive] 1/3

Least Squares Solutions Uniqueness When does Ax = b have a unique least squares solution x? Theorem Let A be an m n matrix. The following are equivalent: 1. Ax = b has a unique least squares solution for all b in R n. 2. The columns of A are linearly independent. 3. A T A is invertible. In this case, the least squares solution is (A T A) 1 (A T b). Why? If the columns of A are linearly dependent, then A x = b has many solutions: v 2 v 1 b [interactive] v 3 Col A b = A x Note: A T A is always a square matrix, but it need not be invertible.

Application Data modeling: best fit line Find the best fit line through (0, 6), (1, 0), and (2, 0). The general equation of a line is So we want to solve: y = C + Dx. 6 = C + D 0 0 = C + D 1 0 = C + D 2. In matrix form: 1 0 ( ) 6 1 1 C = 0. D 1 2 0 [interactive] (0, 6) 1 y = 3x + 5 2 (2, 0) (1, 0) 1 We ( already saw: the least squares solution is 5 ) 3. So the best fit line is y = 3x + 5. ( ) 5 A 6 0 = 1 2 3 0 1

Poll Poll What does the best fit line minimize? A. The sum of the squares of the distances from the data points to the line. B. The sum of the squares of the vertical distances from the data points to the line. C. The sum of the squares of the horizontal distances from the data points to the line. D. The maximal distance from the data points to the line. Answer: B. See the picture on the previous slide.

Application Best fit ellipse Find the best fit ellipse for the points (0, 2), (2, 1), (1, 1), ( 1, 2), ( 3, 1), ( 1, 1). The general equation for an ellipse is So we want to solve: x 2 + Ay 2 + Bxy + Cx + Dy + E = 0 (0) 2 + A(2) 2 + B(0)(2) + C(0) + D(2) + E = 0 (2) 2 + A(1) 2 + B(2)(1) + C(2) + D(1) + E = 0 (1) 2 + A( 1) 2 + B(1)( 1) + C(1) + D( 1) + E = 0 ( 1) 2 + A( 2) 2 + B( 1)( 2) + C( 1) + D( 2) + E = 0 ( 3) 2 + A(1) 2 + B( 3)(1) + C( 3) + D(1) + E = 0 ( 1) 2 + A( 1) 2 + B( 1)( 1) + C( 1) + D( 1) + E = 0 In matrix form: 4 0 0 2 1 0 1 2 2 1 1 A 1 1 1 1 1 B 4 4 2 1 2 1 C 1 3 3 1 1 D = 1 1. 9 E 1 1 1 1 1 1

Application Best fit ellipse, continued 4 0 0 2 1 1 2 2 1 1 1 1 1 1 1 A = 4 2 1 2 1 1 3 3 1 1 1 1 1 1 1 36 7 5 0 12 7 19 9 5 1 A T A = 5 9 16 1 2 0 5 1 12 0 12 1 2 0 6 Row reduce: 36 7 5 0 12 19 7 19 9 5 1 17 5 9 16 1 2 20 0 5 1 12 0 9 12 1 2 0 6 16 Best fit ellipse: or 0 4 1 b = 1. 9 1 19 17 A T b = 20 9 16 1 0 0 0 0 405/266 0 1 0 0 0 89/133 0 0 1 0 0 201/133 0 0 0 1 0 123/266 0 0 0 0 1 687/133 x 2 + 405 266 y 2 89 201 xy + 133 133 x 123 266 y 687 133 = 0 266x 2 + 405y 2 178xy + 402x 123y 1374 = 0.

Application Best fit ellipse, picture [interactive] (0, 2) ( 3, 1) ( 1, 1) (2, 1) (1, 1) ( 1, 2) 266x 2 + 405y 2 178xy + 402x 123y 1374 = 0 Remark: Gauss invented the method of least squares to do exactly this: he predicted the (elliptical) orbit of the asteroid Ceres as it passed behind the sun in 1801.

Application Best fit parabola What least squares problem Ax = b finds the best parabola through the points ( 1, 0.5), (1, 1), (2, 0.5), (3, 2)? The general equation for a parabola is So we want to solve: In matrix form: y = Ax 2 + Bx + C. 0.5 = A( 1) 2 + B( 1) + C 1 = A(1) 2 + B(1) + C 0.5 = A(2) 2 + B(2) + C 2 = A(3) 2 + B(3) + C 1 1 1 1 1 1 A 4 2 1 B = C 9 3 1 0.5 1. 0.5 2 Answer: 88y = 53x 2 379 5 x 82

Application Best fit parabola, picture 88y = 53x 2 379 5 x 82 (3, 2) ( 1, 0.5) (1, 1) (2, 0.5) [interactive]

Application Best fit linear function What least squares problem Ax = b finds the best linear function f (x, y) fitting the following data? The general equation for a linear function in two variables is f (x, y) = Ax + By + C. x y f (x, y) 1 0 0 0 1 1 1 0 3 0 1 4 So we want to solve In matrix form: A(1) + B(0) + C = 0 A(0) + B(1) + C = 1 A( 1) + B(0) + C = 3 A(0) + B( 1) + C = 4 1 0 1 0 0 1 1 A 1 0 1 B = 1 3. C 0 1 1 4 Answer: f (x, y) = 3 2 x 3 2 y + 2

Application Best fit linear function, picture [interactive] (0, 1, 4) f (x, y) f ( 1, 0) f (0, 1) ( 1, 0, 3) Graph of y x (0, 1, 1) f (1, 0) f (0, 1) (1, 0, 0) f (x, y) = 3 2 x 3 2 y + 2

Summary A least squares solution of Ax = b is a vector x such that b = A x is as close to b as possible. This means that b = proj Col A (b). One way to compute a least squares solution is by solving the system of equations (A T A) x = A T b. Note that A T A is a (symmetric) square matrix. Least-squares solutions are unique when the columns of A are linearly independent. You can use least-squares to find best-fit lines, parabolas, ellipses, planes, etc.