cofactor expansion