# Partial derivatives of an implicit equation

Looking for an easy way to find partial derivatives of an implicit equation. For example:

Find $\partial z/\partial x$ and $\partial z/\partial y$ if $z$ is defined implicitly as a function of $x$ and $y$ by the equation $$x^3+y^3+z^3+6xyz=1$$

Alternate Approach:

Clear[x, y, z];
eqn = x^3 + y^3 + z[x, y]^3 + 6 x y z[x, y] == 1;
Solve[D[eqn, y], D[z[x, y], y]] /. z[x, y] -> z


• Find another approach, but I still like all of your approaches better. See my original post. Jul 11 '15 at 19:24
• Actually, that approach is quite nice; you now have an explicit reminder that z is the dependent variable. Jul 11 '15 at 19:31

eqn = x^3 + y^3 + z^3 + 6 x y z - 1 == 0
Solve[Dt[eqn, x], Dt[z, x]] /. Dt[y, x] -> 0
Solve[Dt[eqn, y], Dt[z, y]] /. Dt[x, y] -> 0


If y is function of x, just do:

Solve[Dt[eqn, x], Dt[z, x]]
Solve[Dt[eqn, y], Dt[z, y]]


$$\frac{\partial z}{\partial x} = \frac{-x^2-y^2 \frac{\partial y}{\partial x}-2 x z \frac{\partial y}{\partial x}-2 y z}{2 x y+z^2}$$

$$\frac{\partial z}{\partial y} =\frac{x^2 \left(-\frac{\partial \ x}{\partial y}\right)-2 y z \frac{\partial x}{\partial y}-2 x \ z-y^2}{2 x y+z^2}$$

• How is this different from the solution I posted? Jul 11 '15 at 10:20
• You set Dt[y,x] to zero, and Dt[z, y] is missing Jul 11 '15 at 10:34
• Yes, and we are taking partial derivatives, no? We are, per OP, considering $z$ as a function of $x$ and $y$. Jul 11 '15 at 10:44
• Also, I left something for the OP to do by himself, so I left out the derivative with respect to the other variable. Jul 11 '15 at 10:45
• @EnriquePérezHerrero. I like all of the answers I see on this page. I think this particular arrangement is a little easier to understand for students just beginning to use Mathematica. But I want to thank everyone for their help. Jul 11 '15 at 17:58

Try this:

Solve[0 == Dt[x^3 + y^3 + z^3 + 6 x y z - 1, x] /.
Dt[y, x] -> 0, Dt[z, x]][[1, 1]]
Dt[z, x] -> (-x^2 - 2 y z)/(2 x y + z^2)


The procedure is similar for the other independent variable.

• I like your solution. I do not understand now why I do not get the same answer as your solution. So I assume I am doing something wrong by solving for z and then taking derivative. So will delete my answer since I need to check why it is different. Jul 11 '15 at 7:29
• @Nasser, that approach ought to generate something correct, albeit complicated. I'll look at it myself later. Jul 11 '15 at 7:59
• They are not the same. Since in your method, you set Dt[y,x] to zero as you assumed that y is not function of x. There is no corresponding action done when one just solves for z and then take derivative of the result w.r.t x. That is why the expression I got was much more complicated. I assume your method is what one should do, as the result you obtain is much simpler ;) Jul 11 '15 at 8:11
• Well, if you use D[], anything that doesn't involve the target variable becomes zero, so it is supposed to be equivalent. Jul 11 '15 at 10:15

Application of the implicit function theorem in this case shows that $\frac{\partial z}{\partial x}=-\frac{\partial f}{\partial x}/\frac{\partial f}{\partial z}$ and $\frac{\partial z}{\partial y}=-\frac{\partial f}{\partial y}/\frac{\partial f}{\partial z}$, where $f(x,y,z)=0$ is the implicit function.

f = x^3 + y^3 + z^3 + 6 x y z - 1;
-D[f, {{x, y}}]/D[f, z] // Simplify

{-((x^2 + 2 y z)/(2 x y + z^2)), -((y^2 + 2 x z)/(2 x y + z^2))}

• This will come in handy once we do the chain rule and I can explain the implicit function theorem. Thanks. Jul 11 '15 at 18:00