1

I have a trivariate implicit function: $f(x,y,z)=0$ or in more detail: $f(x,y(x),z(x,y(x))=0$

I have the implicit equation for $f(x,y,z)$ and explicit equation for $z(x,y)$, hence I can evaluate the analytical derivatives. To solve, for any given $x$, I iterate using Newton-Raphson to find $y$.

I am trying to find $\frac{d^2z}{dx^2}$.

I tried to expand this post Second derivative of function of two variables to three variables but the extra $z$ is proving a little tricky.

I started off with:

$\frac{df}{dx}=\frac{\partial f}{\partial x}+\frac{\partial f}{\partial y}.\frac{dy}{dx}+\frac{\partial f}{\partial z}.\frac{dz}{dx}$

from this post: Deriving the Formula of Total Derivative for Multivariate Functions

Which I guess is correct if $z$ is not a function of $y$.

But I don't think this is correct if $z$ is a function of $y$ as well as the $\frac{dz}{dx}$ I get from this is not the same as the derivative calculated numerically. So before I use this to calculate $\frac{d^2z}{dx^2}$, I need to get the first derivative correct.

Can someone help with the formula?

Adrian
  • 424

1 Answers1

1

Firstly, we have \begin{align}\frac{dz}{dx}=\frac{\partial z}{\partial x}+\frac{\partial z}{\partial y}\frac{dy}{dx}\implies\frac{d^2z}{dx^2}&=\frac{\partial}{\partial x}\left(\frac{dz}{dx}\right)+\frac{\partial}{\partial y}\left(\frac{dz}{dx}\right)\frac{dy}{dx}\\&=\frac{\partial}{\partial x}\left(\frac{\partial z}{\partial x}+\frac{\partial z}{\partial y}\frac{dy}{dx}\right)+\frac{\partial}{\partial y}\left(\frac{\partial z}{\partial x}+\frac{\partial z}{\partial y}\frac{dy}{dx}\right)\frac{dy}{dx}\\&=\frac{\partial^2z}{\partial x^2}+\frac{\partial^2z}{\partial x\partial y}\frac{dy}{dx}+\frac{\partial z}{\partial y}\frac{d^2y}{dx^2}+\left(\frac{\partial^2z}{\partial x\partial y}+\frac{\partial^2z}{\partial y^2}\frac{dy}{dx}+0\right)\frac{dy}{dx}\\&=\frac{\partial^2z}{\partial x^2}+2\frac{\partial^2z}{\partial x\partial y}\frac{dy}{dx}+\frac{\partial^2z}{\partial y^2}\left(\frac{dy}{dx}\right)^2+\frac{\partial z}{\partial y}\frac{d^2y}{dx^2}.\end{align} Next, we have \begin{align}\frac{df}{dx}=\frac{\partial f}{\partial x}+\frac{\partial f}{\partial y}\frac{dy}{dx}+\frac{\partial f}{\partial z}\frac{dz}{dx}=0&\implies\frac{dy}{dx}=-\frac{\frac{\partial f}{\partial x}+\frac{\partial f}{\partial z}\frac{dz}{dx}}{\frac{\partial f}{\partial y}}\end{align} whence \begin{align}\small\frac{d^2z}{dx^2}&=z_{xx}-\frac{2z_{xy}}{f_y}\left(f_x+f_z\frac{dz}{dx}\right)+\frac{z_{yy}}{f_y^2}\left(f_x+f_z\frac{dz}{dx}\right)^2-z_y\frac d{dx}\left(\frac{f_x+f_z\frac{dz}{dx}}{f_y}\right)\\&=\small z_{xx}-\frac{2z_{xy}f_x}{f_y}+\frac{z_{yy}f_x^2}{f_y^2}-z_y\frac{d}{dx}\left(\frac{f_x}{f_y}\right)+\left(-\frac{2z_{xy}f_z}{f_y}+\frac{2z_{yy}f_xf_z}{f_y^2}-z_y\frac{d}{dx}\left(\frac{f_z}{f_y}\right)\right)\frac{dz}{dx}-\frac{z_yf_z}{f_y}\frac{d^2z}{dx^2}.\end{align}

  • How do I get $\frac{dy}{dx}$? – Adrian Oct 28 '19 at 11:11
  • It would be -$\frac{\partial f}{\partial x}/\frac{\partial f}{\partial y}$,

    if $\frac{df}{dx}=\frac{\partial f}{\partial x}+\frac{\partial f}{\partial y}.\frac{dy}{dx}=0$,

    but $\frac{df}{dx}=\frac{\partial f}{\partial x}+\frac{\partial f}{\partial y}.\frac{dy}{dx}+\frac{\partial f}{\partial z}.\frac{dz}{dx}=0$, ie. we have an extra $z$ term

    – Adrian Oct 28 '19 at 13:01
  • Your last equation gives $\frac{dy}{dx}=-\frac{f_x+f_z\cdot\frac{dz}{dx}}{f_y}$ which can be inserted into my expression above to solve for $\frac{dz}{dx}$, which is a simple ODE. – ə̷̶̸͇̘̜́̍͗̂̄︣͟ Nov 03 '19 at 11:01
  • In your update, are you not missing $f_y^2$ in the denominator of the 3rd term in the first equation for $\frac{d^2z}{dx^2}$? – Adrian Nov 03 '19 at 11:19
  • 2 more: in the 2nd equation, should the sign of the last term be negative? and the 2nd term in the brackets of the 5th term should be $f_x$ instead of $f_y$. – Adrian Nov 03 '19 at 11:30
  • Yes, indeed. Too many terms :) – ə̷̶̸͇̘̜́̍͗̂̄︣͟ Nov 03 '19 at 11:33
  • also $\frac{d^2z}{dx^2}$ appears on both sides of the equation, so I assume I need to take that term to the LHS and solve for $\frac{d^2z}{dx^2}$ – Adrian Nov 03 '19 at 11:36
  • Yes. I'm not sure how that works out in the end though. Perhaps that's where numerical methods come in useful. – ə̷̶̸͇̘̜́̍͗̂̄︣͟ Nov 03 '19 at 11:41
  • Also how do I get $\frac{d}{dx}\left(\frac{f_x}{f_y}\right)$? Always confused about the full derivative of a partial derivative, what do the 2nd derivatives look like? – Adrian Nov 03 '19 at 11:41
  • E.g. $\frac d{dx}\frac{\partial f}{\partial t}=\frac\partial{\partial t}\left(\frac{\partial f}{\partial t}\right)\frac{dt}{dx}$. The rest follows from the quotient rule. Back later. – ə̷̶̸͇̘̜́̍͗̂̄︣͟ Nov 03 '19 at 11:45
  • Thanks, btw not sure if you saw my other post https://math.stackexchange.com/questions/3419988/implicit-differentiation-of-a-trivariate-function/ – Adrian Nov 03 '19 at 11:46