Compute the determinant of square matrices of order 2 up to 8 using cofactor expansion along any selected row or column.