Instructor: Irvin Roy Hentzel Office 432 Carver Phone 515-294-8141 E-mail: hentzel@iastate.edu http://www.math.iastate.edu/hentzel/class.307.05 Assignment Page 401 Problem 19. Main Idea: With distance you can talk about best fit. Key Words: Perpendicular, Orthogonal, Orthonormal, Goal: Learn how to best approximate a vector within a subspace. ============================================================ Previous Assignment; A 200 pound weight is supported at (5,8,-10) by strings: S1 fastened at (0, 0,0), S2 fastened at (1,14,0), S3 fastened at (6, 9,0). Find the Tension in each string. (0,0,0) (1,14,0) | / /|\ / | / | __/ (6,9,0) | |-5| /| \__ T1 | |-8| / |-4| /\ | |10| / T2 | 6| \ |Sqrt[89] / |10| \ | 1| | / Sqrt[152] \ | 1| | / T3 \|10| | / Sqrt[102]| / \ | / \ | / \ | / \ | / \ | / \|/ (5,8,-10) | -5 -4 1 | | T1/Sqrt[189] | | 0 | | -8 6 1 | | T2/Sqrt[152] | = | 0 | | 10 10 10 | | T3/Sqrt[102] | |200| T1 = 8/3 Sqrt[189] = 36.6606 T2 = 4/5 Sqrt[152] = 9.86306 T3 = 248/15 Sqrt[102] = 166.978 Check: | -5 | | -4 | | 1 | | 0 | 8 Sqrt[189] | -8 | 4 Sqrt[152] | 6 | + 248 Sqrt[102] | 1 | = | 0 | ---------- | 10 | + ---------- | 10 | ------------- | 10 | |200| 3 --------- 5 -------- 15 ------- Sqrt[189] Sqrt[152] Sqrt[102] ================================================================ p1 = Graphics3D[{Thickness[0.02],Line[{{5,8,-10},{0, 0,0}}]}]; p2 = Graphics3D[{Thickness[0.02],Line[{{5,8,-10},{1,14,0}}]}]; p3 = Graphics3D[{Thickness[0.02],Line[{{5,8,-10},{6, 9,0}}]}]; p4 = Graphics3D[{Thickness[0.030], Line[{{5,8,-10},{5,8,-10}+{-5,-8,10}/Sqrt[89]}]}]; p5 = Graphics3D[{Thickness[0.030], Line[{{5,8,-10},{5,8,-10}+{-4,6,10}/Sqrt[152]}]}]; p6 = Graphics3D[{Thickness[0.030], Line[{{5,8,-10},{5,8,-10}+{1,1,10}/Sqrt[102]}]}]; p7 = Graphics3D[{Thickness[0.01],RGBColor[1,0,0], Line[{{5,8,-10},{5,8,-10}+{-5,-8,10}(8/3) }]}]; p8 = Graphics3D[{Thickness[0.01],RGBColor[1,0,0], Line[{{5,8,-10},{5,8,-10}+{-4,6,10}(4/5) }]}]; p9 = Graphics3D[{Thickness[0.01],RGBColor[1,0,0], Line[{{5,8,-10},{5,8,-10}+{1,1,10}(248/15)}]}]; p10 = Show[p1,p2,p3,p4,p5,p6,AspectRatio->Automatic,PlotRange->All] Display["hangx.ps",p10]; p11 = Show[p1,p2,p3,p4,p5,p6,p7,p8,p9,AspectRatio->Automatic,PlotRange->All]; Display["hangy.ps",p11]; ================================================================ New Material: Theorem 8 The orthogonal Decomposition Theorem. n n Let W be a subspace of R . Then each y in R can be written uniquely in the form y = y^ + z where y^ is in W and z is in W-perp. In fact, if {u1,u2, ..., up} is any orthogonal basis of W, then y ou y ou 1 p y^ = ------ u + .... + ----- u u ou 1 u ou p 1 1 p p and z = y-y^. Proof: Let {u ,u , ..., u } be any orthonormal basis of W. 1 2 p We will show in the next section how to construct one of these bases. Let y^ be constructed using the formula you you you 1 2 p y^ = ------ u + ----- u + .... + ----- u u ou 1 u ou 2 u ou p 1 1 2 2 p p Clearly y-y^ is perpendicular to each u and also to each i linear combination of the u's. That is, to all vectors in W. i y = y^ + (y-y^) y^ is in W, and (y-y^) is perpendicular to all vectors in W. We will show that this vector y^ is unique. If y" is some other vector such that y = y" + z" where z is perpendicular to W, y = y^ + z = y" + z" and y^-y" = z"-z This vector is perpendicular to itself so has length zero. Thus y^ = y" and z^ = z which means the decomposition has to be unique. ------------------------------------------------------- Theorem 9: The Best Approximation Theorem; Let W be a subspace of R^n, y any vector in R^n and y^ the orthogonal projection of y onto W. Then y^ is the closest point in W to y, in the sense that ||y-y^|| < ||y-v|| for all v in W distinct from y^. Proof: Let y = y^ + (y-y^) from the previous theorem. If w is any other vector in W, then y-w = (y - y^) + (y^ - w) Since the vectors on the right hand side are perpendicular to each other 2 2 2 || y-w || = ||y - y^ || + || y^ - w || If w =/= y^ then || y^ - w || > 0 and so 2 2 || y - w || > || y - y^ || And so || y - w || > || y - y^ || --------------------------------------------- Find the vector which is a linear combination of | 2 | | -2 | | 1 | | 5 | | 1 | Closest to | 2 | | -1 | | 1 | | 3 | 9 | 2 | 3 | -2 | | -2/5 | ---- | 5 | + --- | 1 | = | 2 | 30 | -1 | 6 | 1 | | 1/5 | The error is Sqrt[(1+2/5)^2 + 0^2 + (3-1/5)^2] = Sqrt[49/5]. ----------------------------------------------------- h = 1; p1 = Plot3D[ (x{2,5,-1}+y{-2,1,1}). (x{2,5,-1}+y{-2,1,1}) ,{x,3/10-h,3/10+h},{y,1/2-h,1/2+h}]; f[{x_,y_,z_}] := x^2 + y^2 + z^2; p2 = Graphics3D[{RGBColor[1,0,0],PointSize[0.05], Point[{9/30,1/2, f[ 3/10 {2, 5,-1}+3/6 {-2,1,1}-{1,2,3} ] }]} ]; Show[p2]; p3 = Show[p1,p2,PlotRange->All]; Display["ex.ps",p3]; p4 = ContourPlot[ f[x{2,5,-1}+y{-2,1,1}-{1,2,3}],{x,3/10-h,3/10+h},{y,1/2-h,1/2+h}, Contours->200,ContourShading->False]; Display["ey.ps",p4]; ------------------------------------------------------------- p6 = ParametricPlot3D[ x{2,5,-1} + y {-2,1,1},{x,-1, 1},{y,-1, 1}]; p7 = Graphics3D[{RGBColor[1,0,0],PointSize[0.02],Point[{-2/5,2,1/5}]}]; p8 = Graphics3D[{RGBColor[1,0,0],PointSize[0.02],Point[{1,2,3}]}]; p9 = Graphics3D[{RGBColor[1,0,0],Thickness[0.01],Line[{ {-2/5,2,1/5},{1,2,3} }]}]; p10 = Show[p6,p7,p8,p9]; p11 = Show[p10,ViewPoint->5{2,5,-1}]; p12 = Show[p10,ViewPoint->5{-2,5,1}]; Display["perp1.ps",p11]; Display["perp2.ps",p12]; -------------------------------------------------------- Find the best fitting line to the points {1,1},{3,5},{5,11},{6,12},{7,13} y = mx + b | 1 1 | | m | | 1 | | 3 1 | | b | = | 5 | | 5 1 | | 11 | | 6 1 | | 12 | | 7 1 | | 13 | A = {{1,1},{3,1},{5,1},{6,1},{7,1}}; B = {1,5,11,12,13}; Inverse[Transpose[A].A].Transpose[A].B 123 27 m =---, b = -(--) 58 29 ------------------------------------------------- m = 123/58; b = -27/29; p1 = ListPlot[{{1,1},{3,5},{5,11},{6,12},{7,13}}, PlotStyle->{RGBColor[1,0,0],PointSize[0.02]}]; p2 = Plot[m x + b,{x,-2,10}]; p3 = Show[p1,p2]; Display["fit.ps",p3]; --------------------------------------------- Find the best fitting line to the points {1,1},{3,5},{5,11},{6,12},{7,13} x = ny + c | 1 1 | | n | | 1 | | 5 1 | | c | = | 3 | | 11 1 | | 5 | | 12 1 | | 6 | | 13 1 | | 7 | P = {{1,1},{5,1},{11,1},{12,1},{13,1}}; Q = {1,3,5,6,7}; Inverse[ Transpose[P].P].Transpose[P].Q; 123 73 n = --- c = --- 268 134 -------------------------------- n=123/268; c = 73/134; p4 =ParametricPlot[{n y + c, y},{y,-3,20},PlotStyle->{RGBColor[0,1,0]}]; p5 = Show[p3,p4]; Display["fitx.ps",p5]; -------------------------------------------------