Say $f(z) = g^2(z, z^2) + z^4$. What is $f'(z)$?
I thought to use the chain rule but I am not sure if I'm right. I mean
$$f'(z) = \dfrac{d g^2}{dz} \dfrac{dz}{dz} + \dfrac{d g^2}{dz}\dfrac{dz^2}{dz} + 4z^3$$
Is this correct?
Also, $\dfrac{d g^2}{dz}$ would be $2g(z, z^2) g'(z, z^2)$?
Thank you!
It is not clear what you mean by $g'(z, z^2)$. Note that $g(x,y)$ is a function of two-variables, therefore, again by the chain rule, $$\frac{d}{dz}g(z, z^2)=\frac{\partial g}{\partial x}(z,z^2)\cdot 1+\frac{\partial g}{\partial y}(z,z^2)\cdot 2z.$$ Therefore $$\begin{align*}f'(z) &= \dfrac{d (g^2(z,z^2))}{dz} + 4z^3\\ &=2g(z,z^2)\cdot\frac{d}{dz}g(z, z^2) + 4z^3\\ &= 2g(z,z^2)\cdot\frac{\partial g}{\partial x}(z,z^2)+2g(z,z^2)\cdot\frac{\partial g}{\partial y}(z,z^2)\cdot 2z+ 4z^3. \end{align*}$$