How do you take the derivative of a function like this: $f(g(x),h(x))$? I have a function $f(x,y)$ of two variables. I also have the relationship $x = a + by$.
So, I can also write the function as $f(a+by, y)$. 
I want to maximize this function in $y$. So I need to take the derivative and set it equal to zero, so that I can get my first-order condition. 
But I am unsure how to do it in this case? Is there a general term for the derivative of $f(a + by, y)$ with respect to $y$?

If above does not have a general answer, does it help that $f(x,y)$ is additive, i.e. $f(x,y) = g(x) + h(y)$?
 A: In the general case you should treat $f(g,h)$ as a function of two variables $g$ and $h$, then:
$$\frac{d}{dx} f(g(x),h(x))=\frac{\partial f(g,h)}{\partial g} \frac{d g(x)}{dx}+\frac{\partial f(g,h)}{\partial h} \frac{d h(x)}{dx}$$
Partial derivative obeys all the same rules as the ordinary one, but you should treat the rest of the variables as constants.
If you are unfamiliar with partial derivatives, here's an example:
$$f(g,h)=gh$$
$$\frac{\partial f(g,h)}{\partial g}=h$$
$$\frac{\partial f(g,h)}{\partial h}=g$$
And you recover the derivative of a product formula:
$$\frac{d}{dx} g(x) h(x)=h \frac{dg}{dx}+g \frac{dh}{dx}$$
A: There's a general answer, but in your specific case
$$
\frac{\mathrm{d}}{\mathrm{d}y} f(a + by,y) = \frac{\mathrm{d}}{\mathrm{d}y}g(a + by) + \frac{\mathrm{d}}{\mathrm{d}y} h(y) = bg'(a + by) + h'(y)
$$
suffices.
Edit: in general, although this is a little harder to explain, we have, writing $f_x = \frac{\mathrm{d}}{\mathrm{d}x}f(x,y)$ and $f_y = \frac{\mathrm{d}}{\mathrm{d}y}f(x,y)$, that
$$
\frac{\mathrm{d}}{\mathrm{d}y}f(a + by,y) = bf_x(a+by,y) + f_y(a+by,y).
$$
Note that it reduces to the specific case when $f$ is of the form $f(x,y) = g(x) + h(y)$.
A: By chain rule
$$f(a+by, y)=g(a+by)+h(y) \implies f'=b\cdot g'(a+by)+h'(y)$$
