matrix operations and determinant