Derivative of a product with respect to the multiplier and generalization Say I have a differentiable function
$$
f(x) = f(g(x),h(x)) = g(x)h(x)
$$
If I compute $df/dx$ I can apply the product rule, but what about
$$
\frac{df}{dg} = ?
$$
what can I do in this case?
The only attempt is this one
$$
\frac{df}{dg} = \frac{df}{dx} \frac{dx}{dg} = \left(g'(x)h(x) + g(x)h'(x) \right) \frac{dx}{dg}
$$
Is $dg/dx = \frac{1}{g'(x)}$? If it is true then
$$
\frac{df}{dg} = h(x) + g(x)\frac{h'(x)}{g'(x)}
$$
How can I generalize this to the generic
$$
f(x) = f(g(x),h(x))?
$$
Thank you.
 A: In your example, let's rewrite a little. You have two different things labelled "f", which is a problem. What's really going on is that there's a function $H$: 
$$
M(a, b) = a b
$$
and 
$$
f(x) = M(g(x), h(x)).
$$
Now applying the chain rule is comparatively obvious: the derivatives of $M$ with respect to its first and second arguments are easy to find:
$$
\frac{\partial M}{\partial a}(a, b) = b \\
\frac{\partial M}{\partial b}(a, b) = a.
$$
So 
\begin{align}
\frac{d f}{dx} 
&= \frac{\partial M}{\partial a}(g(x), h(x)) \frac{d g(x)}{d x} + \frac{\partial M}{\partial b}(g(x), h(x)) \frac{d h(x)}{d x} \tag{1}\\
&= h(x) \frac{d g(x)}{d x} + g(x) \frac{d h(x)}{d x} \\
&= h(x) g'(x) + g(x) h'(x)
\end{align}
As for the more general case, where the function $M$ is some arbitrary function rather than just multiplication, the formula for that case is what's shown in equation (1) above. 
General principle: never do what the physicists do all the time, writing things like 
$$
f(z)= f(x(z), y(z))
$$
where $f$ has two different meanings, until you're completely confident with using the chain rule as I've done above. At that point, it'll start to seem natural (but you'll still probably screw up sometimes). 
