Solution 1
library(matlib)
## Warning: package 'matlib' was built under R version 3.5.1
Create the equation:
A <- matrix(c(1, 3, 5,
1, 2,4,
1,0,1), 3, 3, byrow=TRUE)
A
## [,1] [,2] [,3]
## [1,] 1 3 5
## [2,] 1 2 4
## [3,] 1 0 1
A_T <- t(A)
A_T
## [,1] [,2] [,3]
## [1,] 1 1 1
## [2,] 3 2 0
## [3,] 5 4 1
A1 <- t(A)%*%A
A1
## [,1] [,2] [,3]
## [1,] 3 5 10
## [2,] 5 13 23
## [3,] 10 23 42
A2 <- A%*%t(A)
A2
## [,1] [,2] [,3]
## [1,] 35 27 6
## [2,] 27 21 5
## [3,] 6 5 2
Solution 2:
A <- matrix(c(1, 0, 0,
0, 1,0,
0,0,1), 3, 3, byrow=TRUE)
A
## [,1] [,2] [,3]
## [1,] 1 0 0
## [2,] 0 1 0
## [3,] 0 0 1
A_T <- t(A)
A_T
## [,1] [,2] [,3]
## [1,] 1 0 0
## [2,] 0 1 0
## [3,] 0 0 1
A1 <- t(A)%*%A
A1
## [,1] [,2] [,3]
## [1,] 1 0 0
## [2,] 0 1 0
## [3,] 0 0 1
A2 <- A%*%t(A)
A2
## [,1] [,2] [,3]
## [1,] 1 0 0
## [2,] 0 1 0
## [3,] 0 0 1