Spring, 2005 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: A 200 pound weight is supported at (5,8,-10) by strings S1 fastened at (0,0,0), S2 fastened at (1,14,0), and S3 fastened at ( 6,9,0). Find the Tension in each string. April 11 6.1 and 6.2 Main Idea: How can something as simple as the dot product be useful? Key Words: Length, Dot Product, Unit Vector, Orthogonality, perpendicular, Closest, Angle Goal: Learn dot product and what it can be used for. Previous Assignment: Solve the differential Equation / | x | | 1 -3 2 2 || x | | y | = | 0 -1 2 1 || y | | z | |-1 -3 4 2 || z | | w | | 0 -3 2 3 || w | 3 Det[ A - x I ] = (x-1)(x-2) Eigen values are 1,3,3,3. x = 1 | 0 -3 2 2 | | 1 0 0 -1/2 | | 1/2 | A-I = | 0 -2 2 1 | == | 0 1 0 -1 | | 1 | |-1 -3 3 2 | | 0 0 1 -1/2 | | 1/2 | | 0 -3 2 2 | | 0 0 0 0 | | 1 | x = 3 x y z=a w=b RHS |-1 -3 2 2 r | | 1 0 0 -1 -r+s | [A-2I | B ] = | 0 -3 2 1 s | == | 0 1 -2/3 -1/3 -s/3 | |-1 -3 2 2 t | | 0 0 0 0 -r+t | | 0 -3 2 1 u | | 0 0 0 0 -s+u | r=t and s=u | r | Solution for (A-2I) X = | s | = | r | | s | | x | | -r+s | | 0 | | 1 | is | y | = | -s/3 | + a | 2/3| + b |1/3| | z | | 0 | | 1 | | 0 | | w | | 0 | | 0 | | 1 | 0 r=1 s=1 /||\ | 1 | | 0 | || | 0 | 0 <=== | 1 | <===== | -1/3 | \\===|2/3| | 1 | | 0 | | 1 | | 1 | | 0 | | 0 | | 1 0 0 1/2 | P = | 1 -1/3 2/3 1 | | 1 0 1 1/2 | | 1 0 0 1 | -1 | 2 1 0 0 | P A P = | 0 2 0 0 | | 0 0 2 0 | | 0 0 0 1 | Solution: | x | | 1 0 0 1/2 | | 1 1+t 0 0 | | C1 e^(2t) | | y | = | 1 -1/3 2/3 1 | | 0 1 0 0 | | C2 e^(2t) | | z | | 1 0 1 1/2 | | 0 0 1 0 | | C3 e^(2t) | | w | | 1 0 0 1 | | 0 0 0 1 | | C4 e^t | ------------------------------------------------------------ Check: Y = {{ 1, 1+t, 0, 0 }, { 0, 1 , 0, 0 }, { 0, 0 , 1, 0 }, { 0, 0 , 0, 1 }}; P = {{ 1, 0, 0, 1/2 }, { 1,-1/3,2/3, 1 }, { 1, 0, 1, 1/2 }, { 1, 0, 0, 1 }}; A = {{ 1,-3, 2, 2 }, { 0,-1, 2, 1 }, {-1,-3, 4, 2 }, { 0,-3, 2, 3 }}; Z = {C1 E^(2t),C2 E^(2t), C3 E^(2t), C4 E^t}; X = P.Y.Z; ans = D[X,t] - A.X; Print[ans] {0, 0, 0, 0} ------------------------------------------------------------ Write the equation of the line through {1,7}, {2,12}, {3,13}, {4,16}, {5,21} y = mx+b m b RHS | 1 1 | | m | = | 7| | 2 1 | | b | |12| | 3 1 | |13| | 4 1 | |16| | 5 1 | |21| m b RHS | 1 1 7| | 2 1 12| | 3 1 13| | 4 1 16| | 5 1 21| | 1 1 7| | 0 -1 -2| | 0 -2 -8| | 0 -3 -12| | 0 -4 -14| | 1 1 7| | 0 1 2| | 0 2 8| | 0 3 12| | 0 4 14| | 1 0 5| | 0 1 2| | 0 0 4| | 0 0 6| | 0 0 8| | 1 0 0| | 0 1 0| | 0 0 1| | 0 0 0| | 0 0 0| equations are inconsistent. But we already suspected that. We wanted a line that best approximated the points. We suspected that they actually did not lie on the same line. The technique to find the best approximation is easy. The problem is to convince students that a simple linear process can actually solve a problem involving square roots of sums of squares. The Solution: ------------ ################################################################### # To Solve AX = B. # # # # Simply multiply through by the transpose of A and solve the # # # # new system. # # # # T T # # A A X = A B. # # # ################################################################### m b RHS | 1 2 3 4 5 | | 1 1 | | m | = | 1 2 3 4 5 | | 7| | 1 1 1 1 1 | | 2 1 | | b | | 1 1 1 1 1 | |12| | 3 1 | |13| | 4 1 | |16| | 5 1 | |21| | 55 15 | | m | = | 239 | | 15 5 | | b | | 69 | | 5 -15 | | 55 15 | | m | = | 5 -15 | | 239 | | -15 55 | | 15 5 | | b | |-15 55 | | 69 | | 50 0 | = | 160 | | 0 50 | | 210 | m = 160/50 = 16/5 b = 210/50 = 21/5 The best fitting line is y = 16/5 x + 21/5. At least we can look at the points and the line and estimate that it certainly does look like a good approximation. ---------------------------------------------------------- A = {{1,7}, {2,12}, {3,13}, {4,16}, {5,21}}; a = ListPlot[A,PlotStyle->{RGBColor[1,0,0],PointSize[0.05]}]; b = Plot[16/5 x + 21/5,{x,0,6}]; c = Show[a,b,PlotLabel->"Best Fitting Line",AspectRatio->Automatic]; Display["line.ps",c]; f[m_,b_] := Sqrt[ Sum[ (A[[i,2]]-(m i+b))^2,{i,1,5}] ]; T = Table[Plot[f[m,2 b/5],{m,0,10}],{b,5,20}]; y = Plot[ f[ x, 21/5],{x,0,10},PlotStyle->{RGBColor[1,0,0]}]; d = Show[T,y,PlotLabel->"red=error m vary but b=21/5, black=error m,b vary"]; Display["look.ps",d] A = {{1,7}, {2,12}, {3,13}, {4,16}, {5,21}}; f[m_,b_] := Sqrt[ Sum[ (A[[i,2]]-(m i+b))^2,{i,1,5}] ]; g[e_] := ContourPlot[f[m,b],{m,16/5-e,16/5+e},{b,21/5-e,21/5+e}, Contours->100,ContourShading->False] x = g[0.001]; y = Show[x,PlotLabel->" y = m x + b for (m,b) near (16/5,21/5)"]; Display["c.ps",y]; ----------------------------------------------------------------- We explain the idea of the closest solution using perpendicular projection onto a plane. P ___________________________|______________ / | / / | / / | / /..............................| / _/ . * '. / /| . * ' . / Y/ best*line . / / . * ' . / /______________\_______________.__________/ X / The point P is not in the plane spanned by X and Y. There is no solution to: aX + b Y = P The closest that aX +bY can get to P will be the point in the plane directly under P. That is, the perpendicular projection of P onto the plane. 3 When you are in R , the above picture makes sense. We now n extend the concept of best fitting answer to R . ==================================================================== This is the order that I prefer. I show some uses and then add the theory to justify things. I think this time one should see a road map of what is going on. A. To find the orthogonal projection if you need an orthonormal basis. B. Every vector space has an orthonormal basis. C. If the columns of a matrix are orthonormal, the matrix has a lot of nice properties. D. Lots of things have "best fit" including lines, quadratics, and cubics E. The dot product can be Generalized. ############################ # DISTANCE or CLOSE # ############################ The meaning of close requires a distance of some sort: We are trying to find the best solution when there really is no true solution. We need a way of telling when one answer is better than another. In particular, If we are solving AX = B, we want to find X such that B-AX is the smallest possible. We define the norm or length of a vector and then we minimize this norm. Definition: LENGTH ====== The length of a vector V = {v , v , ..., v } is 1 2 n 2 2 2 | V | = Sqrt[ v + v + ... + v ]; 1 2 n BEST POSSIBLE SOLUTION ====================== The the best possible solution to AX = B will be a vector Xo such that |B-AXo| is as small as possible. Certainly, if there does exist an Xo such that AXo = B, the value of |B-AXo| = 0 which is as small as possible. When one cannot get a exact solution, it will turn out that AXo will be the closest point to B. DOT PRODUCT =========== Distance is closely related to the dot product. The dot product of two vectors V = {v ,v , ..., v } and 1 2 n W = {w ,w , ..., w } is defined by 1 2 n VoW = v w + v w + ... + v w . 1 1 2 2 n n The connection between the dot product and the length is 2 | V | = VoV. Vectors V and W are said to be orthogonal if VoW = 0. ################################################## # 2 2 2 # # Theorem: | V+W | = | V | + | W | # # # # if and only if VoW = 0. # # # ################################################## Proof: 2 |V+W| = (V+W)o(V+W) = VoV + 2 VoW + WoW 2 2 = | V | + | W | + 2 VoW. 2 2 2 So |V+W| = | V | + | W | if and only if VoW = 0. Our goal is to find something in the column space of A which is closest to B. It turns out that that happens when B-AXo is perpendicular to every vector in the column space of A. ORTHOGONAL =========== A collection of vectors {V , V , ..., V } is called Orthogonal 1 2 k if V oV = 0 for all i =/= j. i j A collection of Vectors {V , V , ..., V } is called OrthoNORMAL 1 2 k if | V | = 1 for all i, and V oV = 0 for i =/= j. i i j A collection of Orthonormal vectors is automatically independent. Proof: Suppose that {V , V , ..., V } are orthonormal. Suppose 1 2 k that c V + c V + ... + c V = 0. Simply dot the 1 1 2 2 k k dependence relation with Vi giving c V oV = 0 i i i and hence c = 0. Since the only dependence relation that can hold i is the trivial one, the V's are linearly independent. i Orthogonal projection into a Subspace. Suppose that {V , V , ..., V } are an orthonormal set of 1 2 k vectors. Let W = < V , V , ..., V >. Then for any vector X, 1 2 k The projection of X onto W is given by. Proj (X) = (XoV ) V + (XoV ) V + ... + (XoV ) V = W 1 1 2 2 k k Furthermore X-Proj (X) is perpendicular to each V . W i Proof. Notice that (X-Proj (X))oV = 0 for each i. W i Example: | 2 | | 1 | | -2 | The vectors 1/3 | 2 |, 1/3 |-2 |, 1/3 | 1 | | 1 | | 2 | | 2 | 3 are an orthonormal basis of R . Find the representation | 3 | of | 2 | in this basis. | 1 | | 11/3 | ans | 1/3 | | -2/3 | | 2 | | 1 | |-2 | | 1 | check: 11/3 | 2 | + 1/3 |-2 | -2/3 | 1 | = | 2 | | 1 | | 2 | | 2 | | 3 | ANGLE ===== The angle between two nonzero vectors. The angle between V and W is 0<=theta <= 180 such that VoW Cos[theta] = ---------- |V| |W| VoW It turns out that -1 <= ------- <= 1 so that it will |V| |W| always fall into the range of the Cosine function. This Cosine is actually the famous statistic called the Coefficient of correlation. It represents how closely two vectors are in sync. A coefficient of correlation near 1 means the match up is very good. A coefficient of -1 is just as strong as a correlation of 1. For example if you find a perfect correlation between good teaching evaluations and high grades, the correlation would be negative since the scales are reversed. The highest grade is 4 while the highest evaluation was a 1. If one reversed the scoring so that the highest evaluation was 5, then one would change the sign of the correlation coefficient. A correlation of zero means that they are not related. One often runs correlation coefficients on all kinds of events. Like temperatures of El Nino and diseases in Africa. Every so often, there is a non zero correlation. Then people try to figure out what is happens. The El Nino meant more rain, more insects, which spread more disease. It does not mean that El Nino caused the disease, or that the disease caused El Nino. It usually means that both El Nino and the disease are both caused by something else. I used the correlation coefficient to recognize points of swamp land on aerial photographs. You can easily recognize various peculiar patches on the two photographs, but it is very hard to decide just which point on the two photographs match. So I took a 11x11 pixel region on both photographs and moved them and twisted them till I got the highest possible correlation. Any two points had a correlation of about 70%. After all, it was black and white pictures of swamp land. But at the best correlation, one got 98 % correlation. Angles in Space: Find the tension Tp and Tq which support the 200 lb weight at (2,-3) with ropes connected to (0,0) and (7,0). (0,0) (7,0) ------------------------------------.- \__ | . ' |\ | --. ' \ p|q . ' | Tp \ | . ' Tq \. ' |(2,-3) | | | | _____|____ | 200 | ---------- Tp (-2,3))/Sqrt[13] + Tq (5,3)/Sqrt[34] = 200 (0,1) | -2 5 | | Tp/Sqrt[13] | = | 0 | | 3 3 | | Tq/Sqrt[34] | | 200 | Tp/Sqrt[13] = 1000/21 Tq/Sqrt[34] = 400/21 Tp = 1000/21 Sqrt[13] Tq = 400/21 Sqrt[34] The vertical component of the two forces will be left = Tp (3/Sqrt[13]) = 1000/7 right = Tq (3/Sqrt[34]) = 400/7 ---