This functions finds the determinant of Matrix
static double determinantOfMatrix ( double [ , ] mat ) { double ans ; ans = mat [ 0 , 0 ] * ( mat [ 1 , 1 ] * mat [ 2 , 2 ] - mat [ 2 , 1 ] * mat [ 1 , 2 ] ) - mat [ 0 , 1 ] * ( mat [ 1 , 0 ] * mat [ 2 , 2 ] - mat [ 1 , 2 ] * mat [ 2 , 0 ] ) + mat [ 0 , 2 ] * ( mat [ 1 , 0 ] * mat [ 2 , 1 ] - mat [ 1 , 1 ] * mat [ 2 , 0 ] ) ; return ans ; }