Section 16 Matrix Groups

require(pracma)

16.1 The General Linear Group \(GL_n(\mathbb{R})\)

The general linear group \(GL_n(\mathbb{R})\) is the group of all invertible \(n \times n\) matrices with entries from the real numbers \(\mathbb{R}\). This is the world we lived in when we worked with square invertible matrices (and the invertible matrix theorem) in Math 236 Linear Algebra.

Remember that R has a funny matrix multiplication symbol: %*%. For example,

A = cbind(c(1,2,3),c(1,1,1),c(0,1,1))
B = cbind(c(-5,1,1),c(1,1,3),c(1,2,1))
A %*% B
##      [,1] [,2] [,3]
## [1,]   -4    2    3
## [2,]   -8    6    5
## [3,]  -13    7    6
B %*% A
##      [,1] [,2] [,3]
## [1,]    0   -3    2
## [2,]    9    4    3
## [3,]   10    5    4

illustrating that matrix multiplication is not-commutative and \(GL_n(\mathbb{R})\) is a nonabelian group.

The identity matrix is the identity element of the group, and it can be defined with diag(n). If you have pracma loaded then you can invert the matrix A with inv(A) otherwise, in base R, you can use solve(A).

inv(A)
##      [,1] [,2] [,3]
## [1,]    0   -1    1
## [2,]    1    1   -1
## [3,]   -1    2   -1
zapsmall(A %*% inv(A))
##      [,1] [,2] [,3]
## [1,]    1    0    0
## [2,]    0    1    0
## [3,]    0    0    1
diag(3) %*% A
##      [,1] [,2] [,3]
## [1,]    1    1    0
## [2,]    2    1    1
## [3,]    3    1    1

16.2 Matrix Multiplication Mod m: \(GL_n(\mathbb{Z}_m)\)

You can use the mod command from pracma to do matrix multiplication mod m.

For example, notice how the product looks very different for different \(\mathbb{Z}_m\).

A = rbind(c(1,3),c(2,7))
B = rbind(c(5,4),c(-3,-2))
A %*% B
##      [,1] [,2]
## [1,]   -4   -2
## [2,]  -11   -6
mod(A %*% B,2)
##      [,1] [,2]
## [1,]    0    0
## [2,]    1    0
mod(A %*% B,3)
##      [,1] [,2]
## [1,]    2    1
## [2,]    1    0
mod(A %*% B,4)
##      [,1] [,2]
## [1,]    0    2
## [2,]    1    2