# Second total derivative of composite function and second partial derivatives, cant find my mistake

Problem 1 given a composite function $$z=f(u,v)$$ where $$u=xy$$ and $$v=\frac{x}{y}$$ find the first and second total derivative in terms of $$\mathrm dx$$ and $$\mathrm dy$$.

My work is as follows $$\mathrm d u=ydx+xdy$$ and $$\mathrm dv=\frac{1}{y} \mathrm dx+\frac{-x}{y^2}\mathrm dy$$ and i just substitute that in to $$dz=f'_1 du+f'_2 dv$$ and that is the correct solution now where im having trouble when i have to calculate second total differential i get $$\mathrm d^2 z=f''_{11}(y\mathrm dx+x\mathrm dy)+f''_{22}(\frac{y \mathrm dx - x \mathrm d y}{y^2})^2 + 2f''_{12}\frac{y^2 \mathrm dx^2-x^2 \mathrm dy^2}{y^2}$$ and the solution given in the book is $$\mathrm d^2 z=f''_{11}(y\mathrm dx+x\mathrm dy)+f''_{22}(\frac{y \mathrm dx - x \mathrm d y}{y})^2 + 2f''_{12}\frac{y^2 \mathrm dx^2-x^2 \mathrm dy^2}{y^2}+2f'_1 \mathrm dx \mathrm dy-2f'_2\frac{(y\mathrm dx-x\mathrm dy)\mathrm dy}{y^3}$$ and i dont understand where the extra $$2f'_1 \mathrm dx \mathrm dy-2f'_2\frac{(y\mathrm dx-x\mathrm dy)\mathrm dy}{y^3}$$ come from. since following the logic of $$\mathrm d(\mathrm d z)$$ i am getting the wrong answer.

Problem 2 -mistake given a function $$u=f(r)$$ where $$r=\sqrt{x^2+y^2+z^2}$$ now in order to finish the problem i need to compute the first and second partial derivative with respect to $$x$$ and i get $$\frac { \partial u } { \partial x }=\frac { \partial f(r) } { \partial r }\frac { \partial r } { \partial x }=f'\frac{x}{r}$$ and now where the mistake happens when i try to compute the second partial derivative as $$\frac { \partial ^ 2 u } { \partial x^2 }=\frac{\partial}{\partial x}(f'\frac{x}{r})=\frac { \partial (f'(r)\frac{x}{r}) } { \partial r }\frac { \partial r } { \partial x }=f''\frac{x^2}{r^2}-f'\frac{x^2}{r^3}$$ instead of the correct solution of $$f''\frac{x^2}{r^2}-f'\frac{x^2}{r^3} +f'\frac{1}{r}$$ if i just calculated without introducing $$\partial r$$ and just used $$x$$ and chain rule. Can someone explain to me where i made the mistake when introducing $$\partial r$$?

Thank you for the help in advance :D

## 1 Answer

For the second problem,

$$\frac { \partial ^ 2 u } { \partial x^2 }=\frac{\partial}{\partial x}(f'\frac{x}{r}) = \frac{x}{r}\frac{\partial}{\partial x}(f') + f' \frac{\partial}{\partial x} (\frac{x}{r})$$

$$= \frac{x}{r}\frac{\partial}{\partial x}(f') + f' \frac{\partial}{\partial x} (\frac{x}{r})$$

$$= \frac{x}{r} \frac{\partial (f')}{\partial r} \frac{\partial r}{\partial x} + f' (\frac{1}{r} - \frac{x}{r^2} \frac{\partial r}{\partial x})$$

$$= \frac{x^2}{r^2} f'' + f' (\frac{1}{r} - \frac{x^2}{r^3})$$

Edit: here is my earlier solution and I have added the missing terms.

$$dz=f_1 du+f_2 dv$$

Then $$d^2z = f_{11} (du)^2 + f_{12} du \ dv + f_1 d^2u + f_{12} du \ dv + f_{22} (dv)^2 + f_2 d^2v$$

You are missing $$f_1 d^2u + f_2 d^2v$$.

$$f_1 d^2u = f_1 \ d (y dx + x dy) = f_1 (2 dx dy + y d^2x + x d^2y)$$

Similarly, $$f_2 d^2v = f_2 \ d (\frac{ydx - xdy}{y^2}) = f_2 \ [-\frac{2}{y^2} dx dy + \frac{1}{y} d^2x - \frac{x}{y^2} d^2y + \frac{2x}{y^3} (dy)^2]$$

Or the way Graham Kemp explained,

$$d^2 z = d^2x~\partial_x(z) + d^2y~\partial_y(z) + (d x)^2~\partial^2_x(z) + (d y)^2~\partial^2_y(z) + 2~dx~dy~\partial_y\partial_x(z)$$

You can now differentiate each term and rearrange to get the same result. For example,

$$d^2x~\partial_x(z) = d^2x~ (y f_1 + \frac{1}{y} f_2)$$

I will take another term and let you work through the rest yourself.

$$2 ~ dx ~ dy ~ \partial_y\partial_x(z) = 2 ~ dx ~ dy ~[\partial_y (y f_1 + \frac{1}{y}f_2]$$

$$= 2 ~ dx ~ dy ~[f_1 - \frac{1}{y^2} f_2 + xy f_{11} - \frac{x}{y^3} f_{22}]$$

• but if i treat $d^2=\left(dx\frac{\partial}{\partial x}+dy\frac{\partial}{\partial y}\right)\left(dx\frac{\partial}{\partial x}+dy\frac{\partial}{\partial y}\right)$ i dont get why we have the single $f'_1 \mathrm d^2 x$ since just by multiplying it we would only get what i wrote ie $dx^2\frac{\partial^2 f}{\partial x^2}+dy^2\frac{\partial^2 f}{\partial y^2}+2dx dy\frac{\partial^2 f}{\partial x\partial y}$. Can you please explain or link me to somewhere i can read ? thank you for the help Aug 23, 2021 at 11:18
• Some of those "multiplications" are actually derivations. \def\d{\mathrm d} \begin{align}\d^2&= \d(\d x~\partial_x+\d y~\partial_y)\\&=\d^2 x~\partial_x+\d x~\d\partial_x+\d y~\d\partial_y+\d^2y~\partial_y\\&=\d^2x~\partial _x+\d^2y~\partial_y+\d x~(\d x~\partial^2_x+\d y~\partial_y\partial_x)+\d y~(\d x~\partial_x\partial_y+\d y~\partial^2_y)\\&=\d^2x~\partial_x+\d^2y~\partial_y+(\d x)^2~\partial^2_x+(\d y)^2~\partial^2_y+2\d x~\d y~\partial_x\partial_y\end{align} Remember also that $\partial_x z = f_1~\partial_x u+ f_2~\partial_x v = y f_1+y^{-1} f_2$ and so forth. Aug 24, 2021 at 1:11
• @GrahamKemp thanks. In fact I posted an answer earlier which matched with the book answer that OP shows but I deleted later because I realized even the book answer was missing certain terms for both $f_1$ and $f_2$. Those are precisely the first two terms in your comment - $d^2x~\partial_x+d^2y~\partial_y$ Aug 24, 2021 at 2:08
• @GrahamKemp thank you for the explanation, if possible could you please finish the problem as it would mean a lot to me. Aug 24, 2021 at 11:20
• Thank you very much!! It was more than i expected and very informative, i cant ask for more. Aug 24, 2021 at 15:14