title: “matrices” author: “Yadu” date: “July 22, 2015” output: html_document
Problem 1:
A <- matrix(c(1,2,-1, 2,1,1, -3,-3,0), ncol = 3, byrow = TRUE)
b <- matrix(c(5,13,-8), ncol = 1)
require('MASS')
## Loading required package: MASS
giA <- ginv(A)
x <- giA%*%b #computes the cross product of the inverse matrix and the column vector
x
## [,1]
## [1,] 3.2222222
## [2,] 0.5555556
## [3,] 2.6666667
Problem 2:
C <- matrix(c(4,-3,-3,5,0,1), ncol = 2, byrow = TRUE)
D <- matrix(c(1,3,4,-2), ncol = 2)
y <- C%*%D
y
## [,1] [,2]
## [1,] -5 22
## [2,] 12 -22
## [3,] 3 -2