# Derivative of a function wrt to another function

• Aug 21st 2012, 12:23 AM
albox
Derivative of a function wrt to another function
I have 3 sets called A,B and C. Each set is a union of 2 non intersecting subsets, i.e. :
$\displaystyle A = \{A1 \cup A2\}, A1 \cap A2 = \emptyset$
$\displaystyle B = \{B1 \cup B2\}, B1 \cap B2 = \emptyset$
$\displaystyle C = \{C1 \cup C2\}, C1 \cap C2 = \emptyset$

I'm interested in knowing what happens to the quantity
|A| / (|A| + |B| + |C|)

when I change :
|A2| / (|A2| + |B2| + |C2|)

One way might be to take the derivative of the first quantity with respect to the second quantity, although it doesn't seem to be an easy computation ? Is there another way ?
• Aug 21st 2012, 01:21 AM
Vlasev
Re: Derivative of a function wrt to another function
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 $\displaystyle A$ and $\displaystyle B$ and no $\displaystyle C$. That is, you are looking for the change of $\displaystyle |A|/(|A|+|B|)$ with respect to $\displaystyle |A_2|/(|A_2|+|B_2|)$. If you call the first one $\displaystyle f$ and the second one $\displaystyle g$ you are looking for something like

$\displaystyle \frac{df}{dg} = \frac{df/d|A_2|}{dg/d|A_2|} = \frac{df/d|B_2|}{dg/d|B_2|}$

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 $\displaystyle |A_1| = u, |A_2| = x, |B_1| = v, |B_2| = y$. Then you have

$\displaystyle f = \frac{u+x}{u+x+v+y},\quad g = \frac{x}{x+y}$

Now we have

$\displaystyle \frac{df}{dg} = \frac{df/dx}{dg/dx} = \frac{df/dy}{dg/dy}$

We have

$\displaystyle \frac{df}{dx} = \frac{v+y}{(u+v+x+y)^2}$
$\displaystyle \frac{df}{dy} = -\frac{u+x}{(u+v+x+y)^2}$
$\displaystyle \frac{dg}{dx} = \frac{y}{(x+y)^2}$
$\displaystyle \frac{dg}{dy} = - \frac{x}{(x+y)^2}$

So now we have

$\displaystyle \frac{df}{dg} = \frac{(v+y) (x+y)^2}{y (u+v+x+y)^2}$
$\displaystyle \frac{df}{dg} = \frac{(u+x) (x+y)^2}{x (u+v+x+y)^2}$

Or you can even use the more symmetric

$\displaystyle \frac{df}{dg} =\frac{1}{2}\left(\frac{(v+y) (x+y)^2}{y (u+v+x+y)^2}+\frac{(u+x) (x+y)^2}{x (u+v+x+y)^2}\right)$

$\displaystyle =\frac{(x+y)^2}{2(u+v+x+y)^2}\left(\frac{v+y}{y }+\frac{u+x}{x}\right)$

Writing this last one in your notation we have

$\displaystyle \frac{df}{dg} = \frac{(|A_2|+|B_2|)^2}{2(|A|+|B|)^2}\left(\frac{|A |}{|A_2|}+\frac{|B|}{|B_2|}\right)$

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.
• Aug 21st 2012, 10:42 PM
albox
Re: Derivative of a function wrt to another function
Thanks for helping. The sets are indeed discrete but it's probably fine to assume continuity for my application. I also don't have any other additional constraints on the sets.