Relations between two reciprocal partial derivatives?

My question is similar to How to get the partial derivative of the inverse functions? But they are different.

If we have a function $$z=z(x,y)$$, we can calculate the partial derivative $$\left.\frac{\partial^2z}{\partial x^2}\right|_y$$. We can solve the original equation to obtain $$x=x(z,y)$$, and now we can also calculate the derivative $$\left.\frac{\partial^2x}{\partial z^2}\right|_y$$.

I can directly calculate the relation between the two derivatives by hand. The result is $$\left.\frac{\partial^2z}{\partial x^2}\right|_y=-\left(\left.\frac{\partial x}{\partial z}\right|_y\right)^{-3}\cdot\left.\frac{\partial^2x}{\partial z^2}\right|_y.$$

What about higher-order derivatives? I think this is not a difficult job in MMA, but I cannot catch the point.

Here's another approach where I give Derivative a definition so that rules are not needed (it happens automatically). I'll use Michael's starting point:

eqn = x == f[z[x, y], y]


x == f[z[x, y], y]

and differentiate with respect to x:

deqn = D[eqn, x];
deqn //InputForm


1 == Derivative[1, 0][f][z[x, y], y]*Derivative[1, 0][z][x, y]

Solving for Derivative[1, 0][z][x, y] (which is $$\left. \frac{\partial z}{\partial x} \right|_y$$ in your notation):

Derivative[1, 0][z][x, y] == 1 / Derivative[1, 0][f][z[x, y], y]


Let's turn this into a definition for Derivative:

Derivative[1, 0][z][x_, y_] = 1 / Derivative[1, 0][f][z[x, y], y];
Derivative[n_Integer?Positive, 0][z][x_, y_] := D[Derivative[1, 0][z][x, y], {x, n-1}]


Your first result can be obtained with:

Derivative[2, 0][z][x, y] //TeXForm


$$-\frac{f^{(2,0)}(z(x,y),y)}{f^{(1,0)}(z(x,y),y)^3}$$

or:

D[z[x, y], {x, 2}] //TeXForm


$$-\frac{f^{(2,0)}(z(x,y),y)}{f^{(1,0)}(z(x,y),y)^3}$$

Here's a table showing agreement with Michael's results:

Grid[
Table[
{Derivative[n, 0][Inactive@z][x, y], Derivative[n, 0][z][x, y]},
{n, 4}
],
Dividers -> All
] //TeXForm


$$\begin{array}{|c|c|} \hline z^{(1,0)}(x,y) & \frac{1}{f^{(1,0)}(z(x,y),y)} \\ \hline z^{(2,0)}(x,y) & -\frac{f^{(2,0)}(z(x,y),y)}{f^{(1,0)}(z(x,y),y)^3} \\ \hline z^{(3,0)}(x,y) & \frac{3 f^{(2,0)}(z(x,y),y)^2}{f^{(1,0)}(z(x,y),y)^5}-\frac{f^{(3,0)}(z(x,y),y)}{f^{(1,0)}(z(x,y),y )^4} \\ \hline z^{(4,0)}(x,y) & -\frac{15 f^{(2,0)}(z(x,y),y)^3}{f^{(1,0)}(z(x,y),y)^7}+\frac{10 f^{(3,0)}(z(x,y),y) f^{(2,0)}(z(x,y),y)}{f^{(1,0)}(z(x,y),y)^6}-\frac{f^{(4,0)}(z(x,y),y)}{f^{(1,0)}(z(x,y),y)^ 5} \\ \hline \end{array}$$

• Thank you! your method is suitable for me. Commented Apr 14, 2019 at 12:37

This iterative method will give substitution rules up to the order equal to the maxorder. It's not a good idea to use x for both a variable and a function name, so I called it f. (For instance, if you want to replace the variable x by a number, Mathematica is also very likely to replace the x in the function x[z, y] by the number, which makes no sense. However the code below produces the right formula, if you use x[z[x, y], y] instead of f[z[x, y], y].)

iter[{eq_, dz_, derivrules_}] := {#, #2, Join[derivrules, First@Solve[##]]} &[
D[eq, x] /. derivrules, D[dz, x]];
maxorder = 4;
drules = Last@Nest[iter, {x == f[z[x, y], y], z[x, y], {}}, maxorder];

Column[drules, Dividers -> All]


D[z[x, y], {x, 3}] /. drules


• Thanks, @Michael E2! Your method works well. Because I am not an expert in MMA, I think Woll's method is more understandable. I will choose Woll's answer as the solution. Commented Apr 14, 2019 at 12:35
• @Mark_Phys You're welcome. Carl's method is more elegant (I think), especially since it automatically figures out the derivative whatever the order. I might not use it myself as it is, because it effectively hard codes the derivatives of z in terms of f for the kernel session. (On a given day, I might have several projects, something I'm developing, say, plus testing my code and other little things for courses I teach and so forth. The lurking definitions of Derivative might cause problems unexpectedly.) It can be fixed, but the simpler approach will probably work fine for you Commented Apr 14, 2019 at 14:09