Let M and M′ represent seats of the master and mistress respectively, and let a1,a2,a3,...,a2n represent the 2n seats.
Let the guests who must not be placed next to one another be called P and Q.
Now, put P are a1, and Q at any position, other than a2, say at a3; then remaining 2n−2 guests can be arranged in the remaining (2n−2) positions in (2n−2)! ways.
Hence there will be altogether (2n−2)(2n−2)! arrangements of the guests when P is at a1.
The same number of arrangement when P is at an or an+1 or a2n. Hence for these positions (a1,an,an+1,a2n) of P there are altogether
4(2n−2)(2n−2)! ways ....(1)
If P is at a2 there are altogether (2n−3) positions for Q, hence there will be altogether (2n−3)(2n−2)! arrangements of the guests when P is at a2.
The same number of arrangements can be made when P is at any other position excepting the four positions a1,an,an+1,a2n.
Hence for these (2n−4) positions of P there will be altogether
(2n−4)(2n−3)(2n−2)! arrangements of the guests ....(2)
Hence from (1) and (2), the total no. of ways of arranging the guests
=4(2n−2)(2n−2)!+(2n−4)(2n−3)(2n−2)!
=(4n2−6n+4)(2n−2)!