The relaxed ménage problem asks for the number of $m_n$ ways of seating couples around a circular table, so that no one sits next to his or her partner. This is nearly the same as the ménage problem, only now we have relaxed the requirement that men and women alternate.
To determine $m_n$ , we begin with the set $S$ of all $\left(2n\right)!$ ways of seating the individuals around the table, and use inclusion-exclusion on the set of couples who end up sitting together. Let us call the elements of $S$ seatings, and let us denote by $w_k$ the number of seatings under which some specified set of $k$ couples (and possibly some other couples) end up sitting together. Clearly $w_k$, does not depend on the particular set of $k$ couples we choose, and so, by the principle of inclusion and exclusion, we have:
I don't know how the principle of inclusion and exclusion has been used here,so can someone please derive the formula and explain where does it come from?