Math 2270, Fall 2015 Instructor: Thomas Goller 1 December 2015 Quiz #9 Solutions 0 (1) Let , 3 y= 0+ 1 2 , be data points in R2 . The goal of this problem is to find the line 1 1 1 x that best fits these data points. (a) Write down the equation X ~ = ~y that models the problem. (1 point) Solution: 2 3 1 0 41 1 5 1 2 0 1 2 3 3 = 4 15 1 (b) Solve the equation X T X ~ = X T ~y for ~ . (2 points) Solution: 2 3 1 0 1 1 1 4 3 3 T 1 15 = X X= , 0 1 2 3 5 1 2 so ~ = (X T X) 1 X T ~y = 1 15 9 5 3 3 3 1 1 1 4 5 3 T 1 = X ~y = , 0 1 2 1 1 3 3 2 1 12 3 2 = = . 1 6 1 6 (c) Write down the equation of the line that best fits the data points. (1 point) Solution: y = 2 x (d) Sketch the data points and your line of best fit. (1 point) 0 1 2 Description of solution: You should plot the points , , and the line 3 1 1 with equation y = 2 x, which has y-intercept 2 and x-intercept 2. Math 2270, Fall 2015 Instructor: Thomas Goller 1 December 2015 8 2 3 2 39 6 = < 1 (2) Compute an orthogonal basis for the subspace W = Span 425 , 4 2 5 . (2 points) : ; 3 1 Possible solution: 2 3 1 ~v1 = 425 , 3 2 3 2 3 6 1 4 2 5 · 425 2 3 2 3 1 6 1 3 2 3 2 3 425 = 4 2 5 1 1 3 1 425 · 425 3 3 2 3 6 ~v2 = 4 2 5 1 (3) Bonus problem: Compute the equation of the form y = 0 ⇡/2 ⇡ the data points , , . (1 bonus point) 0 1 1 0 2 3 2 3 1 11/2 7 4 5 4 2 = 1 5 14 3 5/2 cos x + 1 sin x that best fits Solution: In this case 2 so the dream equation is 3 2 3 cos 0 sin 0 1 0 X = 4cos ⇡/2 sin ⇡/25 = 4 0 15 , cos ⇡ sin ⇡ 1 0 2 3 1 0 4 0 15 1 0 Then XT X = 1 0 0 1 2 3 1 0 1 4 2 0 0 15 = 0 0 1 1 0 0 1 2 3 0 = 415 . 1 and X T ~y = so the solution to X T X ~ = X T ~y is ~ = (X X) X ~y = 1/2 0 0 1 T 1 Thus the best fit equation is y = T 1 2 cos x + sin x. 1 = 1 1 0 0 1 2 3 0 1 4 5 1 1 = 0 1 1 1/2 . 1