Miss Honey and Miss Wormwood were taking their classes out on an outing. The two classes were of different sizes, but in each class there were the same number of girls as boys.

Miss Honey told the children in her class to form pairs, each consisting of a boy and a girl. For her own amusement, mentally calculated the number of different ways this could be done.

Miss Wormwood also told her class to form into pairs, but with at least one single-sex pair. She also insisted that the girls Matilda and Susie did not pair up together as they were the most troublesome of her girls. She too calculated the number of different ways that this could be done.

Both teachers arrived at the same answer. How many children were in each class?

For class sizes of n kids (n is even because same number of boys and girls), there will be

(n/2)! mixed sex pairs (Miss Honey's class)

If you want all possible pairs the answer is (here's where a better formula would help)

(n-1)(n-3)...(3)(1)

But Miss Wormwood doesn't want Matilda and Susie together, so from the above number we need to subract the solutions that would pair those two. Just solve the above equation for n-2.

(n-3)...(3)(1)

Additionally, we must have at least one same sex pair so we must eliminate the solutions where all pairs are mixed. This is just the solution for Miss Honey's class.

So Miss Wormwood's class will have (with some simplification)

(n-2)(n-3)(n-5)...(3)(1) - (n/2)!

pairs versus Miss Honey's (n/2)! pairs.

It turns out that the class size could be only 6 kids, but then both classes would be the same size. Another solution is Miss H with 12 kids and Miss W with 10 kids, both having 720 different pair solutions.

*Edited on ***September 22, 2005, 6:59 pm**