# LA Ch8 Exs Prob 14 by 김지윤

## 1675 days ago by jykim

#1 A=matrix(4, 3, [1,0,0,0,0,4,0,3,0,0,0,3]) B=(A.transpose())*A print "A'A=" print B print eig=B.eigenvalues() print "eigenvalues of A'A=" print eig print print "eigenvectors of A'A=" print B.right_eigenvectors() v1=B.right_eigenvectors()/B.right_eigenvectors().norm() v2=B.right_eigenvectors()/B.right_eigenvectors().norm() v3=B.right_eigenvectors()/B.right_eigenvectors().norm() print V=column_matrix([v1,v2,v3]) print "V=" print V
 A'A= [ 1 0 0] [ 0 9 0] [ 0 0 25] eigenvalues of A'A= [25, 9, 1] eigenvectors of A'A= [(25, [ (0, 0, 1) ], 1), (9, [ (0, 1, 0) ], 1), (1, [ (1, 0, 0) ], 1)] V= [0 0 1] [0 1 0] [1 0 0] A'A= [ 1 0 0] [ 0 9 0] [ 0 0 25] eigenvalues of A'A= [25, 9, 1] eigenvectors of A'A= [(25, [ (0, 0, 1) ], 1), (9, [ (0, 1, 0) ], 1), (1, [ (1, 0, 0) ], 1)] V= [0 0 1] [0 1 0] [1 0 0]
#2 B1=A*(A.transpose()) print "AA'=" print B1 print eig1=B1.eigenvalues() print "eigenvalues of AA'=" print eig1 print print "eigenvectors of AA'=" print B1.right_eigenvectors() u1=B1.right_eigenvectors()/B1.right_eigenvectors().norm() u2=B1.right_eigenvectors()/B1.right_eigenvectors().norm() u3=B1.right_eigenvectors()/B1.right_eigenvectors().norm() u4=B1.right_eigenvectors()/B1.right_eigenvectors().norm() print U=column_matrix([u1,u2,u3,u4]) print "U=" print U
 AA'= [ 1 0 0 0] [ 0 16 0 12] [ 0 0 9 0] [ 0 12 0 9] eigenvalues of AA'= [25, 9, 1, 0] eigenvectors of AA'= [(25, [ (0, 1, 0, 3/4) ], 1), (9, [ (0, 0, 1, 0) ], 1), (1, [ (1, 0, 0, 0) ], 1), (0, [ (0, 1, 0, -4/3) ], 1)] U= [ 0 0 1 0] [ 4/5 0 0 3/5] [ 0 1 0 0] [ 3/5 0 0 -4/5] AA'= [ 1 0 0 0] [ 0 16 0 12] [ 0 0 9 0] [ 0 12 0 9] eigenvalues of AA'= [25, 9, 1, 0] eigenvectors of AA'= [(25, [ (0, 1, 0, 3/4) ], 1), (9, [ (0, 0, 1, 0) ], 1), (1, [ (1, 0, 0, 0) ], 1), (0, [ (0, 1, 0, -4/3) ], 1)] U= [ 0 0 1 0] [ 4/5 0 0 3/5] [ 0 1 0 0] [ 3/5 0 0 -4/5]
#3 sv=[sqrt(i) for i in eig] d1=sv d2=sv d3=sv print "singular values =", (d1,d2,d3) print S=matrix(4,3,[d1,0,0,0,d2,0,0,0,d3,0,0,0]) print "S=" print S
 singular values = (5, 3, 1) S= [5 0 0] [0 3 0] [0 0 1] [0 0 0] singular values = (5, 3, 1) S= [5 0 0] [0 3 0] [0 0 1] [0 0 0]
#4 C=U*S*V1 print "A=UST'=" print C
 A=UST'= [1 0 0] [0 0 4] [0 3 0] [0 0 3] A=UST'= [1 0 0] [0 0 4] [0 3 0] [0 0 3]