fixed matrix determinant and inversion