Homework 3 Solutions 5.4 # 2. Given x = [1 1 1 1]T and y = [8 2 2 0]T : (a) Determine the angle θ between x and y. (b) Find the projection p of x onto y. (c) Verify x − p is orthogonal to p. (d) Compute kx − pk2 , kpk2 , and kxk2 and verify the Pythagorean Law is satisfied. Solution. (a) First, cos θ = 8+2+2 x·y 1 = √ √ =√ kxk2 kyk2 4 72 2 and, hence, θ = arccos µ 1 √ 2 ¶ = π . 4 (b) By definition p= x·y 2y kyk2 = 12 1 1 T T y = [8 2 2 0] = [4 1 1 0] . 72 6 3 (c) x − p = x− 16 y and p = 16 y so ¶ µ ´ 1 1 1 ³ 1 6x · y − kyk22 = (72 − 72) = 0. (x − p) · p = x− y · y = 6 6 36 36 (d) Finally, 2 kx − pk2 = = = So kpk2 2 = kxk22 = µ ¶ µ ¶ 1 1 x− y · x− y 6 6 2 1 kxk22 − x · y+ kyk22 6 36 2 1 4 − (12) + (72) = 2 6 36 1 1 1 y · y = (72) = 2 6 6 36 4. kxk22 = 4 = 2 + 2 = kx − pk22 + kpk22 . 1 5.4 # 9. In C [−π, π] with inner product defined by (6), show that cos mx and sin nx are orthogonal and that both are unit vectors. Determine the distance between the two vectors. Solution: Here are two ways to prove the orthogonality, depending on what you know. Orth. 1: The addition formulas for the sine and cosine are one key: If α and β are any two angles, then sin (α + β) = sin α cos β + cos α sin β cos (α + β) = cos α cos β − sin α sin β. Replace β by −β in the first identity to obtain (why) sin (α − β) = sin α cos β − cos α sin β. Add the first and third identities to get sin α cos β = sin (α + β) + sin (α − β) . Now consider hsin nx, cos mxi = 1 π Z π sin nx cos mx dx. −π If n = 0, then the integral is zero. (Why?) So assume n 6= 0. Let α = nx and β = mx and use the last identity to find Z 1 π hsin nx, cos mxi = (sin (n + m) x + sin (n − m) x) dx π −π R ½ 1 π (sin (m + m) x) dx = 0 if n = m, π −π R = 1 π π −π (sin (n + m) x + sin (n − m) x) dx = 0 if n 6= m. (Evaluate the integrals and check that the stated results are correct.) Thus, hsin nx, cos mxi = 0 and cos mx and sin nx are orthogonal with respect to this inner product. Orth. 2: If you remember from calculus that the integral of an odd function over a symmetric range is zero and you realize that sin nx cos mx is odd because sin nx is odd and cos mx is even, then you get free of charge Z 1 π hsin nx, cos mxi = sin nx cos mx dx = 0. π −π To find the lengths of the vectors set α = β in the first cosine identity to get ½ 2 cos2 α − 1 cos (2α) = cos2 α − sin2 α = 1 − 2 sin2 α 2 or cos2 α = sin2 α = 1 (1 + cos 2α) , 2 1 (1 − cos 2α) . 2 Use these formulas with α = nx (or mx which is really the same (why?) to find ¶ ½ Z Z µ 1 π 1 1 1 π 1 if m 6= 0 cos2 mx dx = hcos mx, cos mxi = + cos 2mx dx = , 2 if m = 0 π −π π −π 2 2 ¶ ½ Z Z µ 1 π 1 π 1 1 1 if n 6= 0 hsin nx, sin nxi = sin2 nx dx = − cos 2nx dx = . 0 if n = 0 π −π π −π 2 2 So both cos mx with and sin nx are orthogonal unit vectors. Finally, using this information, if m and n are both diļ¬erent from 0, then 2 ksin nx − cos mxk = hsin nx − cos mx, sin nx − cos mxi = hsin nx, sin nxi − 2 hsin nx, cos mxi + hcos mx, cos mxi = 1 − 2 (0) + 1 = 2 and, hence, ksin nx − cos mxk = √ 2 if m, n 6= 0 or m, n = 0. What do you get in the other cases? P4 Prob. 1 Let V be an inner product space, S and S0 be subsets of V. Do the following. (a) Prove: If S0 ⊂ S, then S ⊥ ⊂ S0⊥ . ¡ ¢⊥ ¡ ¢⊥ (b) Prove that S ⊂ S ⊥ and deduce that, span (S) ⊂ S ⊥ . First a general principle. To prove A ⊂ B you must show that if a ∈ A, then a ∈ B. (Why?) Proof of (a): Let s⊥ ∈ S ⊥ . We must prove that s⊥ ∈ S0⊥ . Now, by definition, s ∈ S ⊥ means ­ ⊥ ® s , s = 0 for every vector s ∈ S. ⊥ Since S0 ⊂ S it follows immediately that ­ ⊥ ® s , s0 = 0 for every vector s0 ∈ S0 . Therefore by definition s⊥ ∈ S0⊥ . So s⊥ ∈ S ⊥ =⇒ s⊥ ∈ S0⊥ and, hence, S ⊥ ⊂ S0⊥ . An alternative proof of (a) with fewer symbols follows: If a vector is perpendicular to all vectors in a given set (here S) it is automatically perpendicular to all vectors in any subset of that set (here S0 ). That is, every vector in S ⊥ is in S0⊥ ; thus, S ⊥ ⊂ S0⊥ . 3 ¡ ¢⊥ (b) Let s ∈ S. We must prove that s ∈ S ⊥ . Now by definition ¡ ⊥ ¢⊥ © ­ ® ª S = v ∈ V : v, s⊥ = 0 for every vector s⊥ ∈ S ⊥ . ­ ¡ ¢⊥ ® But s, s⊥ = 0 for every vector s⊥ ∈ S ⊥ by the definition of S ⊥ . So s ∈ S ⊥ ¡ ¢⊥ ¡ ¢⊥ ¡ ¢⊥ by definition of S ⊥ . So s ∈ S =⇒ s ∈ S ⊥ and, hence, S ⊂ S ⊥ . ¡ ¢⊥ Finally, to prove span (S) ⊂ S ⊥ reason as follows. Let t ∈ span (S) . Then ¡ ¢⊥ Pn t = i=1 αi si for some scalars αi and some vectors si ∈ S. Since S ⊂ S ⊥ , ¡ ¢⊥ ­ ® each si ∈ S ⊥ ; that is, si , s⊥ = 0 for every vector s⊥ ∈ S ⊥ . Then by linearity of the inner product for any s⊥ ∈ S ⊥ + * n n X X ­ ⊥® ­ ® ⊥ αi si , s αi si , s⊥ = 0. = t, s = i=1 i=1 ¡ ¢⊥ ¡ ¢⊥ and, hence, span (S) ⊂ Therefore, t ∈ S ⊥ . So t ∈ span (S) =⇒ t ∈ S ⊥ ¡ ⊥ ¢⊥ . S An alternative proof of (b) can be given using results of other problems: ¡ ¢⊥ First, for any nonempty set T, T ⊥ is a subspace. So S ⊥ is a subspace of V. Second, if any set U is contained in a subset, then span (U ) is contained in ¡ ¢⊥ that subspace. By (a) S is contained in the subspace S ⊥ ; hence, span (S) ⊂ ¡ ⊥ ¢⊥ . S P4 Prob. 9 (Very Useful) Let W be a subspace of an inner product space V and let w1 , ..., wn be a spanning set for W. Prove: for v ∈ V v ⊥ W ⇐⇒ v ⊥ w1 , ..., v ⊥ wn . Proof: =⇒ : Since v ⊥ W means v ⊥ w for each w ∈ W and w1 , ..., wn are all elements of W = span (w1 , ..., wn ) , we deduce at once that v ⊥ w1 , ..., v ⊥ wn . ⇐= : Now assume v ⊥ w1 , ..., v ⊥ wn . Let w ∈ W = span (w1 , ..., wn ) . Then w = α1 w1 + α2 w2 + · · · + αn wn for some scalar α and by linearity of the inner product hv, wi = hv, α1 w1 + α2 w2 + · · · + αn wn i = α1 hv, w1 i + α2 hv, w2 i + · · · + αn hv, wn i = α1 (0) + α2 (0) + · · · + αn (0) = 0. So v ⊥ w for every w ∈ W ; therefore, v ⊥ W. Comments: 4 1. Don’t put subscripts on variables unless the subscripts are needed in your argument. Otherwise their use is distracting to a reader and suggests that you don’t fully understand what you are doing. 2. In the notation hu, vi , u and v are vectors. The notation hS, vi where S is some set or subspace of vectors is not defined. 3. Don’t write span (S) = α1 s1 +α2 s2 +· · ·+αn sn or something similar. This syntax says a set, span (S) is equal to an element, α1 s1 +α2 s2 +· · ·+αn sn , of that set even if you intend a general element of the span. You should use proper set notation: span (S) = {α1 s1 + α2 s2 + · · · + αn sn : αk are scalars and sk ∈ S} or something equivalent that equates two sets. 5