Chapter 7 Eigenvalues and Eigenvectors 7.1 Eigenvalues and Eigenvectors 7.2 Diagonalization 7.3 Symmetric Matrices and Orthogonal Diagonalization 7.4 Application of Eigenvalues and Eigenvectors 7.5 Principal Component Analysis 7.1 7.1 Eigenvalues and Eigenvectors Eigenvalue problem (特徵值問題) (one of the most important problems in the linear algebra): If A is an nn matrix, do there exist nonzero vectors x in Rn such that Ax is a scalar multiple of x? (The term eigenvalue is from the German word Eigenwert, meaning “proper value”) Eigenvalue (特徵值) and Eigenvector (特徵向量): A: an nn matrix ※ Geometric Interpretation : a scalar (could be zero) y n x: a nonzero vector in R Ax = x Eigenvalue Ax x x Eigenvector x 7.2 Ex 1: Verifying eigenvalues and eigenvectors 2 A 0 0 1 1 x1 0 0 x2 1 Eigenvalue 2 A x1 0 0 1 2 1 2 2 x1 1 0 0 0 Eigenvector Eigenvalue 2 Ax2 0 ※ In fact, for each eigenvalue, it has infinitely many eigenvectors. For = 2, [3 0]T or [5 0]T are both corresponding eigenvectors. Moreover, ([3 0] + [5 0])T is still an eigenvector. The proof is in Thm. 7.1. 0 0 0 0 1 ( 1) x 2 1 1 1 1 Eigenvector 7.3 Thm. 7.1: The eigenspace corresponding to of matrix A If A is an nn matrix with an eigenvalue , then the set of all eigenvectors of together with the zero vector is a subspace of Rn. This subspace is called the eigenspace (特徵空間) of Pf: x1 and x2 are eigenvectors corresponding to (i.e., A x 1 x 1 , A x 2 x 2 ) (1) A ( x 1 x 2 ) A x 1 A x 2 x 1 x 2 ( x 1 x 2 ) (i.e., x 1 x 2 is also an eigenvector cor responding to λ ) (2) A ( c x 1 ) c ( A x 1 ) c ( x 1 ) ( c x 1 ) (i.e., c x 1 is also an eigenvector cor responding to ) Since this set is closed under vector addition and scalar multiplication, this set is a subspace of Rn according to Theorem 4.5 7.4 Ex 3: Examples of eigenspaces on the xy-plane For the matrix A as follows, the corresponding eigenvalues are 1 = –1 and 2 = 1: 1 A 0 Sol: 0 1 For the eigenvalue 1 = –1, corresponding vectors are any vectors on the x-axis x 1 A 0 0 0 x x x ※ Thus, the eigenspace corresponding to = –1 is the x 1 1 0 0 axis, which is a subspace of R2 0 For the eigenvalue 2 = 1, corresponding vectors are any vectors on the y-axis 0 1 A y 0 0 0 0 0 1 1 y y y ※ Thus, the eigenspace corresponding to = 1 is the yaxis, which is a subspace of R2 7.5 ※ Geometrically speaking, multiplying a vector (x, y) in R2 by the matrix A corresponds to a reflection to the y-axis x 0 x x 0 Av A A A A y 0 y 0 y x 0 x 1 1 0 y y 7.6 Thm. 7.2: Finding eigenvalues and eigenvectors of a matrix AMnn Let A be an nn matrix. (1) An eigenvalue of A is a scalar such that det( I A ) 0 (2) The eigenvectors of A corresponding to are the nonzero solutions of ( I A ) x 0 Note: follwing the definition of the eigenvalue problem A x x A x I x ( I A ) x 0 (homogeneous system) ( I A ) x 0 has nonzero solutions for x iff det( I A ) 0 (The above iff results comes from the equivalent conditions on Slide 4.101) Characteristic equation (特徵方程式) of A: det( I A ) 0 Characteristic polynomial (特徵多項式) of AMnn: det( I A ) ( I A ) c n 1 n n 1 c1 c 0 7.7 Ex 4: Finding eigenvalues and eigenvectors 2 A 1 12 5 Sol: Characteristic equation: det( I A ) 2 12 1 5 3 2 ( 1)( 2) 0 2 1, 2 Eigenvalue: 1 1, 2 2 7.8 3 (1) 1 1 ( 1 I A ) x 1 3 1 12 x1 0 4 x2 0 12 G .-J. E . 4 1 0 4 0 x1 4 t 4 t , t 0 1 x2 t 4 (2) 2 2 ( 2 I A ) x 1 4 1 12 x1 0 3 x2 0 12 G .-J. E . 3 1 0 3 0 x1 3 s 3 s , s 0 1 x2 s 7.9 Ex 5: Finding eigenvalues and eigenvectors Find the eigenvalues and corresponding eigenvectors for the matrix A. What is the dimension of the eigenspace of each eigenvalue? 2 A 0 0 1 2 0 0 0 2 Sol: Characteristic equation: I A 2 1 0 0 2 0 0 0 2 ( 2) 0 3 Eigenvalue: 2 7.10 The eigenspace of λ = 2: 0 ( I A)x 0 0 1 0 0 0 x1 0 0 x2 0 0 x 3 0 x1 s 1 0 x 0 s 0 t 0 , s, t 0 2 x t 0 3 1 1 0 s 0 t 0 s , t R : the eigenspace of A corresponding to 2 0 1 Thus, the dimension of its eigenspace is 2. 7.11 Notes: (1) If an eigenvalue 1 occurs as a multiple root (k times) for the characteristic polynominal, then 1 has multiplicity (重數) k. (2) The multiplicity of an eigenvalue is greater than or equal to the dimension of its eigenspace. (In Ex. 5, k is 3 and the dimension of its eigenspace is 2) 7.12 Ex 6:Find the eigenvalues of the matrix A and find a basis for each of the corresponding eigenspaces 1 0 A 1 1 0 1 0 5 0 0 2 0 0 10 0 3 Sol: Characteristic equation: I A 1 0 0 0 0 1 5 10 1 0 2 0 1 0 0 3 ( 1) ( 2)( 3) 0 2 Eigenvalues: 1 1, 2 2 , 3 3 ※ According to the note on the previous slide, the dimension of the eigenspace of λ1 = 1 is at most to be 2 ※ For λ2 = 2 and λ3 = 3, the demensions of their eigenspaces are at most to be 1 7.13 0 0 (1) 1 1 ( 1 I A ) x 1 1 0 0 0 5 0 1 0 0 0 x1 0 10 x 2 0 0 x3 0 2 x4 0 x1 2 t 0 2 G .-J.E . x s 1 0 2 , s, t 0 s t x3 2 t 0 2 0 1 x4 t 0 2 1 0 , 0 2 0 1 is a basis for the eigenspace corresponding to 1 1 ※The dimension of the eigenspace of λ1 = 1 is 2 7.14 1 0 (2) 2 2 ( 2 I A ) x 1 1 0 0 1 5 0 0 0 0 0 x1 0 10 x 2 0 0 x3 0 1 x 4 0 x1 0 0 G .-J.E . x 5t 5 2 t , t 0 x3 t 1 x 0 0 4 0 5 is a basis for the eigenspace 1 corresponding to 2 2 0 ※The dimension of the eigenspace of λ2 = 2 is 1 7.15 2 0 (3) 3 3 ( 3 I A ) x 1 1 0 0 2 5 0 1 0 0 0 x1 0 10 x 2 0 0 x3 0 0 x4 0 x1 0 0 G .-J.E . x 5 t 5 2 t , t 0 x3 0 0 x t 1 4 0 5 is a basis for the eigenspace 0 corresponding to 3 3 1 ※The dimension of the eigenspace of λ3 = 3 is 1 7.16 Thm. 7.3: Eigenvalues for triangular matrices If A is an nn triangular matrix, then its eigenvalues are the entries on its main diagonal Ex 7: Finding eigenvalues for triangular and diagonal matrices 2 (a ) A 1 5 0 1 3 Sol: (a ) I A 0 0 3 1 0 (b ) A 0 0 0 2 0 0 1 1 0 5 3 3 0 0 0 2 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 3 ( 2)( 1)( 3) 0 1 2, 2 1, 3 3 (b) 1 1, 2 2, 3 0, 4 4, 5 3 ※According to Thm. 3.2, the determinant of a triangular matrix is the product of the entries on the main diagonal 7.17 Eigenvalues and eigenvectors of linear transformations: A num ber is called an eigenvalue of a linear transform ation T : V V if there is a nonzero vector x such tha t T ( x ) x . T he vector x is called an eigenvector of T corresponding to , and the set of all eigenvectors of (together w ith the zero vector) is called the eigenspace of ※ The definition of linear transformation functions should be introduced in Ch 6 ※ Here I briefly introduce the linear transformation and its some basic properties ※ The typical example of a linear transformation function is that each component of the resulting vector is the linear combination of the components in the input vector x An example for a linear transformation T: R3→R3 T ( x1 , x 2 , x 3 ) ( x1 3 x 2 , 3 x1 x 2 , 2 x 3 ) 7.18 Theorem: Standard matrix for a linear transformation Let T : R R n n a11 a 21 , T (e1 ) a n1 w here { e 1 , e 2 , be a linear trtansform ation such that a12 a 22 , T (e 2 ) a n2 , a1 n a2n , T (e n ) a nn , e n } is a standard basis for R . T h en an n n n m atrix A , w hose i -th colum n correspond to T ( e i ), A T (e1 ) T (e 2 ) a11 a 21 T (e n ) a n1 a1 n a2n , a nn a12 a 22 an2 satisfies that T ( x ) A x for every x in R . A is ca lled the n standard m atrix for T ( T 的 標 準 矩 陣 ) 7.19 Consider the same linear transformation T(x1, x2, x3) = (x1 + 3x2, 3x1 + x2, –2x3) 1 1 0 3 0 0 T (e1 ) T ( 0 ) 3 , T ( e 2 ) T ( 1 ) 1 , T ( e 3 ) T ( 0 ) 0 0 0 0 0 1 2 Thus, the above linear transformation T is with the following corresponding standard matrix A such that T(x) = Ax 1 A 3 0 3 1 0 0 1 0 Ax 3 0 2 3 1 0 0 x1 x1 3 x 2 0 x 2 3 x1 x 2 2 x 3 2 x 3 ※ The statement on Slide 7.18 is valid because for any linear transformation T: V →V, there is a corresponding square matrix such that T(x) = Ax. Consequently, the eignvalues and eigenvectors of a linear transformation T are in essence the eigenvalues and eigenvectors of the corresponding square matrix A 7.20 Ex 8: Finding eigenvalues and eigenvectors for standard matrices Find the eigenvalues and corresponding e igenvectors for Sol: 1 A 3 0 1 I A 3 0 3 1 0 0 0 2 3 1 0 ※ A is the standard matrix for T(x1, x2, x3) = (x1 + 3x2, 3x1 + x2, –2x3) (see Slides 7.19 and 7.20) 2 0 ( 2) ( 4) 0 2 0 eigenvalues 1 4, 2 2 For 1 4, the corresponding eigenvector is (1, 1, 0). For 2 2, the corresponding eigenvectors are (1, 1, 0) and (0, 0, 1). 7.21 Transformation matrix A ' for nonstandard bases n S uppose B is the standard basis of R . S inc e the coordinate m atrix of a vector relative to the standard basis consists of the com ponents of that vector, i.e., n for any x in R , x = [ x ] B , the theorem on S lide 7.19 can be restated as follow s. T ( x ) A x T ( x ) B A x B , w here A T ( e 1 ) B T ( e 2 ) B T ( e n ) B is the standard m atrix for T or the m atrix of T relative to the standard basis B T he above theorem can be extended to con sider a nonstandard basis B ' , w hich consists of { v 1 , v 2 , T ( x ) B ' , v n} A ' x B ' , w here A ' T ( v 1 ) B ' T ( v 2 ) B ' T ( v n ) B ' is the transform ation m atrix for T relati ve to the basis B ' ※ On the next two slides, an example is provided to verify numerically that this extension is valid 7.22 EX. Consider an arbitrary nonstandard basis B ' to be {v1, v2, v3}= {(1, 1, 0), (1, –1, 0), (0, 0, 1)}, and find the transformation matrix A ' such that T ( x ) B ' A ' x B ' corresponding to the same linear transformation T(x1, x2, x3) = (x1 + 3x2, 3x1 + x2, –2x3) T ( v 1 ) B ' T ( v 3 ) B ' 1 T ( 1 ) 0 0 T ( 0 ) 1 B' 4 4 4 0 , 0 0 B' B' 0 0 2 B' T ( v 2 ) B ' 1 T ( 1 ) 0 B' 2 0 2 2 , 0 0 B' 0 0 2 4 A' 0 0 0 2 0 0 0 2 7.23 Consider x = (5, –1, 4), and check that T ( x ) B ' A ' x B ' corresponding to the linear transformation T(x1, x2, x3) = (x1 + 3x2, 3x1 + x2, –2x3) T ( x ) B ' 5 T ( 1 ) 4 A ' x B ' 4 0 0 B' 2 14 8 0 2 0 B' 8 6 , 8 x B ' 5 1 4 B' 2 3 , 4 0 2 8 0 3 6 T ( x ) B ' 2 4 8 7.24 For a special basis 𝐵′ = 𝐯1 , 𝐯2 , … , 𝐯𝑛 , where 𝐯𝑖 ’s are eigenvectors of the standard matrix 𝐴, 𝐴′ is obtained immediately to be diagonal due to 𝑇 𝐯𝑖 = 𝐴𝐯𝑖 = 𝜆𝑖 𝐯𝑖 and 𝜆𝑖 𝐯𝑖 𝐵′ = 0𝐯1 + 0𝐯2 + ⋯ + 𝜆𝑖 𝐯𝑖 + ⋯ + 0𝐯𝑛 3 L et B ' be a basis of R m ade up of three linea rly independent eigenvectors o f A found in E x. 8, i.e., B ' { v 1 , v 2 , v 3 } {(1, 1, 0), (1, 1, 0), (0, 0, 1) } T hen A ' , the transform ation m atrix for T relative to the basis B ' , defined as [[T ( v 1 )] B ' [T ( v 2 )] B ' [ T ( v 3 )] B ' ] (see S lide 7.22), is d iagon al , and th e m ain d iagon al en tries are corresp on d in g eigen valu es (see S lides 7.23) for 1 4 for 2 2 B ' {(1, 1, 0), (1, 1, 0), (0, 0, 1)} E igenvectors of A 4 A' 0 0 0 2 0 0 0 2 E igenvalues of A 7.25 Keywords in Section 7.1: eigenvalue problem: 特徵值問題 eigenvalue: 特徵值 eigenvector: 特徵向量 characteristic equation: 特徵方程式 characteristic polynomial: 特徵多項式 eigenspace: 特徵空間 multiplicity: 重數 linear transformation: 線性轉換 diagonalization: 對角化 7.26 7.2 Diagonalization Diagonalization problem (對角化問題): For a square matrix A, does there exist an invertible matrix P such that P–1AP is diagonal? Diagonalizable matrix (可對角化矩陣): Definition 1: A square matrix A is called diagonalizable if there exists an invertible matrix P such that P–1AP is a diagonal matrix (i.e., P diagonalizes A) Definition 2: A square matrix A is called diagonalizable if A is similar to a diagonal matrix ※ In Sec. 6.4, two square matrices A and B are similar if there exists an invertible matrix P such that B = P–1AP. Notes: In this section, I will show that the eigenvalue and eigenvector problem is closely related to the diagonalization problem 7.27 Thm. 7.4: Similar matrices have the same eigenvalues If A and B are similar nn matrices, then they have the same eigenvalues Pf: A and B are similar B P 1 For any diagonal matrix in the form of D = λI, P–1DP = D AP Consider the characteristic equation of B: 1 1 1 1 I B I P A P P IP P A P P ( I A ) P P 1 I A P P 1 1 P I A P P I A I A Since A and B have the same characteristic equation, they are with the same eigenvalues ※ Note that the eigenvectors of A and B are not identical 7.28 Ex 1: Eigenvalue problems and diagonalization programs 1 A 3 0 0 0 2 3 1 0 Sol: Characteristic equation: 1 I A 3 0 3 0 1 0 0 2 ( 4)( 2) 0 2 T he eigenvalues : 1 4, 2 2, 3 2 1 (1) 4 the eigenvector p 1 1 0 7.29 1 0 (2) 2 the eigenvector p 2 1 , p 3 0 0 1 P [p 1 p2 Note: If P [ p 2 1 1 0 1 p3] 1 0 p1 p3] 1 0 0 1 1 0 1 1 0 0 4 1 0 , and P A P 0 0 1 2 1 P AP 0 0 0 4 0 0 2 0 0 0 2 0 0 2 ※ The above example can verify Thm. 7.4 since the eigenvalues for both A and P–1AP are the same to be 4, –2, and –2 ※ The reason why the matrix P is constructed with the eigenvectors of A is demonstrated in Thm. 7.5 on the next slide 7.30 Thm. 7.5: Condition for diagonalization An nn matrix A is diagonalizable if and only if it has n linearly independent eigenvectors ※ If there are n linearly independent eigenvectors, it does not imply that there are n distinct eigenvalues. In an extreme case, it is possible to have only one eigenvalue with the multiplicity n, and there are n linearly independent eigenvectors for this eigenvalue ※ On the other hand, if there are n distinct eigenvalues, then there are n linearly independent eivenvectors (see Thm. 7.6), and thus A must be diagonalizable Pf: ( ) 1 Since A is diagonalizable, there exists a n invertible P s.t. D P AP is diagonal. Let P [ p 1 p 2 P D [p 1 p 2 [ 1 p 1 2 p 2 p n ] and D diag ( 1 , 2 , 1 0 pn] 0 0 2 np n ] 0 , n ), then 0 0 n 7.31 1 AP PD (since D P AP ) [ A p1 A p 2 A p n ] [ 1p 1 2 p 2 A p i i p i , i 1, 2, np n ] , n (T he above equations im ply the colum n ve ctors p i of P are eigenvectors of A , and the diagonal entries i in D are e igenvalues of A ) B ecause A is diagonalizable P is invertible C olum ns in P , i.e., p 1 , p 2 , , p n , are linearly ind ependent (see S lide 4.101 in the lecture note) T hus, A has n linearly independent eigenve ctors ( ) S ince A has n linearly independent eigenvectors p 1 , p 2 , corresponding eigenvalues 1 , 2 , A p i i p i , i 1, 2, Let P [ p 1 p 2 pn ] p n w ith n (co uld be the sam e), then , n 7.32 A P A[ p 1 p 2 p n ] [ A p1 A p 2 [ 1 p 1 2 p 2 S ince p 1 , p 2 , np n ] 1 0 pn] 0 [p 1 p 2 Ap n ] 0 2 0 0 0 PD n , p n are linearly independent P is invertible (see S lide 4.101 in the lecture note) AP PD P 1 AP D A is diagonalizable (according to the definition of the diag onalizable m atrix on S lide 7. 27) ※ N ote that p i 's are linearly independent eigenvectors and the diagonal entries i in the resulting diagonalized D are eigenvalues of A 7.33 Ex 4: A matrix that is not diagonalizable S how that the follow ing m atrix is not diagonalizable 1 A 0 2 1 Sol: Characteristic equation: I A 1 2 0 1 ( 1) 0 2 T he eigenvalue 1 1, and then solve ( 1 I A) x 0 for eigenvectors 0 1 I A I A 0 2 1 eigenvector p 1 0 0 Since A does not have two linearly independent eigenvectors, A is not diagonalizable. 7.34 Steps for diagonalizing an nn square matrix: Step 1: Find n linearly independent eigenvectors p 1 , p 2 , for A with corresponding eigenvalues 1 , 2 , Step 2: Let P [ p 1 p 2 Step 3: pn , n pn ] 1 0 1 P AP D 0 0 0 0 n where A p i i p i , i 1, 2, , n 0 2 7.35 Ex 5: Diagonalizing a matrix 1 A 1 3 1 3 1 1 1 1 Find a matrix P such that 1 P AP is diagonal. Sol: Characteristic equation: I A 1 1 1 3 3 1 1 1 ( 2)( 2)( 3) 0 1 T he eigenvalues : 1 2, 2 2, 3 3 7.36 1 1 2 1 I A 1 3 x1 t x 0 2 x 3 t 1 1 3 2 2 2 I A 1 3 1 x1 4 t 1 x t 2 4 x 3 t 1 G .-J. E . 1 3 1 1 0 0 1 0 0 0 1 0 1 eigenvector p 1 0 1 1 5 1 1 G .-J. E . 1 1 1 0 0 1 eigenvector p 2 1 4 0 1 0 14 1 4 0 7.37 2 3 3 3 I A 1 3 x1 t x t 2 x 3 t P [p 1 p2 2 1 P AP 0 0 1 p3] 0 1 0 2 0 0 0 3 1 0 1 1 G .-J. E . 1 4 1 0 0 0 1 0 1 1 0 1 eigenvector p 3 1 1 1 1 4 1 1 and it follow s that 1 7.38 Note: a quick way to calculate Ak based on the diagonalization technique 1 0 (1) D 0 (2) D P 1 0 1k 0 0 Dk n 0 0 2 0 AP D P k 1 AP P 1 AP 0 0 k n 0 2 k 0 P 1 AP P 1 k A P repeat k tim es 1k 0 k k 1 k A P D P , w here D 0 0 2 k 0 0 0 k n 7.39 Thm. 7.6: Sufficient conditions for diagonalization If an nn matrix A has n distinct eigenvalues, then the corresponding eigenvectors are linearly independent and thus A is diagonalizable according to Thm. 7.5. Pf: Let λ1, λ2, …, λn be distinct eigenvalues and corresponding eigenvectors be x1, x2, …, xn. In addition, consider that the first m eigenvectors are linearly independent, but the first m+1 eigenvectors are linearly dependent, i.e., x m 1 c1 x 1 c 2 x 2 cm x m , (1) where ci’s are not all zero. Multiplying both sides of Eq. (1) by A yields A x m 1 Ac1 x 1 Ac 2 x 2 m 1 x m 1 c1 1 x 1 c 2 2 x 2 Ac m x m cm m x m (2) 7.40 On the other hand, multiplying both sides of Eq. (1) by λm+1 yields m 1 x m 1 c1 m 1 x 1 c 2 m 1 x 2 c m m 1 x m (3) Now, subtracting Eq. (2) from Eq. (3) produces c1 ( m 1 1 )x 1 c 2 ( m 1 2 )x 2 c m ( m 1 m )x m 0 Since the first m eigenvectors are linearly independent, we can infer that all coefficients of this equation should be zero, i.e., c1 ( m 1 1 ) c 2 ( m 1 2 ) c m ( m 1 m ) 0 Because all the eigenvalues are distinct, it follows all ci’s equal to 0, which contradicts our assumption that xm+1 can be expressed as a linear combination of the first m eigenvectors. So, the set of n eigenvectors is linearly independent given n distinct eigenvalues, and according to Thm. 7.5, we can conclude that A is diagonalizable.7.41 Ex 7: Determining whether a matrix is diagonalizable 1 A 0 0 2 0 0 1 1 3 Sol: Because A is a triangular matrix, its eigenvalues are 1 1, 2 0, 3 3. According to Thm. 7.6, because these three values are distinct, A is diagonalizable. 7.42 Ex 8: Finding a diagonalized matrix for a linear transformation Let T : R R be the linear transform ation give n by 3 3 T ( x1 , x 2 , x 3 ) ( x1 x 2 x 3 , x1 3 x 2 x 3 , 3 x1 x 2 x 3 ) 3 Find a basis B ' for R such that the m atrix for T relative to B ' is diagonal. Sol: The standard matrix for T is given by 1 A 1 3 1 3 1 1 1 1 From Ex. 5 you know that λ1 = 2, λ2 = –2, λ3 = 3 and thus A is diagonalizable. So, according to the result on Slide 7.25, these three linearly independent eigenvectors found in Ex. 5 can be 7.43 used to form the basis B '. That is B ' { v 1 , v 2 , v 3 } {( 1, 0, 1), (1, 1, 4), ( 1, 1, 1)} The matrix for T relative to this basis is A ' [T ( v 1 )] B ' [ T ( v 2 )] B ' [ T ( v 3 )] B ' 2 0 0 0 2 0 0 0 3 ※ Note that it is not necessary to calculate A ' through the above equation. According to the result on Slide 7.25, we already know that A ' is a diagonal matrix and its main diagonal entries are corresponding eigenvalues of A 7.44 Keywords in Section 7.2: diagonalization problem: 對角化問題 diagonalization: 對角化 diagonalizable matrix: 可對角化矩陣 7.45 7.3 Symmetric Matrices and Orthogonal Diagonalization Symmetric matrix (對稱矩陣): A square matrix A is symmetric if it is equal to its transpose: A A T Ex 1: Symmetric matrices and nonsymetric matrices 0 A 1 2 4 B 3 3 C 1 1 1 3 0 2 0 5 3 1 2 4 0 (symmetric) (symmetric) 1 0 5 (nonsymmetric) 7.46 Thm 7.7: Eigenvalues of symmetric matrices If A is an nn symmetric matrix, then the following properties are true. (1) A is diagonalizable (symmetric matrices are guaranteed to have n linearly independent eigenvectors and thus be diagonalizable). (2) All eigenvalues of A are real numbers. (3) If is an eigenvalue of A with the multiplicity to be k, then has k linearly independent eigenvectors. That is, the eigenspace of has dimension k. ※ The above theorem is called the Real Spectral Theorem (實數頻譜理 論), and the set of eigenvalues of A is called the spectrum (頻譜) of A. 7.47 Ex 2: Prove that a 2 × 2 symmetric matrix is diagonalizable. a A c c b Pf: Characteristic equation: I A a c c b ( a b ) ab c 0 2 2 As a function in , this quadratic polynomial function has a nonnegative discriminant (判別式) as follows ( a b ) 4(1)( ab c ) a 2 ab b 4 ab 4 c 2 2 2 2 a 2 ab b 4 c 2 2 (a b) 4c 2 2 2 2 0 7.48 (1) ( a b ) 4 c 0 2 2 a b, c 0 a A c c a b 0 0 itself is a diagonal m atrix. a (2) (a b) 4c 0 2 2 The characteristic polynomial of A has two distinct real roots, which implies that A has two distinct real eigenvalues. According to Thm. 7.6, A is diagonalizable. 7.49 Orthogonal matrix (正交矩陣): A square matrix P is called orthogonal if it is invertible and P 1 P (or PP P P I ) T T T Thm. 7.8: Properties of orthogonal matrices An nn matrix P is orthogonal if and only if its column vectors form an orthonormal set. Pf: Suppose the column vectors of P form an orthonormal set, i.e., P p1 p 2 p 1T p 1 T p 2 p1 T P P T p n p 1 p n , w h ere p i p j 0 fo r i j an d p i p i 1 . T p1 p 2 T p2 p2 T pn p2 T p1 p n p1 p1 T p 2 p1 p 2 p1 T p n p n p n p 1 p1 p 2 p2 p2 pn p2 It implies that P–1 = PT and thus P is orthogonal. p1 p n p 2 p1 I n pn pn 7.50 Ex 5: Show that P is an orthogonal matrix. 13 2 P 5 2 3 5 2 3 1 5 4 3 5 0 5 3 5 2 3 Sol: If P is a orthogonal matrix, then P 1 P T P P T I PP T 1 3 25 2 3 5 2 3 1 5 4 3 5 13 0 32 2 5 3 5 3 2 3 2 5 1 5 0 1 3 5 4 0 3 5 5 0 3 5 2 0 1 0 0 0 I 1 7.51 1 2 23 3 3 2 1 M oreover, let p 1 5 , p 2 5 , and p 3 0 , 2 4 5 3 5 3 5 3 5 w e can produce p 1 p 2 p 1 p 3 p 2 p 3 0 and p 1 p 1 p 2 p 2 p 3 p 3 1. S o, {p 1 , p 2 , p 3 } is an orthonorm al set. (T hese results are consistent w ith T hm . 7.8.) 7.52 Thm. 7.9: Properties of symmetric matrices Let A be an nn symmetric matrix. If 1 and 2 are distinct eigenvalues of A, then their corresponding eigenvectors x1 and x2 are orthogonal. (Thm. 7.6 only states that eigenvectors corresponding to distinct eigenvalues are linearly independent) Pf: 1 ( x 1 x 2 ) ( 1 x 1 ) x 2 ( A x 1 ) x 2 ( A x 1 ) x 2 ( x 1 A ) x 2 T because A is sym m etric T T ( x 1 A ) x 2 x 1 ( A x 2 ) x 1 ( 2 x 2 ) x 1 ( 2 x 2 ) 2 (x 1 x 2 ) T T T T he above equation im plies ( 1 2 )( x 1 x 2 ) 0, and be cause 1 2 , it follow s that x 1 x 2 0. So, x 1 and x 2 are ortho gonal. ※For distinct eigenvalues of a symmetric matrix, their corresponding eigenvectors are orthogonal and thus linearly independent to each other ※Note that there may be multiple x1 and x2 corresponding to 1 and 2 7.53 Orthogonal diagonalization (正交對角化): A matrix A is orthogonally diagonalizable if there exists an orthogonal matrix P such that P–1AP = D is diagonal. Thm. 7.10: Fundamental theorem of symmetric matrices Let A be an nn matrix. Then A is orthogonally diagonalizable and has real eigenvalues if and only if A is symmetric. Pf: ( ) A is orthogonally diagonalizable 1 D P A P is diagonal, and P is an orthogonal m atrix s.t. P A PDP 1 PDP A (PDP ) (P ) D P T T T T T T T T 1 PDP T P T A ( ) See the next two slides 7.54 Orthogonal diagonalization of a symmetric matrix: Let A be an nn symmetric matrix. (1) Find all eigenvalues of A and determine the multiplicity of each. ※ According to Thm. 7.9, eigenvectors corresponding to distinct eigenvalues are orthognoal (2) For each eigenvalue of multiplicity 1, choose the unit eigenvector. (3) For each eigenvalue of the multiplicity to be k 2, find a set of k linearly independent eigenvectors. If this set {v1, v2, …, vk} is not orthonormal, apply the Gram-Schmidt orthonormalization process. It is know n that G .-S . process is a kind of linear transform ation, i.e., the produced vectors can be expressed as c1 v 1 c 2 v 2 i. S ince A v 1 v 1 , A v 2 v 2 , A ( c1 v 1 c 2 v 2 c k v k (see S lide 5.55), , Av k v k , c k v k ) ( c1 v 1 c 2 v 2 ck v k ) T he produced vectors through the G .-S . p rocess are still eigenvectors for ii. S ince v 1 , v 2 , , v k are orthogonal to eigenvec tors corresponding to other different eigenvalues (acc ording to T hm . 7.9), c1 v 1 c 2 v 2 c k v k is also orthogonal to eigenvectors corresponding to other different eigenvalues. 7.55 (4) The composite of steps (2) and (3) produces an orthonormal set of n eigenvectors. Use these orthonormal and thus linearly independent eigenvectors as column vectors to form the matrix P. i. According to Thm. 7.8, the matrix P is orthogonal ii. Following the diagonalization process on Slide 7.35, D = P–1AP is diagonal Therefore, the matrix A is orthogonally diagonalizable 7.56 Ex 7: Determining whether a matrix is orthogonally diagonalizable 1 A1 1 1 1 1 1 1 0 1 5 A2 2 1 Orthogonally diagonalizable 1 8 0 2 1 8 3 A3 2 0 0 A4 0 0 2 2 Symmetric matrix 0 1 7.57 Ex 9: Orthogonal diagonalization Find an orthogonal m atrix P that diagonalizes A . 2 A 2 2 2 4 1 2 1 4 Sol: (1) I A ( 3 ) ( 6 ) 0 2 1 6, 2 3 (has a multiplicity of 2) (2) 1 6, v 1 (1, 2, 2) u1 v1 v1 (3) 2 3, v 2 (2, 1, 0), v 3 ( 2, 4, 5) orthogonal ( 13 , 2 3 , 2 3 ) ※ Verify Thm. 7.9 that v1·v2 = v1·v3 = 0 7.58 ※If v2 and v3 are not orthogonal, the Gram-Schmidt Process should be performed. Here we simply normalize v2 and v3 to find the corresponding unit vectors u2 v2 ( v2 1 3 2 P 3 23 u1 2 5 1 5 0 u2 2 5 , 3 5 5 3 5 1 5 , 0), 2 3 5 4 u3 v3 v3 ( 3 25 , 6 1 P AP 0 0 0 3 0 4 3 5 , 5 3 5 ) 0 0 3 u3 ※Note that there are some calculation error in the solution of Ex.9 in the text book 7.59 Keywords in Section 7.3: symmetric matrix: 對稱矩陣 orthogonal matrix: 正交矩陣 orthonormal set: 單範正交集 orthogonal diagonalization: 正交對角化 7.60 7.4 Applications of Eigenvalues and Eigenvectors The rotation for quadratic equation: ax2+bxy+cy2+dx+ey+f = 0 Ex 5: Identify the graphs of the following quadratic equations (a) 4 x 9 y 36 0 2 2 (b) 13 x 10 xy 13 y 72 0 2 2 Sol: (a ) In standard form , w e can obtain x 2 3 2 y 2 2 2 1. ※ Since there is no xy-term, it is easy to derive the standard form and it is apparent that this equation represents an ellipse. 7.61 (b) 13 x 10 xy 13 y 72 0 2 2 ※ Since there is a xy-term, it is difficult to identify the graph of this equation. In fact, it is also an ellipse, which is oblique on the xy-plane. ※ There is a easy way to identify the graph of quadratic equation. The basic idea is to rotate the x- and y-axes to x’- and y’-axes such that there is no more x’y’-term in the new quadratic equation. ※ In the above example, if we rotate the x- and yaxes by 45 degree counterclockwise, the new quadratic equation ( x ') 3 2 2 ( y ') 2 2 2 1 can be derived, which represents an ellipse apparently. ※ In Section 4.8, the rotation of conics is achieved by changing basis, but here the diagonalization technique based on eigenvalues and eignvectors is applied to solving the rotation problem 7.62 Quadratic form (二次形式): ax2 + bxy + cy2 is the quadratic form associated with the quadratic equation ax2 + bxy + cy2 + dx + ey + f = 0. Matrix of the quadratic form: a A b / 2 b / 2 c ※ Note that A is a symmetric matrix. x If we define X = y , then XTAX= ax2 + bxy + cy2 . In fact, the quadratic equation can be expressed in terms of X as follows. X AX d T e X f . 7.63 Principal Axes Theorem (主軸定理) For a conic whose equation is ax2 + bxy + cy2 + dx + ey + f = 0, the rotation to eliminate the xy-term is achieved by X = PX’, where P is an orthogonal matrix that diagonalizes A. That is, P 1 1 AP P AP D 0 T 0 , 2 where λ1 and λ2 are eigenvalues of A. The equation for the rotated conic is given by 1 ( x ') 2 ( y ') d 2 2 e P X f 0. 7.64 Pf: According to Thm. 7.10, since A is symmetric, we can conclude that there exists an orthogonal matrix P such that P–1AP = PTAP = D is diagonal. Replacing X with PX’, the quadratic form becomes T T T T X A X ( P X ) A ( P X ) ( X ) P A P X T 2 2 ( X ) D X 1 ( x ) 2 ( y ) . ※ It is obvious that the new quadratic form in terms of X’ has no x’y’-term, and the coefficients for (x’)2 and (y’)2 are the two eigenvalues of the matrix A. x x x x ※ X P X v 1 v 2 x v 1 y v 2 S ince and are y y y y the orignal and new coodinates, the role s of v 1 and v 2 (the eigenvectors of A ) are like the basis vectors (or the axis vector s) in the new coordinate system . 7.65 Ex 6: Rotation of a conic Perform a rotation of axes to eliminate the xy-term in the following quadratic equation 13 x 10 xy 13 y 72 0 2 2 Sol: The matrix of the quadratic form associated with this equation is 13 A 5 5 . 13 The eigenvalues are λ1 = 8 and λ2 = 18, and the corresponding eigenvectors are 1 1 x 1 and x 2 . 1 1 7.66 After normalizing each eigenvector, we can obtain the orthogonal matrix P as follows. ※ According to the results on p. 1 2 P 1 2 1 cos 45 2 1 sin 45 2 sin 45 cos 45 268 in Ch4, X=PX’ is equivalent to rotate the xycoordinates by 45 degree to form the new x’y’-coordinates, which is also illustrated in the figure on Slide 7.62. Then by replacing X with PX’, the equation of the rotated conic is 8( x ) 18( y ) 72 0, 2 2 which can be written in the standard form ( x ) 2 2 ( y ) 2 2 1. 3 2 ※ The above equation represents an ellipse on the x’y’-plane. 7.67 In three-dimensional version: ax2 + by2 + cz2 + dxy + exz + fyz is the quadratic form associated with the equation of quadric surface: ax2 + by2 + cz2 + dxy + exz + fyz + gx + hy + iz + j = 0 Matrix of the quadratic form: a A d /2 e / 2 d /2 b f /2 e/2 f /2 c ※ Note that A is a symmetric matrix. If we define X = [x y z]T, then XTAX= ax2 + by2 + cz2 + dxy + exz + fyz, and the quadratic surface equation can be expressed as X A X g h i X j. T 7.68 Keywords in Section 7.4: quadratic form (二次形式) principal axes theorem (主軸定理) 7.69 7.5 Principal Component Analysis (主成分分析) Principal component analysis It is a way of identifying the underlying patterns in data It can extract information in a large data set with many variables and approximate this data set with fewer factors In other words, it can reduce the number of variables to a more manageable set Steps of the principal component analysis Step 1: Get some data Step 2: Subtract the mean Step 3: Calculate the covariance matrix Step 4: Calculate the eigenvectors and eigenvalues of the covariance matrix Step 5: Deriving the transformed data set Step 6: Getting the original data back 7.70 Step 1: x Step 2: y 2.5 0.5 2.2 1.9 3.1 2.3 2.0 1.0 1.5 1.1 1.81 x 2.4 0.7 2.9 2.2 3.0 2.7 1.6 1.1 1.6 0.9 1.91 dem eaned y 0.69 -1.31 0.39 0.09 1.29 0.49 0.19 -0.81 -0.31 -0.71 0 0.49 -1.21 0.99 0.29 1.09 0.79 -0.31 -0.81 -0.31 -1.01 0 X T x y Step 3: C ovoriance m atrix of X x2 E xy T x T E X X E y xy var( x ) 2 y cov( x , y ) x y cov( x , y ) 0.616556 var( y ) 0.615444 0.615444 A 0.716556 7.71 Step 4: Calculate the eigenvectors and eigenvalues of the covariance matrix A 0.67787 1 1.284028, v 1 = 0.73518 0.73518 2 0.049083, v 2 = 0.67787 v1 v2 ※ First, the two eigenvectors are perpendicular (orthogonal) to each other according to Thm. 7.9 (In fact, they are orthonormal here) ※ Second, v1 eigenvector is just like a best-fit regression line. ※ Third, v2 seems less important to explain the data since the projection of each node on the v2 axis is very close to zero. ※ Fourth, the interpretation of v1 is the new axis which retains as much as possible the interpoint distance information (or the variance information) that was contained in the original two dimensions. 7.72 ※ The intuition behind the principal component analysis: (1) T otal variance of series of x and y = variance of x + variance of y = sum of the m ain diagonal entries in the covariance m atrix A = 0.616556+0.716556 = 1.33311 (T he series x , w hich are t he coordinate values on the x -axis, explains 0.616556/1 .33311 = 46.25% of total variance) (2) C onsider P = [ v 1 v 2 ] and X = P X . (A ccording to the P rincipal A xes T heorem on S lide 7.65, it is equivalent to transform x - and y -axes to be v 1 - and v 2 -axes, i.e., the data is the sam e but w ith different coordinate values X on th e v 1 v 2 -plane.) 1 T T T T T X P X P X ( X ) X P , w here ( X ) [ x y ] and ( X ) [ x y ] 1 T T T T T var(( X ) ) = var( X P ) P var( X ) P P A P D 0 0 (It also implies that the new series 2 of x’ and y’ are independent) (3) T otal variance of transform ed series of x and y (called principal com ponen ts ) in X = variance of x + variance of y T = sum of the m ain diagonal entries i n the covariance m atrix var(( X ) ) = 1 2 (4) A property for eigenvalues: T race( A ) = , i w hich m eans that after the transform atio n, the total variance rem ains the sam e. In this case, 1 2 1.284028 0.049083 1.33311 . (5) T he new series x , w hich are the coord inate values on the v 1 -axis, explains 1 /( 1 2 ) 1.284028 /(1.284028 0.049083) 96.32% o f total variance 7.73 Step 5: Deriving the transformed data set: ( X ) T X T P v11 0.67787 C ase 1: P v 1 v 2 v12 0.73518 v 21 0.73518 v 22 0.67787 v11 0.67787 T ( X ) x y x y v12 0.73518 v 21 0.73518 v 22 0.67787 v11 0.67787 C ase 2: P v 1 0 v12 0.73518 v11 0.67787 T ( X ) x y x y v12 0.73518 v11 x v12 y v 21 x v 22 y 0.67787 x 0.73518 y ( X ) T 0 0 v11 x v12 y 0 0.73518 x 0.67787 y 0.67787 x 0.73518 y 0 x’ y’ x’ -0.82797 1.77758 -0.99220 -0.27421 -1.67580 -0.91295 0.09911 1.14457 0.43805 1.22382 0 -0.17512 0.14286 0.38437 0.13042 -0.20950 0.17528 -0.34982 0.04642 0.01776 -0.16268 0 -0.82797 1.77758 -0.99220 -0.27421 -1.67580 -0.91295 0.09911 1.14457 0.43805 1.22382 0 1.284028 T var(( X ) ) = 0 0 0 0.049083 0 ( X ) T y’ 1.284028 T var(( X ) ) = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7.74 Step 6: Getting the original data back: X T 1 ( X ) P ( ( X ) P ) original m ean , w here P = [ v 1 v 2 ] T T v11 0.67787 x y x y v 21 0.73518 T v12 0.73518 v11 x v 21 y v12 x v 22 y v 22 0.67787 0.67787 x 0.73518 y 0.73518 x 0.67787 y case 1 x case 2 x y 2.5 0.5 2.2 1.9 3.1 2.3 2 1 1.5 1.1 1.81 2.4 0.7 2.9 2.2 3 2.7 1.6 1.1 1.6 0.9 1.91 ※ We can derive the original data set if we take both v1 and v2 and thus x’ and y’ into account when deriving the transformed data y 2.37 0.61 2.48 2.00 2.95 2.43 1.74 1.03 1.51 0.98 1.81 2.52 0.60 2.64 2.11 3.14 2.58 1.84 1.07 1.59 1.01 1.91 ※ Although when we derive the transformed data, only v1 and thus only x’ are considered, the data gotten back is still similar to the original data. That means, x’ can be a common factor almost able to explain both series x and y7.75 v1 v2 ※ If only the principal component x’ is considered in the Principal Component Analysis (PCA), it is equivalent to project all points onto the v1 vector ※ It can be observed in the above figure that the projection onto v1 vector can retains as much as possible the interpoint distance information (variance) that was contained in the original series of (x, y) 7.76 Factor loadings: the correlations between the principal components (F1 = x’ and F2 = y’) and the original variables (x1 = x and x2 = y) lij Fi x j l11 x x 0.67787 1.284028 l12 x y 0.97824 v ij i s .d . j l 21 y x 0.785211 0.73518 1.284028 0.846496 0.98414 l 22 y y 0.73518 0.049083 0.20744 0.785211 0.67787 0.049083 0.177409 0.846496 Factor loadings are used to identify and interpret the unobservable principal components ※ The factor loadings of x’ on x and y are close to 1 in absolute levels, which implies the principal component x’ can explain x and y quite well and thus x’ can viewed as an index to represent the combined information of x and y 7.77 ※ Questionnaire (問卷) analysis: salary vs. personal and learned-courses information i. If there are five variables (the results of five problems), x1 to x5, x1 to x3 are about personal information of the respondent (作答者), and x4 and x5 are about the course information which this respondent had learned ii. Suppose there are two principal components x1’ and x2’ (x3’ , x4’ , x5’ and are minor components), and the principal component x1’ is highly correlated with x1 to x3 and the principal component x2’ is highly correlated with x4 and x5 iii. x1’ can be interpreted as a general index to represent the personal characteristic, and x2’ can be interpreted as a general index associated with the course profile that the respondent had learned iv. Study the relationship between the salary level and the indexes x1’ and x2’ 7.78