3
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ Find another approach, but I still like all of your approaches better. See my original post. $\endgroup$
    – David
    Commented Jul 11, 2015 at 19:24
  • $\begingroup$ Actually, that approach is quite nice; you now have an explicit reminder that z is the dependent variable. $\endgroup$ Commented Jul 11, 2015 at 19:31

3 Answers 3

0
$\begingroup$
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}$$

$\endgroup$
8
  • $\begingroup$ How is this different from the solution I posted? $\endgroup$ Commented Jul 11, 2015 at 10:20
  • $\begingroup$ You set Dt[y,x] to zero, and Dt[z, y] is missing $\endgroup$ Commented Jul 11, 2015 at 10:34
  • $\begingroup$ Yes, and we are taking partial derivatives, no? We are, per OP, considering $z$ as a function of $x$ and $y$. $\endgroup$ Commented Jul 11, 2015 at 10:44
  • 1
    $\begingroup$ Also, I left something for the OP to do by himself, so I left out the derivative with respect to the other variable. $\endgroup$ Commented Jul 11, 2015 at 10:45
  • 1
    $\begingroup$ @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. $\endgroup$
    – David
    Commented Jul 11, 2015 at 17:58
5
$\begingroup$

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.

$\endgroup$
4
  • $\begingroup$ 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. $\endgroup$
    – Nasser
    Commented Jul 11, 2015 at 7:29
  • $\begingroup$ @Nasser, that approach ought to generate something correct, albeit complicated. I'll look at it myself later. $\endgroup$ Commented Jul 11, 2015 at 7:59
  • 1
    $\begingroup$ 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 ;) $\endgroup$
    – Nasser
    Commented Jul 11, 2015 at 8:11
  • $\begingroup$ Well, if you use D[], anything that doesn't involve the target variable becomes zero, so it is supposed to be equivalent. $\endgroup$ Commented Jul 11, 2015 at 10:15
5
$\begingroup$

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))}
$\endgroup$
1
  • 2
    $\begingroup$ This will come in handy once we do the chain rule and I can explain the implicit function theorem. Thanks. $\endgroup$
    – David
    Commented Jul 11, 2015 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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