3

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

But I still like what I see on this page better.

David
  • 14,883
  • 4
  • 44
  • 117

3 Answers3

5

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.

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
  • 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. – Nasser Jul 11 '15 at 07:29
  • @Nasser, that approach ought to generate something correct, albeit complicated. I'll look at it myself later. – J. M.'s missing motivation Jul 11 '15 at 07:59
  • 1
    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 ;) – Nasser Jul 11 '15 at 08:11
  • Well, if you use D[], anything that doesn't involve the target variable becomes zero, so it is supposed to be equivalent. – J. M.'s missing motivation Jul 11 '15 at 10:15
5

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))}
Stelios
  • 1,381
  • 1
  • 11
  • 16
  • 2
    This will come in handy once we do the chain rule and I can explain the implicit function theorem. Thanks. – David Jul 11 '15 at 18:00
0
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}$$