You can only take a derivative of a continuous quantity. Since the sizes of the sets are either infinite or discrete, you run into trouble, that is, a derivative is out of the question. However, we'll cheat and assume that the sizes of the sets could be real numbers (non-negative). Maybe you can start with and and no . That is, you are looking for the change of with respect to . If you call the first one and the second one you are looking for something like

I wonder if you have any other constraints on the sets. If the sets are arbitrary finite sets you can think of the following. Let . Then you have

Now we have

We have

So now we have

Or you can even use the more symmetric

Writing this last one in your notation we have

This whole derivation assumes that the values are continuous but it should not be a problem to evaluate it at discrete values. Also, I actually think that there is no factor of 2 in the denominator.