UNIVERSITY OF TORONTO AT SCARBOROUGH DEPARTMENT OF COMPUTER AND MATHEMATICAL SCIENCES Final Examination Solutions MATB24H3 Linear Algebra II Examiner: L. Zhao Date: Monday 20 December 2004 Duration: Three(3) Hours, 14:00 - 17:00

(1) Let V be a real vector space. (a) (3 Points) Give the definition for a subset W of V to be a subspace of V . A subset W of V is a subspace of V if W is also a real vector space, where addition and scalar multiplication of vectors in W produce the same vectors as these operations do in V . (b) (3 Points) Give the definition of an inner product of V . An inner product on V is a function that assigns each ordered pair of vectors ~v and w~ in V a real number, written < ~v, w~ >, satisfying the following properties, for all ~v, w~, ~u V and r R: (i) <∈~v, w~ >=<∈w~, ~v >. (ii) < ~v, w~ + ~u >=< ~v, w~ > + < ~v, ~u >. (iii) r < ~v, w~ >=< r~v, w~ >=< ~v, rw~ >. (iv) < ~v, ~v > 0 and < ~v, ~v >= 0 if and only if ~v = ~0. (c) (3 Points) Assuming≥ that an inner product has been defined for V , give the definition of an orthonormal of V .

An orthonormal basis of V is a basis B of V such that < ~b,~b >= 1 for all ~b B and ∈ < ~b, b~ >= 0 for all ~b, b~ B and ~b = b~ . 0 0 ∈ 6 0 (d) (3 Points) Using the definition of an inner product, verify that for ~v1 = (v1, v2) and 2 2 ~u = (u1, u2) in R , < ~v, ~u >= 3v1u1 + 2v2u2 is an inner product on R .

Let ~v, w~, ~u R2 and r R. First, we have ∈ ∈ < ~v, ~u >= 3v1u1 + 2v2u2 = 3u1v1 + 2u2v2 =< ~u, ~v > . Second, we have

< ~v, w~ +~u >= 3v1(w1 +u1)+2v2(w2 +u2) = 3v1w1 +2v2w2 +3v1u1 +2v2u2 =< ~v, w~ > + < ~v, ~u > . Third, we have

< r~v, ~u >= 3rv1u1 + 2rv2u2 = r < ~v, ~u >, and < ~v, r~u >= 3v1ru1 + 2v2ru2 = r < ~v, ~u > . Fourth, we have < ~v, ~v >= 3v2 + 2v2 0, 1 2 ≥ since squares are always non-negative and the equality hold in the above expression if and only if v1 = v2 = 0 or ~v = ~0. Hence the formula we have does give rise to an inner product. (e) (3 Points) Find vectors ~v1 = (v1, v2) and ~u = (u1, u2) that are orthonormal with re- 2 spect of the inner product R , < ~v, ~u >= 3v1u1 + 2v2u2 but are not orthonormal with respect to the dot product on R2. 2 MATB24H3 LINEAR ALGEBRA II

Let ~v = (1/√3, 0) and ~u = (0, 1/√2). It is obvious that these vectors are not orthonor- mal since either has normal zero in the dot products. However, it can be easily checked that 1 1 < ~v, ~u >= 3 0 + 2 0 = 0, × √3 × × × √2 while 1 1 < ~v, ~v >= 3 + 2 0 0 = 1, × √3 × √3 × × and 1 1 < ~u, ~u >= 3 0 0 + 2 = 1. × × × √2 × √2 These are certainly not the only examples. (2) Let W be the subspace of R3 generated by the vectors [1, 1, 1] and [2, 1, 1]. 1 2 (a) (5 Points) Find the projection for projection into W . Let A = 1 1 . The  1 1  T 1 T we are looking for is P = A(A A)− A . First   1 1 2 − 1 T 1 1 1 1 3 4 − 1 6 4 (A A)− = 1 1 = = − .  2 1 1   4 6 2 4 3   1 1    −  Hence    2 0 0 T 1 T 1 1 1 1 6 4 1 1 1 1 P = A(A A)− A = − = 0 1 1 . 2 2 1 1 4 3 2 1 1 2      −    0 1 1 (b) (3 Points) Find the projection of the vector ~v = [ 2, 1, 2] on W.  − − The project of ~v on W can easily be computed as 2 0 0 2 4 1 1 P~v = 0 1 1 −1 = −1 . 2  0 1 1   −2  2  1        (c) (2 Points) Find ~bW and ~bW ⊥ such that ~bW W , ~bW ⊥ W ⊥ and ~v = ~bW +~bW ⊥ , where ~v is as in part (b). ∈ ∈

The vector computed in part (b) is ~bW and 1 3 3 ~bW ⊥ = ~v ~bW = [ 2, 1, 2] [ 4, 1, 1] = 0, , . − − − − 2 − −2 2   (3) (10 Points) Transform the basis [1, 1, 0], [2, 1, 3], [2, 2, 2] for R3 into an orthonormal basis for R3 using the Gram-Schmidt pro{ cess. }

Let ~a1 = [1, 1, 0], ~a2 = [2, 1, 3], and ~a3 = [2, 2, 2]. First, let ~v1 = ~a1 = [1, 1, 0]. Next, let ~a ~v 3 1 1 ~v = ~a 2 · 1 ~v = [2, 1, 3] [1, 1, 0] = , , 3 . 2 2 − ~v ~v 1 − 2 2 −2 1 · 1   Last, let ~a ~v ~a ~v 4 6 1 1 1 ~v = ~a 3 · 1 ~v 3 · 1 ~v = [2, 2, 2] [1, 1, 0] , , 3 = [6, 6, 2]. 3 3 − ~v ~v 1 − ~v ~v 1 − 2 − 19/2 2 −2 −19 − 1 · 1 1 · 1   FINAL EXAMINATION SOLUTIONS 3

The vectors ~vi with 1 i 3 for an orthogonal basis of R3. To find an orthonormal basis, it remains to normalized≤ all≤ the vectors, we have the follow three vectors is an orthonormal basis of R3: 1 1 1 [1, 1, 0], [1, 1, 6], [3, 3, 1]. √2 √38 − √19 − x t (4) (15 Points) Find the matrix C such that the = C 1 would diagonalize the y t2 following quadratic form. Also, find the diagonalized form ofthe quadratic form. f(x, y) = 10x2 + 6xy + 2y2. Sketch the graph of the conic section f(x, y) = 4.

10 3 We write down the symmetric coefficient matrix A = . To find the eigenvalues, 3 2 we write down the characteristic equation of A. We have  det(A λI) = (10 λ)(2 λ) 9 = λ2 12λ + 11 = (λ 1)(λ 11). − − − − − − − Hence the eigenvalues of A are λ1 = 1 and λ2 = 11. For λ1 = 1, 9 3 A I = . − 3 1   1 1 1 Hence an eigenvector for λ1 = 1 is − or − upon normalizing. 3 √10 3     For λ2 = 11, 1 3 A 11I = − . − 3 9  −  3 3 Hence an eigenvector for λ = 11 is or 1 upon normalizing. 2 1 √10 1  −   −  Therefore, the change of variables matrix C that diagonalizes the given quadratic form is 1 1 3 C = − , √ 3 1 10  −  and the diagonalized quadratic form is

2 2 x 1 1 3 t1 t1 + 11t2, with = − . y √10 3 1 t2    −    The conic section we are to sketch can be re-written as 10x2 + 6xy + 2y2 4 = 0. With the change of variables give above, it becomes − t2 t2 t2 + 11t2 4 = 0, or equivalently 1 + 2 = 1. 1 2 − 22 (2/√11)2

This is an ellipse, centered at the origin that crosses the t1-axis at 2 and the t2-axis at 2/√11. In the x y plane the t -axis goes through the origin and the point ( 1, 3) with  − 1 − its positive direction pointing into the second quadrant; the t2-axis goes through the origin and the point ( 3, 1) with its positive direction pointing into the third quadrant. − − 1 2 i 0 (5) (10 Points) Let A = 2 + i −1 0 . Find a U and  0 −0 3  1 D such that D = U − AU.  4 MATB24H3 LINEAR ALGEBRA II

We first compute all the eigenvalues of A. We have det(A λI) = [(1 λ)( 1 λ) 5](3 λ) = (λ2 1 5)(3 λ) = (λ2 6)(3 λ). − − − − − − − − − − − Therefore, the eigenvalues are λ = 3 and √6. Hence all the eigenvalues are distinct. We also note that A is Hermitian from which we can infer that the eigenvectors associated with different eigenvalues are orthogonal. Therefore, the normalized eigenvectors of A form an orthonormal basis of C3 with which we can use to form the columns of U. Now it remains to compute and normalize the eigenvectors of A. For λ = √6, we have 1 √6 2 i 0 − − A √6I = 2 + i 1 √6 0 . −  − −  0 0 3 √6 −   An eigenvector for λ = √6 is 5 1 5 2 − 1 √6 √6 1 − 1 √6 2 +− i , or − 2 +− i ,   10√6   0 ! 0     upon normalizing. For λ = √6, we have − 1 + √6 2 i 0 − A + √6I = 2 + i 1 + √6 0 .  −  0 0 3 + √6   An eigenvector for λ = √6 is − 5 1 5 2 − 1+√6 √6 + 1 − 1+√6 2 + i , or 2 + i ,   10√6   0 ! 0 upon normalizing. For λ = 3, we have   1 3 2 i 0 A 3I = 2 −+ i 1− 3 0 . −  0 − 0− 0  An eigenvector for λ = 3 is   0 0 ,  1  and this vector is already of norm one. Therefore, we have √6 0 0 D = 0 √6 0 ,   0 −0 3 and   5 5 − 0 √10(6 √6) √10(6+√6) 1− 1 U =  √6 1 2 √6+1 2  . − (2 + i) (2 + i) 0 10√6 10√6  0 0 1         3 0 1  (6) (10 Points) Let A = −2 2 1 . Find a Jordan canonical form J and a matrix C  1 −0 1  1 − − such that J = C− AC.  FINAL EXAMINATION SOLUTIONS 5

The characteristic equation of A is ( 2 λ)[( 3 λ)( 1 λ) + 1] = (λ + 2)3 = 0. − − − − − − − Hence the eigenvalues of A are λ = λ = λ = 2. 1 2 3 − 1 0 1 A + 2I = −2 0 1 .  1 0 1  − The above matrix is of rank 2 and hence nullity 1. Therefore, we know that λ = 2 give rise to one Jordan block and since λ = 2 is the only eigenvalue, it must be that this−Jordan block is 3 3. Alternatively, we compute− × 0 0 0 (A + 2I)2 = 3 0 3 ,  −0 0 0  which is of rank 1 and hence nullity 2; moreo ver  0 0 0 (A + 2I)3 = 0 0 0 ,  0 0 0  which is of rank 0 and nullity 3. Therefore, the Jordan canonical form that we are looking for is actually a Jordan block. It is 2 1 0 J = −0 2 1 .  0 −0 2  − It still remains to find a Jordan basis from which we can construct the matrix C. From the matrix A + 2I, we see that an eigenvector for λ = 2 is − 0 ~b1 = 1 ,  0    which we shall take to be a basis element. To compute ~b2, we have 1 1 (A + 2I)~b2 = ~b1, or ~b2 = 0 , 3  1    by our choice. To compute ~b3, we have 1 1 − (A + 2I)~b3 = ~b2, or ~b3 = 0 , 3  2  by our own choosing. Now the matrix C is the matrix whose columns are the above vectors, we have 0 1 1 1 C = 3 0 −0 . 3  0 1 2  (7) (10 Points) Use the method of least squares to fit the data below by an exponential function y = f(x) = resx. ai 1 10 14 16 bi 1 8 12 20 6 MATB24H3 LINEAR ALGEBRA II

We take the logarithm of y = resx and get ln y = ln r + sx which is a linear function of x. Hence our table is re-written as x = ai 1 10 14 16 y = bi 1 8 12 20 z = ln bi 0 2.079 2.485 2.996 1 1 1 10 We set A = . Then by the method of least square we have  1 14   1 16      0 0 ln r T 1 T 2.079 1 553 41 1 1 1 1 2.079 = (A A)− A   = −   s 2.485 531 41 4 1 10 14 16 2.485    −     2.996   2.996      0.07651     = . −0.1961   Therefore r = exp( 0.07651) = 0.9263. Therefore, we have − . x y = 0.9263e0 1961 .

(8) Consider the Hamming (7, 4) code with the generator matrix G and parity-check matrix H, where

1 0 0 0 1 1 0 1 1 1 0 1 0 0 0 1 0 0 1 0 1 G = , and H = 1 0 1 1 0 1 0 .  0 0 1 0 1 1 1   0 1 1 1 0 0 1   0 0 0 1 0 1 1        (a) (2 Points) What is the code word for the message 0110?

The code word for the message 0110 is

1 0 0 0 1 1 0 0 1 0 0 1 0 1 0 1 1 0 = 0 1 1 0 0 1 0 .  0 0 1 0 1 1 1    0 0 0 1 0 1 1       Therefore the codeword to be sent out is 0110010. (b) (3 Points) Write down the parity check equations that gave rise to H. The coefficients of the parity check equations for the matrix H. Hence the parity check equations are

x1 + x2 + x3 + x5 = 0, x1 + x3 + x4 + x6 = 0, x2 + x3 + x4 + x7 = 0,

all in Z2 of course. (c) (5 Points) Assuming the one error has occurred in the transmission, and w = 0001111 was received, what was the original message? FINAL EXAMINATION SOLUTIONS 7

We have 0 0 0 0     0 1 1 1 0 1 0 0 0 1 H  1  = 1 0 1 1 0 1 0  1  = 0 ,          1  0 1 1 1 0 0 1  1  0      1     1         1   1      which is the fifth column of H. Hence the errorhasoccurred in the fifth position of the codeword. But that does not affect the message. Hence the message was 0001. (9) (10 Points) Let A be an n n matrix. Show that A is Hermitian if and only if all the eigenvalues of A ×are real. Proof. A being normal implies that there are unitary matrix U and diagonal matrix D such 1 that D = U − AU. Moreover, it must be that the entries on the diagonal of D are the eigenvalues of A. Therefore, 1 1 D∗ = (U − AU)∗ = (U ∗AU)∗ = U ∗A∗(U ∗)∗ = U − A∗U.

We must have the eigenvalues of A are real if and only if D = D∗, which is true if and only 1 1 if U − A∗U = U − AU which is true if and only if A∗ = A, namely A is Hermitian.