2021.09.17 MATH 3110 Elementary Matrices

64 days ago by calkin

We will define some functions to create elementary matrices to do row reduction.

Eswap(n,i,j0 creates an $n\times n$ matrix to swap rows $i$ and $j$

Escale(n,i,c) creates a matrix to multiply row $i$ by $c$

Esub(n,i,j,c) subtracts $c*$Row $i$ from Row $j$

def Eswap(n,i,j): In=matrix.identity(n) In[i-1,i-1]=0 In[j-1,j-1]=0 In[i-1,j-1]=1 In[j-1,i-1]=1 return(In) def Escale(n,i,c): In=matrix.identity(n) In[i-1,i-1]*=c return(In) def Esub(n,i,j,c): In=matrix.identity(n) In[j-1,i-1]=-c return(In) 
       
Esub(5,1,3,7) 
       
[ 1  0  0  0  0]
[ 0  1  0  0  0]
[-7  0  1  0  0]
[ 0  0  0  1  0]
[ 0  0  0  0  1]
[ 1  0  0  0  0]
[ 0  1  0  0  0]
[-7  0  1  0  0]
[ 0  0  0  1  0]
[ 0  0  0  0  1]
A=matrix(3,6,[2,-2,-6,1,-1,3,-1,1,3,-1,2,-3,1,-2,-1,1,1,2]) 
       
show(A) 
       
B=Eswap(3,1,3)*A show(B) 
       
B=Esub(3,1,2,-1)*B show(B) 
       
B=Esub(3,1,3,2)*B show(B) 
       
B=Escale(3,2,-1)*B show(B) 
       
B=Esub(3,2,3,2)*B show(B) 
       
B=Escale(3,3,-1)*B show(B) 
       
B=Esub(3,3,1,1)*B show(B) 
       
B=Esub(3,2,1,-2)*B show(B) 
       
show(A.rref()) 
       
 
       

The following is the matrix to row reduce in Exam 1.

C= matrix(5,8,[3, 6, 3, 8, 24, 24, 88, 70, \ -2, -4, -2, -3, -9, -12, -39, -31,\ -1, -2, -1, 1, 3, 0, 5, 4, \ 1, 2, 1, 2, 6, 7, 24, 19, \ 2, 4, 2, 5, 15, 15, 55, 45 ]) 
       
show(C) 
       
A=matrix(3,3,[8,26,5,59,7,0,2,4,-3]) 
       
A.rref() 
       
[1 0 0]
[0 1 0]
[0 0 1]
[1 0 0]
[0 1 0]
[0 0 1]
B=matrix(3,6,[8,26,5,1,0,0, 59,7,0,0,1,0, 2,4,-3,0,0,1]) 
       
show(A,B) 
       
B.rref() 
       
[        1         0         0    -1/264     7/396    -5/792]
[        0         1         0   59/1848  -17/2772  295/5544]
[        0         0         1    37/924    5/1386 -739/2772]
[        1         0         0    -1/264     7/396    -5/792]
[        0         1         0   59/1848  -17/2772  295/5544]
[        0         0         1    37/924    5/1386 -739/2772]
B=matrix(3,6,[8,-1,5,1,0,0, -1,7,0,0,1,0, 2,4,-3,0,0,1]) 
       
B.rref() 
       
[     1      0      0   7/85  -1/15   7/51]
[     0      1      0   1/85   2/15   1/51]
[     0      0      1   6/85   2/15 -11/51]
[     1      0      0   7/85  -1/15   7/51]
[     0      1      0   1/85   2/15   1/51]
[     0      0      1   6/85   2/15 -11/51]
show(B) 
       
B=matrix(3,6,[8,-1,7,1,0,0, -1,7,6,0,1,0, 2,4,6,0,0,1]) 
       
show(B) 
       
B.rref() 
       
[     1      0      1      0   -2/9   7/18]
[     0      1      1      0    1/9   1/18]
[     0      0      0      1   17/9 -55/18]
[     1      0      1      0   -2/9   7/18]
[     0      1      1      0    1/9   1/18]
[     0      0      0      1   17/9 -55/18]
B=matrix(3,6,[8,-1,5,1,0,0, -1,7,0,0,1,0, 7,6,5,0,0,1]) 
       
show(B) 
       
B.rref() 
       
[    1     0  7/11     0 -6/55  7/55]
[    0     1  1/11     0  7/55  1/55]
[    0     0     0     1     1    -1]
[    1     0  7/11     0 -6/55  7/55]
[    0     1  1/11     0  7/55  1/55]
[    0     0     0     1     1    -1]