functions for commonPoint and determinant