A<-matrix(c(2,1,1,2),nrow=2,ncol=2)
A
# [,1] [,2]
#[1,] 2 1
#[2,] 1 2
E<-eigen(A)
E
#$values
#[1] 3 1
#$vectors
# [,1] [,2]
#[1,] 0.7071068 -0.7071068
#[2,] 0.7071068 0.7071068
c1<-c(E$vectors[1,1],E$vectors[2,1])
c1
#[1] 0.7071068 0.7071068
c2<-c(E$vectors[1,2],E$vectors[2,2])
c2
#[1] -0.7071068 0.7071068
Q1<-c1%*%t(c1)
Q2<-c2%*%t(c2)
3*Q1+1*Q2
# [,1] [,2]
#[1,] 2 1
#[2,] 1 2