Constructing the matrix and calculating determinant
A <- matrix(c(1, 2, 1, 2, 0, 1, 2, 3, 7/4), nrow=3, byrow=T)
A
## [,1] [,2] [,3]
## [1,] 1 2 1.00
## [2,] 2 0 1.00
## [3,] 2 3 1.75
print(det(A))
## [1] 0
Trying to find inverse using solve
print(solve(A))
##Error: Lapack routine dgesv: system is exactly singular: U[3,3] = 0
Using Ginv from matlib to solve for generalized inverse
library('matlib')
Ainv<-Ginv(A)
Ainv
## [,1] [,2] [,3]
## [1,] 0 0.5000000 0.0000000
## [2,] 0 -0.3333333 0.3333333
## [3,] 0 0.0000000 0.0000000
Test AAinverseA to see if it returns the original matrix
test<-A%*%Ainv%*%A
test
However the generalised Moore-Penrose does not return an identity matrix when I multiply A*Ainverse
identity<-A%*%Ainv
identity
## [,1] [,2] [,3]
## [1,] 0 -0.16666666 0.6666667
## [2,] 0 1.00000000 0.0000000
## [3,] 0 0.00000001 1.0000000
For more on Ginv, visit https://cran.r-project.org/web/packages/matlib/vignettes/ginv.html