summaryrefslogtreecommitdiff
path: root/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6
diff options
context:
space:
mode:
authorPrashant S2019-10-04 12:27:32 +0530
committerGitHub2019-10-04 12:27:32 +0530
commitac2986488a9731cff5cbb517d8f0ef98e2561d64 (patch)
tree7bb3f64824627ef179d5f341266a664fd0b69011 /Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6
parentcbb2770fb2f88246175add29623103a56ba338b8 (diff)
parentb3f3a8ecd454359a2e992161844f2fb599f8238a (diff)
downloadR_TBC_Uploads-master.tar.gz
R_TBC_Uploads-master.tar.bz2
R_TBC_Uploads-master.zip
Merge pull request #1 from prashantsinalkar/masterHEADmaster
Added R TBC
Diffstat (limited to 'Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6')
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.1/Ex6.1_1.r19
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.2/Ex6.1_2.r13
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.3/Ex6.1_3.r8
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.4/Ex6.1_4.r81
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.a/Ex6_6.1A.r31
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.b/Ex6_6.1B.r19
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.1/Ex6.2_1.r20
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.2/Ex6.2_2.r16
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.b/Ex6_6.2B.r33
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.3.1/Ex6.3_1.r22
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.3.2/Ex6.3_2.r18
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.3.6/Ex6.3_6.r18
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.3.b/Ex6_6.3B.r18
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.4.1/Ex6.4_1.r14
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.4.4/Ex6.4_4.r23
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.4.b/Ex6_6.4B.r32
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.5.1/Ex6.5_1.r18
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.6.1/Ex6.6_1.r17
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.6.2/Ex6.6_2.r10
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.6.3/Ex6.6_3.r9
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.6.a/Ex6_6.6A.r9
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.7.3/Ex6.7_3.r8
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.7.4/Ex6.7_4.r8
23 files changed, 464 insertions, 0 deletions
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.1/Ex6.1_1.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.1/Ex6.1_1.r
new file mode 100644
index 00000000..bb43e3c8
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.1/Ex6.1_1.r
@@ -0,0 +1,19 @@
+# Example : 1 Chapter : 6.1 Page No: 284
+# Eigen values and eigen vectors
+A<-matrix(c(0.8,0.2,0.3,0.7),ncol=2)
+sol<-eigen(A)
+lambda<-sol$values
+x<-sol$vectors
+print("The eigen values of the matrix are")
+print(lambda)
+print("The eigen vectors of the matrix in normalised form are")
+print(x)
+#to get eigen vectors in the textbook multiply normalised vectors by scalars
+x[,1]<-x[,1]*(0.6/x[1,1])
+x[,2]<-x[,2]*(1/x[1,2])
+print("Eigen vectors with respect to the above eigen values respectively are")
+print(x)
+print(A%*%x)
+#The answer may slightly vary due to rounding off values
+#The answers provided in the text book may vary because of the computation process
+#Both answers are correct , here it is taken -Ax+b=0 , In the text book it is considered as Ax-b=0
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.2/Ex6.1_2.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.2/Ex6.1_2.r
new file mode 100644
index 00000000..369a5e47
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.2/Ex6.1_2.r
@@ -0,0 +1,13 @@
+# Example : 2 Chapter : 6.1 Page No: 285
+# Eigen values and eigen vectors of Projection matrix
+A<-matrix(c(0.5,0.5,0.5,0.5),ncol=2)
+sol<-eigen(A)
+lambda<-sol$values
+x<-sol$vectors #These are normalised eigen vectors
+#to get eigen vectors in text book multiply them with scalars
+x[,1]<-x[,1]*(1/x[1,1])
+x[,2]<-x[,2]*(1/x[1,2])
+print("The eigen values of the matrix are")
+print(lambda)
+print("The eigen vectors of the matrix are")
+print(x) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.3/Ex6.1_3.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.3/Ex6.1_3.r
new file mode 100644
index 00000000..f878ef16
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.3/Ex6.1_3.r
@@ -0,0 +1,8 @@
+# Example : 3 Chapter : 6.1 Page No: 286
+# Eigen values and eigen vectors of Reflection matrix
+A<-matrix(c(0,1,1,0),ncol=2)
+sol<-eigen(A)
+lambda<-sol$values
+print("The eigen values of the matrix are")
+print(lambda)
+#The answer may slightly vary due to rounding off values
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.4/Ex6.1_4.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.4/Ex6.1_4.r
new file mode 100644
index 00000000..6d8b139e
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.4/Ex6.1_4.r
@@ -0,0 +1,81 @@
+# Packages used : pracma
+# To install pracma,type following in command line while connected to internet
+# install.packages("pracma")
+# package can be included by command " library(pracma) "
+# for more information about pracma visit https://cran.r-project.org/web/packages/pracma/index.html
+
+# Example : 4 Chapter : 6.1 Page No: 287
+# Eigen values and eigen vectors of Singualar matrix
+
+library(pracma)
+nullspacebasis <- function(A){
+ R<-rref(A)
+ m<-nrow(A)
+ n<-ncol(A)
+ pivotcol<-c() #vector to store the column numbers of pivot columns
+ freecol<-c() #vector to store the column numbers of free columns
+ i<-1
+ j<-1
+
+ # to find which columns are pivot and which are free
+ while(i<=m & j<=n){
+ if(R[i,j]==1){
+ pivotcol<-c(pivotcol,j)
+ i<-i+1
+ j<-j+1
+ }
+ else{
+ j<-j+1
+ }
+ }
+ y<-length(pivotcol)
+ freecol<-c(1:n)
+ freecol<-freecol[!freecol%in%pivotcol]
+ x<-length(freecol)
+ N<-c()
+ #find the basis for null space based on Row reduced echelon form of given matrix
+ if(y==n){
+ return(N)
+ }
+ for(i in 1:x){
+ temp<-c(1:n)
+ for(j in 1:x){
+ temp[freecol[j]]<-0
+ }
+ temp[freecol[i]]<-1
+ temp[freecol[i]]
+ for(j in 1:y){
+ temp[pivotcol[j]]<-R[j,freecol[i]]*-1
+ }
+ N<-c(N,temp)
+ }
+ N<-matrix(N,nrow=n,ncol=x)
+ #Basis for the nullspace of given matrix
+ return(N)
+}
+A<-matrix(c(1,2,2,4),ncol=2)
+sol<-eigen(A)
+print(sol)
+lambda<-sol$values
+print("The eigen values of the matrix are")
+print(lambda)
+I<-matrix(c(1,0,0,1),ncol=2)
+E1<-A-lambda[1]*I
+E1
+rref(E1)
+x1<-nullspacebasis(E1)
+E2<-A-lambda[2]*I
+rref(E2)
+x2<-nullspacebasis(E2)
+print("The eigen vectors of the matrix in normalized form are")
+print(x1)
+print(x2)
+#to get eigen vectors in the textbook multiply normalised vectors by scalars
+x1<-2*x1
+x2<--1*x2
+print("The eigen vectors of the matrix are ")
+print(x2)
+print(x1)
+#The answer may slightly vary due to rounding off values
+#The answers provided in the text book may vary because of the computation process
+#Both answers are correct , here it is taken -Ax+b=0 , In the text book it is considered as Ax-b=0
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.a/Ex6_6.1A.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.a/Ex6_6.1A.r
new file mode 100644
index 00000000..b7bf991a
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.a/Ex6_6.1A.r
@@ -0,0 +1,31 @@
+# Example : 6.1A Chapter : 6.1 Page No: 291
+# Eigen values and eigen vectors
+solution<-function(A){
+ sol<-eigen(A)
+ lambda<-sol$values
+ x<-sol$vectors #these are normalised eigen vectors
+ #to get the eigen vectors as in texxt book multiply these normalised vectors with scalars
+ x[,1]<-x[,1]*(1/x[1,1])
+ x[,2]<-x[,2]*(1/x[1,2])
+ print("The eigen values of the matrix are")
+ print(lambda)
+ print("The eigen vecotrs of the matrix respective to above eigen values are")
+ print(x)
+}
+
+A<-matrix(c(2,-1,-1,2),ncol=2)
+print("For A")
+solution(A)
+A2<-A%*%A
+print("For square of A")
+solution(A2)
+A1<-solve(A)
+print("For inverse of A")
+solution(A1)
+I<-matrix(c(1,0,0,1),ncol=2)
+A4I<-A+4*I
+print("For A+4I")
+solution(A4I)
+#The answer may slightly vary due to rounding off values
+#The answers provided in the text book may vary because of the computation process
+#Both answers are correct , here it is taken -Ax+b=0 , In the text book it is considered as Ax-b=0
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.b/Ex6_6.1B.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.b/Ex6_6.1B.r
new file mode 100644
index 00000000..f2c11521
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.1.b/Ex6_6.1B.r
@@ -0,0 +1,19 @@
+# Example : 6.1B Chapter : 6.1 Page No: 292
+# Eigen values and eigen vectors
+solution<-function(A){
+ sol<-eigen(A)
+ lambda<-round(sol$values)
+ x<-sol$vectors #these are normalised eigen vectors
+ #to get eigen vectors in text book multiply normalised eigen vectors with scalars
+ x[,1]<-x[,1]*(1/x[1,1])
+ x[,2]<-round(x[,2]*(1/x[1,2]))
+ x[,3]<-x[,3]*(1/x[1,3])
+ print("The eigen values of the matrix are")
+ print(lambda)
+ print("The eigen vectors of the matrix respective to above eigen values are")
+ print(x)
+}
+
+A<-matrix(c(1,-1,0,-1,2,-1,0,-1,1),ncol=3)
+solution(A)
+#The answer may slightly vary due to rounding off values
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.1/Ex6.2_1.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.1/Ex6.2_1.r
new file mode 100644
index 00000000..42b08fae
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.1/Ex6.2_1.r
@@ -0,0 +1,20 @@
+# Example : 1 Chapter : 6.2 Page No: 299
+# Diagonilizing a Matrix and Power of matrix computed from power of its diagonal matrix
+A<-matrix(c(1,0,5,6),ncol=2)
+lambda<-eigen(A)$values
+S<-eigen(A)$vectors
+S<-round(S)
+S1<-solve(S)
+Diag_matrix<-round(S1%*%A%*%S)
+print("Diagonal Matrix is ")
+print(Diag_matrix)
+A2<-A%*%A
+print("The square of matrix")
+print(A2)
+print("The Power of matrix can also be computed from its diagonal matrix as follows")
+A2_diag<-S%*%Diag_matrix%*%Diag_matrix%*%S1
+print("The square of matrix computed from its diagonal matrix")
+print(A2_diag)
+#The answer may slightly vary due to rounding off values
+#The answers provided in the text book may vary because of the computation process
+#Both answers are correct , here it is taken -Ax+b=0 , In the text book it is considered as Ax-b=0 \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.2/Ex6.2_2.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.2/Ex6.2_2.r
new file mode 100644
index 00000000..09d7f4c4
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.2/Ex6.2_2.r
@@ -0,0 +1,16 @@
+# Example : 2 Chapter : 6.2 Page No: 300
+# The diagonal matrix of any matrix contains the eigen values in its main diagonal
+A<-matrix(c(0.8,0.2,0.3,0.7),ncol=2)
+lambda<-eigen(A)$values
+print(lambda)
+S<-eigen(A)$vectors #Normlised eigen vectors, Answer can also be validated with normalised eigen vectors
+#to get eigen vector matrix in text book
+S[,1]<-S[,1]*(0.6/S[1,1])
+S[,2]<-S[,2]*(1/S[1,2])
+S1<-solve(S)
+Diag_matrix<-diag(2)*lambda
+print("S*diag_matrix(A)*S-1 is A")
+print(S%*%Diag_matrix%*%S1)
+#The answer may slightly vary due to rounding off values
+#The answers provided in the text book may vary because of the computation process
+#Both answers are correct , here it is taken -Ax+b=0 , In the text book it is considered as Ax-b=0 \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.b/Ex6_6.2B.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.b/Ex6_6.2B.r
new file mode 100644
index 00000000..991d615a
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.b/Ex6_6.2B.r
@@ -0,0 +1,33 @@
+# Packages used : pracma
+# To install pracma,type following in command line while connected to internet
+# install.packages("pracma")
+# package can be included by command " library(pracma) "
+# for more information about pracma visit https://cran.r-project.org/web/packages/pracma/index.html
+
+# Example : 6.2B Chapter : 6.2 Page No: 306
+# Inverse Eigen values Determinant and eigen vector matrix
+library(pracma)
+A<-5*eye(4)-ones(4)
+eigenvalues<-eigen(A)$values
+print("Eigen Values of A ")
+print(eigenvalues)
+A1<-solve(A)
+print("Inverse of A ")
+print(A1)
+eigenvalues1<-eigen(A1)$value
+print("Eigen Values of A inverse ")
+print(eigenvalues1)
+detA<-det(A)
+print("Determinant of A")
+print(detA)
+x<-eigen(A)$vectors[,4] #normalized eigen vector of eigen value=1
+#toget eigen vector in text book
+x<-x*(1/x[1])
+print("Eigen vector of A for eigen value 1")
+print(x)
+print("The other eigen vectors are perpendicular to x since A is Symmetric so eigen vector matrix contains x with different signs as follows")
+S<-matrix(c(1,-1,1,-1,1,1,-1,-1,1,-1,-1,1,x),ncol=4)
+print(S)
+print("To get normalized matrix multiply by magnitude of vectors which is same for all and is 0.5")
+S<-0.5*S
+print(S) # The eigen vectors are with respect to 5,5,5,1 \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.3.1/Ex6.3_1.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.3.1/Ex6.3_1.r
new file mode 100644
index 00000000..72bb740f
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.3.1/Ex6.3_1.r
@@ -0,0 +1,22 @@
+# Example : 1 Chapter : 6.3 Page No: 313
+# Solve Differential equation
+
+# lambda1,lamda2,x1,x2,c,d are computed here.. for remaining details look textbook
+A<-matrix(c(0,1,1,0),ncol=2)
+lambda<-eigen(A)$values
+x<-eigen(A)$vectors #These are normalised eigen vectors
+#to get eigen vectors in textbook .. Multiply them with the scalars
+x[,1]<-x[,1]*(1/x[1,1])
+x[,2]<-x[,2]*(1/x[1,2])
+print(x)
+u<-c(4,2)
+cd<-solve(x,u)
+C<-cd[1]
+D<-cd[2]
+print("Lambda 1 and Lambda 2")
+print(lambda)
+print("x1 and x2")
+print(x)
+print("C and D are")
+print(C)
+print(D) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.3.2/Ex6.3_2.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.3.2/Ex6.3_2.r
new file mode 100644
index 00000000..d583fb2f
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.3.2/Ex6.3_2.r
@@ -0,0 +1,18 @@
+# Example : 2 Chapter : 6.3 Page No: 314
+# Solve Differential equation
+
+# lambda1,lamda2,lambda3,x1,x2,x3,c1,c2,c3 are computed here.. for remaining details look textbook
+A<-matrix(c(1,0,0,1,2,0,1,1,3),ncol=3)
+lambda<-eigen(A)$values
+x<-round(eigen(A)$vectors)
+u<-c(9,7,4)
+c<-solve(x,u)
+print("Lambda 3 and Lambda 2 and Lambda 1 are")
+print(lambda)
+print("x3 and x2 and x1")
+print(x)
+print("c3,c2 and c1 are")
+print(c)
+#The answer may slightly vary due to rounding off values
+#The answers provided in the text book may vary because of the computation process
+#Both answers are correct , here it is taken -Ax+b=0 , In the text book it is considered as Ax-b=0
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.3.6/Ex6.3_6.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.3.6/Ex6.3_6.r
new file mode 100644
index 00000000..dad9885d
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.3.6/Ex6.3_6.r
@@ -0,0 +1,18 @@
+# Example : 6 Chapter : 6.3 Page No: 321
+# Solve Differential equation
+
+# lambda1,lamda2,x1,x2,c,d are computed here.. for remaining details look textbook
+A<-matrix(c(1,0,1,2),ncol=2)
+lambda<-eigen(A)$values
+x<-round(eigen(A)$vectors)
+u<-c(2,1)
+c<-solve(x,u)
+print("Lambda 1 and Lambda 2")
+print(lambda)
+print("x1 and x2")
+print(x)
+print("c1 and c2 are")
+print(c)
+#The answer may slightly vary due to rounding off values
+#The answers provided in the text book may vary because of the computation process
+#Both answers are correct , here it is taken -Ax+b=0 , In the text book it is considered as Ax-b=0
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.3.b/Ex6_6.3B.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.3.b/Ex6_6.3B.r
new file mode 100644
index 00000000..30f54de1
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.3.b/Ex6_6.3B.r
@@ -0,0 +1,18 @@
+# Example : 6.3B Chapter : 6.3 Page No: 322
+# Eigen Values and Eigen vectors of A
+A<-matrix(c(-2,1,0,1,-2,1,0,1,-2),ncol=3)
+eigenvalues<-eigen(A)$values
+x<-eigen(A)$vectors
+print("Eigen values of A are ")
+print(eigenvalues)
+print("Eigen vectors of A in normalised form")
+print(x)
+#to get eigen vectors in the textbook multiply normalised vectors by scalars
+x[,1]<-x[,1]*(1/x[1,1])
+x[,2]<-x[,2]*(1/x[1,2])
+x[,3]<-x[,3]*(1/x[1,3])
+print("Eigen vectors with respect to the above eigen values respectively are")
+print(x)
+#The answer may slightly vary due to rounding off values
+#The answers provided in the text book may vary because of the computation process
+#Both answers are correct , here it is taken -Ax+b=0 , In the text book it is considered as Ax-b=0
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.4.1/Ex6.4_1.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.4.1/Ex6.4_1.r
new file mode 100644
index 00000000..9baefa7d
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.4.1/Ex6.4_1.r
@@ -0,0 +1,14 @@
+# Example : 1 Chapter : 6.4 Page No: 331
+# Eigen Values and Eigen vectors of A
+A<-matrix(c(1,2,2,4),ncol=2)
+lambda<-eigen(A)$values
+x<-eigen(A)$vectors #These are Normalised eigen vectors
+#to get eigen vectors in textbook
+x[,1]<-x[,1]*(1/x[1,1])
+x[,2]<-x[,2]*(2/x[1,2])
+print("Eigen values and eigen vectors of respective eigen values of A")
+print(lambda)
+print(x)
+#The answer may slightly vary due to rounding off values
+#The answers provided in the text book may vary because of the computation process
+#Both answers are correct , here it is taken -Ax+b=0 , In the text book it is considered as Ax-b=0
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.4.4/Ex6.4_4.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.4.4/Ex6.4_4.r
new file mode 100644
index 00000000..423a09e1
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.4.4/Ex6.4_4.r
@@ -0,0 +1,23 @@
+# Packages used : pracma
+# To install pracma,type following in command line while connected to internet
+# install.packages("pracma")
+# package can be included by command " library(pracma) "
+# for more information about pracma visit https://cran.r-project.org/web/packages/pracma/index.html
+
+# Example : 4 Chapter : 6.4 Page No: 334
+# Pivots and Eigen values have same signs for the Symmetric matrices
+library(pracma)
+A<-matrix(c(1,3,3,1),ncol=2)
+u<-lu(A)$U
+pivots<-c(u[1,1],u[2,2])
+eigenvalues<-eigen(A)$values
+print("Eigen values and pivots have same signs for symmetric matrix")
+print(pivots)
+print(eigenvalues)
+print("This is not true if the matrix is not symmetric")
+B<-matrix(c(1,-1,6,-4),ncol=2)
+Bu<-lu(B)$U
+Bpivots<-c(Bu[1,1],Bu[2,2])
+Beigenvalues<-eigen(B)$values
+print(Bpivots)
+print(Beigenvalues) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.4.b/Ex6_6.4B.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.4.b/Ex6_6.4B.r
new file mode 100644
index 00000000..566bf027
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.4.b/Ex6_6.4B.r
@@ -0,0 +1,32 @@
+# Example : 6.4B Chapter : 6.4 Page No: 336
+# Eigen Values and Eigen vectors of given matrices
+A3<-matrix(c(2,-1,0,-1,2,-1,0,-1,2),ncol=3)
+eigenvalues<-eigen(A3)$values
+x<-eigen(A3)$vectors
+print("Eigen values of A3 are ")
+print(eigenvalues)
+print("Eigen vectors of A3 in normalised form are ")
+print(x)
+#to get eigen vectors in the textbook multiply normalised vectors by scalars
+x[,1]<-x[,1]*(1/x[1,1])
+x[,2]<-x[,2]*(sqrt(2)/x[1,2])
+x[,3]<-x[,3]*(1/x[1,3])
+print("Eigen vectors with respect to the above eigen values respectively are")
+print(x)
+B4<-matrix(c(1,-1,0,0,-1,2,-1,0,0,-1,2,-1,0,0,-1,1),ncol=4)
+B4eigenvalues<-eigen(B4)$values
+B4x<-eigen(B4)$vectors
+print("Eigen values of B4 are ")
+print(B4eigenvalues)
+print("Eigen vectors of B4 in normalised form are")
+print(B4x)
+#to get eigen vectors in the textbook multiply normalised vectors by scalars
+B4x[,1]<-B4x[,1]*(1/B4x[1,1])
+B4x[,2]<-B4x[,2]*(1/B4x[1,2])
+B4x[,3]<-B4x[,3]*(1/B4x[1,3])
+B4x[,4]<-B4x[,4]*(1/B4x[1,4])
+print("Eigen vectors with respect to the above eigen values respectively are")
+print(B4x)
+#The answer may slightly vary due to rounding off values
+#The answers provided in the text book may vary because of the computation process
+#Both answers are correct , here it is taken -Ax+b=0 , In the text book it is considered as Ax-b=0
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.5.1/Ex6.5_1.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.5.1/Ex6.5_1.r
new file mode 100644
index 00000000..e9a01511
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.5.1/Ex6.5_1.r
@@ -0,0 +1,18 @@
+# Packages used : pracma
+# To install pracma,type following in command line while connected to internet
+# install.packages("pracma")
+# package can be included by command " library(pracma) "
+# for more information about pracma visit https://cran.r-project.org/web/packages/pracma/index.html
+
+# Example : 1 Chapter : 6.5 Page No: 344
+# Tests for positive definitenes
+library(pracma)
+A<-matrix(c(2,-1,0,-1,2,-1,0,-1,2),ncol=3)
+u<-lu(A)$U
+pivots<-c(u[1,1],u[2,2],u[3,3])
+upper_left_deteminants<-c(A[1,1],det(A[-3,-3]),det(A))
+eigenvalues<-eigen(A)$values
+print("All pivots, upper left determinants and eigen values are positive")
+print(pivots)
+print(upper_left_deteminants)
+print(eigenvalues) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.6.1/Ex6.6_1.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.6.1/Ex6.6_1.r
new file mode 100644
index 00000000..f385fe21
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.6.1/Ex6.6_1.r
@@ -0,0 +1,17 @@
+# Example : 1 Chapter : 6.6 Page No: 356
+# Similar matrices are matrices with same eigen values
+A<-matrix(c(0.5,0.5,0.5,0.5),ncol=2)
+Aev<-eigen(A)$values
+print("Eigen values of A ")
+print(Aev)
+Lambda<-matrix(c(1,0,0,0),ncol=2)
+Lev<-eigen(Lambda)$values
+print("eigen values of lambda matrix")
+print(Lev)
+M<-matrix(c(1,1,0,2),ncol=2)
+M1<-solve(M)
+M1AM<-M1%*%A%*%M
+M1AMev<-eigen(M1AM)$values
+print("EIgen values of M-1*A*M")
+print(M1AMev)
+print("A and M-1*A*M are similar matrices") \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.6.2/Ex6.6_2.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.6.2/Ex6.6_2.r
new file mode 100644
index 00000000..91ec2c0d
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.6.2/Ex6.6_2.r
@@ -0,0 +1,10 @@
+# Example : 2 Chapter : 6.6 Page No: 356
+# Similar matrices with repeated eigen values
+A<-matrix(c(0,0,1,0),ncol=2)
+Aev<-eigen(A)$values
+A1<-matrix(c(1,1,-1,-1),ncol=2)
+A1ev<-round(eigen(A1)$values)
+print("Both th egiven matrices are similar because their eigen values are same")
+print(Aev)
+print(A1ev)
+#The answer may slightly vary due to rounding off values
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.6.3/Ex6.6_3.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.6.3/Ex6.6_3.r
new file mode 100644
index 00000000..fb2496ae
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.6.3/Ex6.6_3.r
@@ -0,0 +1,9 @@
+# Example : 3 Chapter : 6.6 Page No: 357
+# Jordans theorem and Jordan Matrix
+J<-matrix(c(5,0,0,1,5,0,0,1,5),ncol=3)
+Jev<-eigen(J)$values
+JT<-t(J)
+JTev<-eigen(JT)$values
+print("Jordans theorem says that both J and transpose of J are similar")
+print(Jev)
+print(JTev) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.6.a/Ex6_6.6A.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.6.a/Ex6_6.6A.r
new file mode 100644
index 00000000..58eccd09
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.6.a/Ex6_6.6A.r
@@ -0,0 +1,9 @@
+# Example : 3 Chapter : 6.6 Page No: 357
+# Pascals matrix and its inverse are similar
+A<-matrix(c(1,1,1,1,0,1,2,3,0,0,1,3,0,0,0,1),ncol=4)
+A1<-solve(A)
+Aev<-eigen(A)$values
+A1ev<-eigen(A1)$values
+print("Both pascal matrix and its inverse have same eigen values")
+print(Aev)
+print(A1ev) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.7.3/Ex6.7_3.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.7.3/Ex6.7_3.r
new file mode 100644
index 00000000..b61c47aa
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.7.3/Ex6.7_3.r
@@ -0,0 +1,8 @@
+# Example : 3 Chapter : 6.7 Page No: 366
+# Singular Value decomposition
+
+A<-matrix(c(2,-1,2,1),ncol=2)
+print("Singular value decomposition is given by")
+print(svd(A))
+#The answer may slightly vary due to rounding off values
+#The answers provided in the text book may vary because of the computation method followed.
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.7.4/Ex6.7_4.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.7.4/Ex6.7_4.r
new file mode 100644
index 00000000..ecd3e15f
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.7.4/Ex6.7_4.r
@@ -0,0 +1,8 @@
+# Example : 3 Chapter : 6.7 Page No: 366
+# Singular Value decomposition
+
+A<-matrix(c(2,1,2,1),ncol=2)
+print("Singular value decomposition is given by")
+print(svd(A))
+#The answer may slightly vary due to rounding off values
+#The answers provided in the text book may vary because of the computation method followed.