I have a function of $f(x_1, x_2)$, and two other functions of $g_1(x_1, x_2)$ and $g_2(x_1, x_2)$ in such a way that the original function can be written as $ f(g_1, g_2) $.

Now I need to fine partial derivative of $f$ with respect to $g_1$ or $g_2$ while keeping the other constant. That is

$$ \Big( \dfrac{\partial f}{\partial g_1} \Big)_{g_2 = const} $$


$$ \Big( \dfrac{\partial f}{\partial g_2} \Big)_{g_1 = const} $$

What is the correct formula to do this?

  • $\begingroup$ What are the domains and codomains of your functions? $\endgroup$ – user258700 Jan 3 '16 at 23:00
  • $\begingroup$ Don't really know. I am more of a structural engineer trying to sort out some form of equation for simulation... I think your question goes way beyond my scope... $\endgroup$ – Quang Thinh Ha Jan 3 '16 at 23:03
  • $\begingroup$ Not really. I am just asking where do $f$ and $g$ get their inputs from, and what do they output. For instance, is $f:\Bbb R^2 \to \Bbb R$? $\endgroup$ – user258700 Jan 3 '16 at 23:05
  • $\begingroup$ Ah I see. Yes they do. $\endgroup$ – Quang Thinh Ha Jan 3 '16 at 23:07

This is probably not the most rigorous or direct way of doing it, but it should explain what's going on:

By the chain rule, we can write $$ \begin{align} \mathrm{d}f &= f_x\ \mathrm{d}x + f_y\ \mathrm{d}y \\ \mathrm{d}g_1 &= g_{1x}\ \mathrm{d}x + g_{1y}\ \mathrm{d}y \\ \mathrm{d}g_2 &= g_{2x}\ \mathrm{d}x + g_{2y}\ \mathrm{d}y \\ \end{align} $$

Let us think about $(\partial f/\partial g_1)_{g_2}$. The condition $g_2 = \text{constant}$ means that we are confined to move along a contour of $g_2$, so let us first work out what those contours are, and then work out the rates of change of $f$ and $g_1$ if we move along such a contour.

Since $g_2 = \text{constant}$ along a contour, we must have $$ g_{2x}\ \mathrm{d}x + g_{2y}\ \mathrm{d}y = 0 $$ and so $$ \mathrm{d}y = - \frac{g_{2x}}{g_{2y}}\ \mathrm{d}x $$ on contours of $g_2$ (but see Note 1). The contours are therefore described by the differential equation $$ \frac{\mathrm{d}y}{\mathrm{d}x} = - \frac{g_{2x}}{g_{2y}}. $$

Now we have a relationship between $\mathrm{d}y$ and $\mathrm{d}x$. We shall substitute these into the expressions for $\mathrm{d}f$ and $\mathrm{d}g_1$ to work out the rates of change of $f$ and $g_1$ along the contours.

For $f$, we have $$ \mathrm{d}f = \left(f_x - \frac{g_{2x}}{g_{2y}} f_y \right)\ \mathrm{d}x $$ and a corresponding equation for $\mathrm{d}g_1$. Dividing the two (see Note 2) then gives the desired expression: $$ \left(\frac{\partial f}{\partial g_1}\right)_{g_2} = \frac{ f_x g_{2y} - f_y g_{2x} }{ g_{1x} g_{2y} - g_{1y} g_{2x} }, $$ or, in terms of 'Jacobian determinants': $$ \left(\frac{\partial f}{\partial g_1}\right)_{g_2} = \frac{ \partial(f,g_2)/\partial(x,y) }{ \partial(g_1,g_2)/\partial(x,y) }. $$


  1. If $g_{2y}=0$, then we can proceed instead by writing $\mathrm{d}x$ in terms of $\mathrm{d}y$ instead, and proceed accordingly to get the same result.

    If both $g_{2x}$ and $g_{2y}$ are zero at the same point, then $g_2$ is stationary there, and $(\partial f/\partial g_1)_{g_2}$ is not defined at that point.

  2. The partial derivative $(\partial f/\partial g_1)_{g_2}$ is undefined at points where $\partial(g_1,g_2)/\partial(x,y) = 0$. At such points, the gradients of $g_1$ and $g_2$ are not linearly dependent, which means that the contour of $g_2$ is also a contour of $g_1$; the rate of change of $g_1$ is therefore zero there.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.