# Calculating $u_t$, $u_x$, and $u_{xx}$ for $u(x, t) = -2 \frac{\partial}{\partial{x}}\log(\phi(x,t))$

I am trying to calculate $u_t$, $u_x$, and $u_{xx}$ for $u(x, t) = -2 \dfrac{\partial}{\partial{x}}\log(\phi(x,t))$.

I've been trying for hours, but I've become so confused with the chain rule here that I don't know what to do.

Can someone please demonstrate how to correctly calculate these? Please show your calculations so that I can learn how I'm supposed to be applying the chain rule.

EDIT:

Thank you for all posting great answers. Here is my attempt without using simplification

$$u(x,t) = -2\overbrace{\frac{\partial\phi(x,t)}{\partial x}}^{\;\;\text{derivative of}\\\text{argument of }\log}\underbrace{\frac{1}{\phi(x,t)}}_{\text{derivative of }\log(x)\\ \text{with argument }\phi(x,t)}$$

at the beginning.

$$u_x = -2 \left[ \frac{\partial}{\partial x} \left( \frac{\partial}{\partial x} (\log(\phi(x, t)) \right) \right]$$

$$= -2 \left[ \frac{\partial}{\partial{(\log(\phi))}} \left( \frac{\partial}{\partial x} (\log(\phi(x, t)) \right) \right] \times \left[ \frac{\partial}{\partial{(\phi)}} (\log(\phi(x, t)) \right] \times \frac{\partial{\phi}}{\partial{x}}$$

(By the chain rule.)

$$= -2 \left[ \frac{\partial}{\partial{x}} \left[ \left( \frac{1}{\phi} \right) \frac{\partial{\phi}}{\partial{x}} \right] \times \frac{1}{\phi} \times \frac{\partial{\phi}}{\partial{x}} \right]$$

$$= -2 \left[ \frac{\partial}{\partial{x}} \left[ \left( \frac{1}{\phi} \right) \frac{\partial{\phi}}{\partial{x}} \right] \times \frac{1}{\phi} \times \frac{\partial{\phi}}{\partial{x}} \right]$$

$$= -2 \left[ \left( -\phi^{-2}(x, t) \times \frac{\partial{\phi}}{\partial{x}} + \frac{\partial^2{\phi}}{\partial{x}^2} \times \frac{1}{\phi} \right) \times \frac{1}{\phi} \times \frac{\partial{\phi}}{\partial{x}} \right]$$

Feedback on this attempt is appreciated.

• I don't quite understand why that $$\frac{\partial}{\partial x}$$ became a $$\frac{\partial}{\partial \log(\phi)}$$ if we use the chain rule we have that $$\frac{\partial}{\partial x} = \frac{\partial}{\partial \log(\phi)}\frac{\partial\log(\phi)}{\partial x}$$ and this first equality doesn't touch the derivative that follows it. You could rewrite even that other partial derivative in the same way but it seems pretty unnecessary Commented Aug 3, 2018 at 8:18
• @DavideMorgante I apologise for doing it so badly. Can you please demonstrate this as an example with explanations? That way, I will get a better idea as to how to do it and what I am doing wrong. I will then try to do it for $u_{xx}$ and $u_t$ and post it.
– user423167
Commented Aug 3, 2018 at 9:24

You could do all the calculations without evaluating the first derivative in the function, but we'll do it anyway $$u(x,t) = -2\overbrace{\frac{\partial\phi(x,t)}{\partial x}}^{\;\;\text{derivative of}\\\text{argument of }\log}\underbrace{\frac{1}{\phi(x,t)}}_{\text{derivative of }\log(x)\\ \text{with argument }\phi(x,t)}$$ Now you can see that the function $u(x,t)$ is the product of two functions! We can evaluate the other derivatives using the derivative of the product of functions, mainly $$u_x(x,t) = \frac{\partial}{\partial x}\left(-2\frac{\partial\phi(x,t)}{\partial x}\frac{1}{\phi(x,t)}\right) = \underbrace{-2\frac{\partial^2\phi}{\partial x^2}\frac{1}{\phi}}_{D[1^{\text{st}}]\times2^{\text{nd}}}+\underbrace{2\frac{\partial \phi}{\partial x}\frac{\partial\phi}{\partial x}\frac{1}{\phi^2}}_{D[2^{\text{nd}}]\times1^{\text{st}}}=2\left(\frac{1}{\phi}\frac{\partial \phi}{\partial x}\right)^2 -2\frac{\partial^2\phi}{\partial x^2}\frac{1}{\phi}\\ u_t(x,t) =-2\frac{\partial^2 \phi}{\partial x \partial t}\frac{1}{\phi}+2\frac{\partial \phi}{\partial x}\frac{\partial \phi}{\partial t}\frac{1}{\phi^2}\\ u_{xx}(x,t) = \frac{\partial}{\partial x}\left(\color{red}{2\left(\frac{1}{\phi}\frac{\partial \phi}{\partial x}\right)^2} \color{blue}{-2\frac{\partial^2\phi}{\partial x^2}\frac{1}{\phi}}\right) = \\=\color{red}{-4\left(\frac{1}{\phi}\frac{\partial \phi}{\partial x}\right)\left(\frac{1}{\phi^2}\frac{\partial\phi}{\partial x}+\frac{1}{\phi}\frac{\partial^2\phi}{\partial x^2}\right)}\color{blue}{-2\left(\frac{1}{\phi}\frac{\partial^3\phi}{\partial x^3}-\frac{1}{\phi^2}\frac{\partial \phi}{\partial x}\frac{\partial^2\phi}{\partial x^2}\right)}$$ all done by using the chain rule. I used coloring to simplify the visualization of the derivatives

• Thank you. Your answer is very clear. Can you please also show how it's done without simplifying the first derivative? I'm trying to do that using the chain rule and find it very confusing.
– user423167
Commented Aug 2, 2018 at 22:32
• Without simplifying it you mean without collecting the squares together? Commented Aug 2, 2018 at 22:33
• I meant without this simplification: $u(x,t) = -2\overbrace{\frac{\partial\phi(x,t)}{\partial x}}^{\;\;\text{derivative of}\\\text{argument of }\log}\underbrace{\frac{1}{\phi(x,t)}}_{\text{derivative of }\log(x)\\ \text{with argument }\phi(x,t)}$
– user423167
Commented Aug 2, 2018 at 22:34
• If I am not mistaken, this makes our use of the chain rule more complex.
– user423167
Commented Aug 2, 2018 at 22:34
• Oh ok, I don't think I can put it all in one comment, maybe I can do one just to clarify your doubts? Where are you stuck? Commented Aug 2, 2018 at 22:35

First simplify the right side by finding the derivative.

$$\frac{\partial}{\partial x}\log\phi(x,t) = \frac{1}{\phi(x,t)}\frac{\partial \phi}{\partial x}$$

so

$$u(x,t) = -2\frac{\phi_x(x,t)}{\phi(x,t)}$$

Then the derivatives of $u$ are straightforward, each one follows the quotient rule.

$$\frac{\partial u}{\partial t} = -2\frac{\partial}{\partial t}\left(\frac{\phi_x(x,t)}{\phi(x,t)}\right) = -2\frac{\phi(x,t)\phi_{xt}(x,t)-\phi_x(x,t)\phi_t(x,t)}{\phi^2(x,t)}$$

$$\frac{\partial u}{\partial x} = -2\frac{\phi(x,t)\phi_{xx}(x,t) - \phi^2_x(x,t)}{\phi^2(x,t)}$$

The last is a bit of a doozy though. Dropping the $(x,t)$ as $\phi$ is understood to be a fuction of both $x$ and $t$,

$$\frac{\partial^2u}{\partial x^2}=-2\frac{\phi^2(\phi_x\phi_{xx} + \phi\phi_{xxx} - 2\phi_x\phi_{xx}) - 2\phi\phi_x(\phi\phi_{xx}-\phi^2_x)}{\phi^4}$$

$$u(x,t)~=~-2\frac{\partial}{\partial x}\log(\phi(x,t))$$

The chain rule states that

$$\frac{\partial f(u(x,t))}{\partial x}~=~\frac{\partial f(u(x,t))}{\partial u(x,t)}\frac{\partial u(x,t)}{\partial x}$$

And so the original function becomes

$$-2\frac{\partial}{\partial x}\log(\phi(x,t))~=~-2\frac{1}{\phi(x,t)}\phi_x(x,t)~=~-2\frac{\phi_x(x,t)}{\phi(x,t)}$$

So for the first case $u_t$ we consider the function $\phi(x,t)$ as $u$ and $\frac{\partial}{\partial x}\log(u)$ as $f$ so we get

\begin{align} \frac{\partial}{\partial t}\left(-2\frac{\phi_x(x,t)}{\phi(x,t)}\right)~&=~-2\frac{\phi_{xt}(x,t)\phi(x,t)-\phi_t(x,t)\phi_x(x,t)}{\phi^2(x,t)}\\ \frac{\partial}{\partial x}\left(-2\frac{\phi_x(x,t)}{\phi(x,t)}\right)~&=~-2\frac{\phi_{xx}(x,t)\phi(x,t)-\phi_x^2(x,t)}{\phi^2(x,t)}\\ \frac{\partial}{\partial x}\left(-2\frac{\phi_{xx}(x,t)\phi(x,t)-\phi_x^2(x,t)}{\phi^2(x,t)}\right)~&=~\frac{[\phi_{xxx}\phi+\phi_x\phi_{xx}-2\phi_x\phi_{xx}]\phi^2-2\phi\phi_x[\phi_{xx}\phi-\phi_x^2]}{\phi^4}\\ &=~\frac{[\phi_{xxx}\phi-\phi_x\phi_{xx}]\phi-2\phi_x[\phi_{xx}\phi-\phi_x^2]}{\phi^3}\\ &=~\frac{\phi_{xxx}\phi^2-3\phi_{xx}\phi_x\phi+2\phi_x^2\phi}{\phi^3} \end{align}

This work is kind of messy so I hope I did not made a mistake somewhere. I guess the crucial point is the to get rid of the partial derivative with respect to $x$ in the definition of the funtion $u$. I hope I made clear how it works out.