Add function for calculating 3x3 matrix determinant