summaryrefslogtreecommitdiff
path: root/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2
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/CH2
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/CH2')
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.1.1/Ex2.1_1.r27
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.1.a/Ex2_2.1a.r11
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.2.a/Ex2_2.2a.r14
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.3.1/Ex2.3_1.r12
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.3.2/Ex2.3_2.r9
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.3.b/Ex2_2.3b.r18
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.3.c/Ex2_2.3C.R18
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.1/Ex2.4_1.R6
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.2/Ex2.4_2.R6
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.a/Ex2_2.4A.R8
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.b/Ex2_2.4B.R9
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.c/Ex2_2.4C.R6
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.2/Ex2.5_2.r6
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.3/Ex2.5_3.r14
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.4/Ex2.5_4.r16
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.5/Ex2.5_5.r16
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.a/Ex2_2.5A.r6
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.b/Ex2_2.5B.r12
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.c/Ex2_2.5C.r16
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.1/Ex2.6_1.r13
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.2/Ex2.6_2.r13
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.3/Ex2.6_3.r19
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.a/Ex2_2.6A.r12
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.b/Ex2_2.6B.r17
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.7.1/Ex2.7_1.r12
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.7.4/Ex2.7_4.r8
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.7.a/Ex2_2.7A.r11
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.7.b/Ex2_2.7B.r25
28 files changed, 360 insertions, 0 deletions
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.1.1/Ex2.1_1.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.1.1/Ex2.1_1.r
new file mode 100644
index 00000000..9afb84ce
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.1.1/Ex2.1_1.r
@@ -0,0 +1,27 @@
+#Example : 1 Chapter : 2.1 Pageno : 37
+#Multiplication by rows and cols dotproduct.
+multiply<-function(A,x){
+ b<-c()
+ for(i in 1:3){
+ b<-c(b,sum(A[i,]*x[,1]))
+ }
+ b<-matrix(b,ncol=1)
+ print(paste("Multiplying matrices by dotproduct of rows and cols"))
+ print(A)
+ print("*")
+ print(x)
+ print("=")
+ print(b)
+}
+
+
+I<-matrix(c(1,0,0,0,1,0,0,0,1),ncol=3,byrow=T)
+x<-matrix(c(4,5,6),ncol=1)
+A=matrix(c(1,1,1,0,0,0,0,0,0),ncol=3)
+multiply(A,x)
+A<-matrix(c(1,0,0,0,1,0,0,0,1),nrow=3,ncol=3,byrow=T)
+multiply(A,x)
+
+
+
+
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.1.a/Ex2_2.1a.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.1.a/Ex2_2.1a.r
new file mode 100644
index 00000000..6d8a1e7c
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.1.a/Ex2_2.1a.r
@@ -0,0 +1,11 @@
+# Example : 2.1A Chapter : 2.1 Pageno : 39
+#Solving the equations by Column picture
+#Column Picture : solution is the linear combination of columns of A that makes b
+A=matrix(c(1,2,3,3,2,5,2,2,6),ncol=3)
+b=c(-3,-2,-5)
+x<-solve(A,b)
+x
+#if b=(4,4,8)
+b=c(4,4,8)
+x<-solve(A,b)
+x \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.2.a/Ex2_2.2a.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.2.a/Ex2_2.2a.r
new file mode 100644
index 00000000..f543583e
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.2.a/Ex2_2.2a.r
@@ -0,0 +1,14 @@
+#Example : 2.2A Chapter : 2.2 page no : 50
+#Pivots and Multipliers in converting matrix to upper traingular system
+matrix(c(1,-1,0,-1,2,-1,0,-1,2),ncol=3)->A
+A
+print(paste("First pivot is",A[1,1]))
+l21<-A[2,1]/A[1,1]
+print(paste("Multiplier L21 to convert the second row first element to 0 is",l21))
+A[2,]<-A[2,]-l21*A[1,]
+A
+print(paste("The second pivot is ",A[2,2]))
+l32<-A[3,2]/A[2,2]
+A[3,]<-A[3,]-l32*A[2,]
+print("The equivalent Upper traingular system for the matrix A is ")
+A \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.3.1/Ex2.3_1.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.3.1/Ex2.3_1.r
new file mode 100644
index 00000000..7dcd7475
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.3.1/Ex2.3_1.r
@@ -0,0 +1,12 @@
+# Example : 1 Chapter : 2.3 page no : 57
+#Matrix multiplication as dotproduct of row and column
+A<-matrix(c(3,4,5,6),nrow=2,ncol=2,byrow=T)
+x<-c(2,1)
+B<-A%*%x
+B
+Ax<-c()
+for(i in 1:2){
+ Ax<-c(Ax,sum(A[i,]*x))
+}
+Ax<-matrix(Ax,ncol=1)
+Ax \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.3.2/Ex2.3_2.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.3.2/Ex2.3_2.r
new file mode 100644
index 00000000..21725a98
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.3.2/Ex2.3_2.r
@@ -0,0 +1,9 @@
+#Example : 2 Chapter : 2.3 pageno : 58
+#Purpose of Elimination matrices
+I<-matrix(c(1,0,0,0,1,0,0,0,1),ncol=3)
+E31<-matrix(c(1,0,-4,0,1,0,0,0,1),ncol=3)
+b<-matrix(c(1,3,9),ncol=1)
+Ib<-I%*%b
+print(Ib)
+Eb<-E31%*%b
+print(Eb)
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.3.b/Ex2_2.3b.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.3.b/Ex2_2.3b.r
new file mode 100644
index 00000000..6dc8d2ee
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.3.b/Ex2_2.3b.r
@@ -0,0 +1,18 @@
+#Example : 2.3b Chapter : 2.3 Pageno : 61
+#Multiplication with Elimination and Permutation matricies
+Ab<-matrix(c(1,4,0,2,8,3,2,9,2,1,3,1),ncol=4)
+E21<-matrix(c(1,0,0,-4,1,0,0,0,1),ncol=3,byrow=T)
+P32<-matrix(c(1,0,0,0,0,1,0,1,0),ncol=3,byrow=T)
+E21Ab<-E21%*%Ab
+print(E21Ab)
+P32E21Ab<-P32%*%E21Ab
+print(P32E21Ab)
+P32E21<-P32%*%E21
+print(P32E21)
+P32E21Ab<-P32E21%*%Ab
+print(P32E21Ab)
+#Solution for this system is
+b<-P32E21Ab[,4]
+P32E21Ab<-P32E21Ab[,-4]
+x<-solve(P32E21Ab,b)
+print(x) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.3.c/Ex2_2.3C.R b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.3.c/Ex2_2.3C.R
new file mode 100644
index 00000000..2531ce7f
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.3.c/Ex2_2.3C.R
@@ -0,0 +1,18 @@
+# Example : 2.3C Chapter : 2.3 Pageno : 62
+# Multiplying Matrices in two different ways
+A<-matrix(c(3,1,2,4,5,0),ncol=2)
+B<-matrix(c(2,1,4,1),ncol=2)
+AB<-A%*%B
+print(AB)
+#Multiplying matrices A and B as Rows of A times columns of B as dot product
+for(r in 1:dim(A)[1]){
+ for(c in 1:dim(B)[2]){
+ AB[r,c]<-sum(A[r,]*B[,c])
+ }
+}
+print(AB)
+#Multiplying Matrices A and B as Columns of A times rows of B
+AB1<-matrix(A[,1],ncol=1)%*%matrix(B[1,],nrow=1)
+AB2<-matrix(A[,2],ncol=1)%*%matrix(B[2,],nrow=1)
+AB<-AB1+AB2
+print(AB) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.1/Ex2.4_1.R b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.1/Ex2.4_1.R
new file mode 100644
index 00000000..b615e378
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.1/Ex2.4_1.R
@@ -0,0 +1,6 @@
+# Example : 1 Chapter : 2.4 Pageno : 68
+#Multiplication of Square matrices
+A<-matrix(c(1,2,1,-1),ncol=2)
+B<-matrix(c(2,3,2,4),ncol=2)
+AB<-A%*%B
+print(AB) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.2/Ex2.4_2.R b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.2/Ex2.4_2.R
new file mode 100644
index 00000000..358e1d56
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.2/Ex2.4_2.R
@@ -0,0 +1,6 @@
+#Example : 2 Chapter : 2.4 Page no : 68
+#Column times Row
+A<-matrix(c(0,1,2),ncol=1)
+B<-matrix(c(1,2,3),nrow=1)
+AB<-A%*%B
+print(AB) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.a/Ex2_2.4A.R b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.a/Ex2_2.4A.R
new file mode 100644
index 00000000..aedb5d7f
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.a/Ex2_2.4A.R
@@ -0,0 +1,8 @@
+#Example : 2.4A Chapter : 2.4 Page no : 72
+#Square of Pascal Matrix is HyperCube Matrix
+L<-matrix(c(1,1,1,1,0,1,2,3,0,0,1,3,0,0,0,1),ncol=4)
+H<-L%*%L
+print("Square of Pascal Matrices is:")
+print(H)
+H1<-H%*%matrix(c(1,1,1,1),ncol=1)
+print(H1) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.b/Ex2_2.4B.R b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.b/Ex2_2.4B.R
new file mode 100644
index 00000000..1c497162
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.b/Ex2_2.4B.R
@@ -0,0 +1,9 @@
+#Example : 2.4B Chapter:2.4 Pageno : 74
+
+B<-matrix(c(1,0,1,1),ncol=2)
+C<-matrix(c(0,0,1,0),ncol=2)
+BC<-B%*%C
+CB<-C%*%B
+print(BC)
+print(CB)
+print("Commutative property does not hold for matrix multiplication but by chance here it happened BC=CB") \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.c/Ex2_2.4C.R b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.c/Ex2_2.4C.R
new file mode 100644
index 00000000..1e656640
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.4.c/Ex2_2.4C.R
@@ -0,0 +1,6 @@
+#Example : 2.4C Chapter : 2.4 Pageno : 74
+#3-step paths for the given directed graph
+A<-matrix(c(1,1,1,0),ncol=2)
+A3<-A%*%A%*%A
+print("3 step paths between each pair of nodes in the given directed graph is :")
+print(A3) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.2/Ex2.5_2.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.2/Ex2.5_2.r
new file mode 100644
index 00000000..672d518b
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.2/Ex2.5_2.r
@@ -0,0 +1,6 @@
+# Example : 2 Chapter : 2.5 Pageno : 82
+# Inverse of an Elimination Matrix
+E<-matrix(c(1,-5,0,0,1,0,0,0,1),ncol=3)
+E1<-solve(E)
+print("The inverse of the given elimination matrix is")
+print(E1) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.3/Ex2.5_3.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.3/Ex2.5_3.r
new file mode 100644
index 00000000..905de16e
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.3/Ex2.5_3.r
@@ -0,0 +1,14 @@
+# Example : 3 Chapter : 2.5 Pageno : 83
+# Inverse of product of matrices
+E<-matrix(c(1,-5,0,0,1,0,0,0,1),ncol=3)
+E1<-solve(E)
+F<-matrix(c(1,0,0,0,1,-4,0,0,1),ncol=3)
+F1<-solve(F)
+print(F1)
+FE<-F%*%E
+print(FE)
+print("Inverse of FE ")
+FE1<-solve(FE)
+print(FE1)
+print("Inverse of FE can also be E-1*F-1 ")
+print(E1%*%F1)
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.4/Ex2.5_4.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.4/Ex2.5_4.r
new file mode 100644
index 00000000..bc1c40ee
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.4/Ex2.5_4.r
@@ -0,0 +1,16 @@
+# 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 : 2.5 Pageno : 85
+# Inverse of matrix by guass jordan elimination matrix
+library(pracma)
+A<-matrix(c(2,4,3,7),ncol=2)
+I<-eye(2)
+AI<-cbind(A,I)
+R<-rref(AI)
+X<-R[,c(3:4)]
+print("Inverse of A is")
+print(X) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.5/Ex2.5_5.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.5/Ex2.5_5.r
new file mode 100644
index 00000000..96705fcb
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.5/Ex2.5_5.r
@@ -0,0 +1,16 @@
+# 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 : 5 Chapter : 2.5 Pageno : 86
+# Inverse of Lower traingular matrix is also a lower traingular matrix
+library(pracma)
+L<-matrix(c(1,3,4,0,1,5,0,0,1),ncol=3)
+I<-eye(3)
+LI<-cbind(L,I)
+R<-rref(LI)
+L1<-R[,c(4:6)]
+print("Inverse of L is")
+print(L1) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.a/Ex2_2.5A.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.a/Ex2_2.5A.r
new file mode 100644
index 00000000..73cd5729
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.a/Ex2_2.5A.r
@@ -0,0 +1,6 @@
+# Example : 2.5A Chapter : 2.5 Pageno : 87
+# Inverse of difference matrix is Sum matrix
+A<-matrix(c(1,-1,0,0,1,-1,0,0,1),ncol=3)
+A1<-solve(A)
+print("Inverse of the difference matrix is singular ")
+print(A1)
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.b/Ex2_2.5B.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.b/Ex2_2.5B.r
new file mode 100644
index 00000000..2266f6ca
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.b/Ex2_2.5B.r
@@ -0,0 +1,12 @@
+# Example : 2.5B Chapter : 2.5 Pageno : 88
+# Inverse of the given matrices
+B<-matrix(c(4,8,3,7),ncol=2)
+C<-matrix(c(6,6,6,0),ncol=2)
+S<-matrix(c(1,1,1,0,1,1,0,0,1),ncol=3)
+B1<-solve(B)
+C1<-solve(C)
+S1<-solve(S)
+print("Inverses of given matrices ")
+print(B1)
+print(C1)
+print(S1) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.c/Ex2_2.5C.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.c/Ex2_2.5C.r
new file mode 100644
index 00000000..8c89a3cf
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.5.c/Ex2_2.5C.r
@@ -0,0 +1,16 @@
+# 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 : 2.5C Chapter : 2.5 Pageno : 88
+# Inverse of the Pascal matrix by gauss jordan elimination method
+library(pracma)
+L<-matrix(c(1,1,1,1,0,1,2,3,0,0,1,3,0,0,0,1),ncol=4)
+I<-eye(4)
+LI<-cbind(L,I)
+IL1<-rref(LI)
+L1<-IL1[,c(5:8)]
+print("Inverse of given Pascal matrix is")
+print(L1) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.1/Ex2.6_1.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.1/Ex2.6_1.r
new file mode 100644
index 00000000..7b249bb5
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.1/Ex2.6_1.r
@@ -0,0 +1,13 @@
+# 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 : 2.6 Pageno : 96
+# LU Factorisation
+library(pracma)
+A<-matrix(c(2,1,0,1,2,1,0,1,2),ncol=3)
+print("LU factorisation of A is")
+print(lu(A))
+# The answers may vary due to rounding off values \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.2/Ex2.6_2.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.2/Ex2.6_2.r
new file mode 100644
index 00000000..a7ed2f09
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.2/Ex2.6_2.r
@@ -0,0 +1,13 @@
+# 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 : 2 Chapter : 2.6 Pageno : 96
+# LU Factorisation
+library(pracma)
+A<-matrix(c(1,1,0,0,1,2,1,0,0,1,2,1,0,0,1,2),ncol=4)
+print("LU factorisation of A is")
+print(lu(A))
+# The answers may vary due to rounding off values \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.3/Ex2.6_3.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.3/Ex2.6_3.r
new file mode 100644
index 00000000..5cfa3b38
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.3/Ex2.6_3.r
@@ -0,0 +1,19 @@
+# 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 : 3 Chapter : 2.6 Pageno : 98
+# Forward Elimination
+library(pracma)
+A<-matrix(c(1,4,2,9),ncol=2)
+b<-c(5,21)
+L<-lu(A)$L
+U<-lu(A)$U
+c<-solve(L,b)
+x<-solve(U,c)
+print("The solution is ")
+print(x)
+
+# The answers may vary due to rounding off values \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.a/Ex2_2.6A.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.a/Ex2_2.6A.r
new file mode 100644
index 00000000..483a0914
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.a/Ex2_2.6A.r
@@ -0,0 +1,12 @@
+# 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 : 2.6A Chapter : 2.6 Pageno : 101
+# LU factorisation
+library(pracma)
+P<-matrix(c(1,1,1,1,1,2,3,4,1,3,6,10,1,4,10,20),ncol=4)
+print("LU factorisation of P")
+print(lu(P)) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.b/Ex2_2.6B.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.b/Ex2_2.6B.r
new file mode 100644
index 00000000..928e8b65
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.6.b/Ex2_2.6B.r
@@ -0,0 +1,17 @@
+# 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 : 2.6B Chapter : 2.6 Pageno : 102
+# Forward Elimination
+library(pracma)
+P<-matrix(c(1,1,1,1,1,2,3,4,1,3,6,10,1,4,10,20),ncol=4)
+b<-c(1,0,0,0)
+L<-lu(P)$L
+U<-lu(P)$U
+c<-solve(L,b)
+x<-solve(U,c)
+print("The solution is ")
+print(x) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.7.1/Ex2.7_1.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.7.1/Ex2.7_1.r
new file mode 100644
index 00000000..025c7589
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.7.1/Ex2.7_1.r
@@ -0,0 +1,12 @@
+# Example : 1 Chapter : 2.7 Pageno : 108
+# Inverses and Transposes
+A<-matrix(c(1,6,0,1),ncol=2)
+AT<-t(A)
+A1<-solve(A)
+print("The inverse and transpose of the matrix are ")
+print(A1)
+print(AT)
+print("Transpose of A-1 is ")
+print(t(A1))
+print("Invere of A transpose is")
+print(solve(AT)) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.7.4/Ex2.7_4.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.7.4/Ex2.7_4.r
new file mode 100644
index 00000000..f02ef37a
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.7.4/Ex2.7_4.r
@@ -0,0 +1,8 @@
+# Example : 4 Chapter : 2.7 Pageno : 110
+# Product of matrix and its trnspose gives symmetric matrix
+R<-matrix(c(-1,0,1,-1,0,1),ncol=3)
+RT<-t(R)
+print("R * t(R)")
+print(R%*%RT)
+print("t(R) * R")
+print(RT%*%R) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.7.a/Ex2_2.7A.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.7.a/Ex2_2.7A.r
new file mode 100644
index 00000000..34dc004b
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.7.a/Ex2_2.7A.r
@@ -0,0 +1,11 @@
+# Example : 2.7A Chapter : 2.7 Pageno : 114
+# Multiplication by Permutation matrices
+P<-matrix(c(0,0,1,1,0,0,0,1,0),ncol=3)
+A<-matrix(c(1,4,5,4,2,6,5,6,3),ncol=3)
+Q<-t(P)
+PA<-P%*%A
+PAQ<-PA%*%Q
+print("P*A")
+print(PA)
+print("P*A*Q")
+print(PAQ) \ No newline at end of file
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.7.b/Ex2_2.7B.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.7.b/Ex2_2.7B.r
new file mode 100644
index 00000000..a8c7033f
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH2/EX2.7.b/Ex2_2.7B.r
@@ -0,0 +1,25 @@
+# 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 : 2.7B Chapter : 2.7 Pageno : 115
+# Symmetric Factorisation
+library(pracma)
+A<-matrix(c(1,4,5,4,2,6,5,6,3),ncol=3)
+L<-lu(A)$L
+D<-lu(A)$U
+for(i in 1:3){
+ j<-i+1
+ while(j<=3){
+ D[i,j]<-0
+ j<-j+1
+ }
+}
+LT<-t(L)
+print("Symmetric factorisation of A=LDLT")
+print(L)
+print(D)
+print(LT)
+print(L%*%D%*%LT) \ No newline at end of file