Problem with partial derivative with multi-variable Here, $z=z(u,v)$ where $u=u(x,y)$ and $v=v(x,y)$
$$p=\frac{\partial z}{\partial x}=\frac{\partial z}{\partial u} \frac{\partial u}{\partial x}+\frac{\partial z}{\partial v} \frac{\partial v}{\partial x} \implies \frac{\partial}{\partial x}=\frac{\partial u}{\partial x} \frac{\partial}{\partial u}+\frac{\partial v}{\partial x} \frac{\partial}{\partial v}$$
$$q=\frac{\partial z}{\partial y}=\frac{\partial z}{\partial u} \frac{\partial u}{\partial y}+\frac{\partial z}{\partial v} \frac{\partial v}{\partial y}\implies \frac{\partial}{\partial y}=\frac{\partial u}{\partial y} \frac{\partial}{\partial u}+\frac{\partial v}{\partial y} \frac{\partial}{\partial v}$$
$$
\begin{align}
r&=\frac{\partial^2 z}{\partial x^2}\\\\
&=\frac{\partial}{\partial x}\left(\frac{\partial z}{\partial x}\right)\\\\
&=\left(\frac{\partial u}{\partial x} \frac{\partial}{\partial u}+\frac{\partial v}{\partial x} \frac{\partial}{\partial v}\right)\left(\frac{\partial u}{\partial x} \frac{\partial z}{\partial u}+\frac{\partial v}{\partial x} \frac{\partial z}{\partial v}\right)\\\\
&\stackrel{{}^3}{=}\frac{\partial u}{\partial x} \frac{\partial}{\partial u}\left(\frac{\partial u}{\partial x} \frac{\partial z}{\partial u}+\frac{\partial v}{\partial x} \frac{\partial z}{\partial v}\right)+\frac{\partial v}{\partial x} \frac{\partial}{\partial v}\left(\frac{\partial u}{\partial x} \frac{\partial z}{\partial u}+\frac{\partial v}{\partial x} \frac{\partial z}{\partial v}\right)\\\\
&\stackrel{{}^4}{=}\frac{\partial^2 z}{\partial u^2}\left(\frac{\partial u}{\partial x}\right)^2+2 \frac{\partial^2 z}{\partial u \partial v} \frac{\partial u}{\partial x} \frac{\partial v}{\partial x}+\frac{\partial^2 z}{\partial v^2}\left(\frac{\partial v}{\partial x}\right)^2+\frac{\partial z}{\partial u} \frac{\partial^2 u}{\partial x^2}+\frac{\partial z}{\partial v} \frac{\partial^2 v}{\partial x^2}
\end{align}
$$

I couldn't understand how line $(4)$ came from line $(3)$, Like what should be $$\frac{\partial u}{\partial x} \frac{\partial}{\partial u}\left(\frac{\partial u}{\partial x} \frac{\partial z}{\partial u}+\frac{\partial v}{\partial x} \frac{\partial z}{\partial v}\right)=?$$
I guess $$\frac{\partial^2 z}{\partial u^2}\left(\frac{\partial u}{\partial x}\right)^2+ \frac{\partial^2 z}{\partial u \partial v} \frac{\partial u}{\partial x} \frac{\partial v}{\partial x}+\frac{\partial u}{\partial x}\frac{\partial z}{\partial u} \frac{\partial^2 u}{\partial x^2}+0$$
But that seems not correct. Any help will be appreciated.
 A: It is a little misleading to jump from 3 to 4. I have no idea why publishers think this is in anyway obvious.
$\def\D#1#2{\dfrac{\partial #1}{\partial #2}}\def\S#1#2{\dfrac{\partial^2 #1}{\partial #2~^2}}\def\T#1#2#3{\dfrac{\partial^2 #1}{\partial #2~\partial #3}}\begin{align}&\overset{3}{=}\frac{\partial u}{\partial x} \frac{\partial}{\partial u}\left(\frac{\partial u}{\partial x} \frac{\partial z}{\partial u}+\frac{\partial v}{\partial x} \frac{\partial z}{\partial v}\right)+\frac{\partial v}{\partial x} \frac{\partial}{\partial v}\left(\frac{\partial u}{\partial x} \frac{\partial z}{\partial u}+\frac{\partial v}{\partial x} \frac{\partial z}{\partial v}\right)
\\[2ex]&={\D ux\left(\D ux\S zu+\D zu\D~u\D ux+\D zv\D ~u\D vx+\D vx \T zuv\right)\\+\D vx\left(\D ux \T zuv+\D zu\D ~v\D ux+\D zv\D~v\D vx+\D vx\S zv\right)}
\\[2ex]&={\left(\D ux\right)^2\S zu+\D zu\D ux\D~u\D ux+\D zv\D ux\D ~u\D vx+2\D ux\D vx \T zuv\\+\D zu\D vx\D ~v\D ux+\D zv\D vx\D~v\D vx+\left(\D vx\right)^2\S zv}
\\[2ex]&={\left(\D ux\right)^2\S zu+2\D ux\D vx \T zuv+\left(\D vx\right)^2\S zv\\+\D zu\left[\D ux\D~u+\D vx\D ~v\right]\D ux+\D zv\left[\D ux\D~u+\D vx\D ~v\right]\D vx}
\\[2ex]&\overset{4}{=}\frac{\partial^2 z}{\partial u^2}\left(\frac{\partial u}{\partial x}\right)^2+2 \frac{\partial^2 z}{\partial u \partial v} \frac{\partial u}{\partial x} \frac{\partial v}{\partial x}+\frac{\partial^2 z}{\partial v^2}\left(\frac{\partial v}{\partial x}\right)^2+\frac{\partial z}{\partial u} \frac{\partial^2 u}{\partial x^2}+\frac{\partial z}{\partial v} \frac{\partial^2 v}{\partial x^2}\end{align}$
In index notation this is:
$\begin{align}
z_{xx} &= [z_x]_u u_x+[z_x]_v v_x
\\&= [z_u u_x+z_vv_x]_u u_x+[z_u u_x+z_vv_x]_v v_x \tag 3
\\&= (z_{uu}u_x+z_u[u_x]_u+z_v[v_x]_u+z_{vu}v_x)u_x+(z_{uv}u_x+z_u[u_x]_v+z_v[v_x]_v+z_{vv}v_x)v_x
\\ &=z_{uu}u_x^2+z_u[u_x]_uu_x+\color{blue}{z_v[v_x]_uu_x}+2z_{uv}u_xv_x+\color{red}{z_u[u_x]_vv_x}+z_v[v_x]_vv_x+z_{vv}v_x^2
\\ &=z_{uu}u_x^2+z_u([u_x]_uu_x+\color{red}{[u_x]_vv_x})+2z_{uv}u_xv_x+z_v(\color{blue}{[v_x]_uu_x}+[v_x]_vv_x)+z_{vv}v_x^2
\\ &=z_{uu}u_x^2+z_uu_{xx}+2z_{uv}u_xv_x+z_vv_{xx}+z_{vv}v_x^2 \tag 4
\end{align}$

Here's a much cleaner way to handle things:
Don't apply the Chain Rule to expand the partial operator until you apply the Product Rule.  Saves having to undo it later.
$$\def\D#1#2{\dfrac{\partial #1}{\partial #2}}\def\S#1#2{\dfrac{\partial^2 #1}{\partial #2~^2}}\def\T#1#2#3{\dfrac{\partial^2 #1}{\partial #2~\partial #3}} \begin{align}r&= \S zx\\[2ex]&=\D ~x\left(\D ux{\cdot}\D z u+\D vx{\cdot}\D zv\right)\\[2ex]&=\S ux{\cdot}\D zu+\D ux{\cdot}\D ~x\D zu+\D vx{\cdot}\D ~x\D zv+\S vx{\cdot}\D z v\\[2ex]&={\S ux{\cdot}\D zu+\D ux{\cdot}\left[\D ux{\cdot}\D~u+\D vx{\cdot}\D~v\right]\D zu\\+\D vx{\cdot}\left[\D ux{\cdot}\D~u+\D vx{\cdot}\D~v\right]\D zv+\S vx{\cdot}\D z v}\\[2ex]&=\S ux{\cdot}\D zu+\left(\D ux\right)^2{\cdot}\S zu+2\D ux{\cdot}\D vx{\cdot}\T zuv+\left(\D vx\right)^2{\cdot}\S zv+\S vx{\cdot}\D z v\end{align}$$
In index notation:
$\begin{align}z_{xx} &= [z_uu_x+z_vv_x]_x\\&=[z_u]_xu_x+z_uu_{xx}+z_v v_{xx}+[z_v]_x v_x\\&=(z_{uu}u_x^2+z_{uv}v_xu_x)+z_uu_{xx}+z_vv_{xx}+(z_{vu}u_xv_x+z_{vv}v_x^2)\\&=z_{uu}u_x^2+z_uu_{xx}+2z_{uv}u_xv_x+z_vv_{xx}+z_{vv}v_x^2\end{align}$
