# Gradient of a function (check if I did it well)

I have this function:

$$g(x, y) = f (\phi(x,\ \psi(x, y)),\ \eta(x, y))$$

And I have to find $\nabla g(x, y)$.

I tried to apply the chain rule, and this is what I got. I have many doubts about its correctness. Can you please tell me, in case, where am I wrong?

$$\frac{\partial g}{\partial x} = \frac{\partial f}{\partial \phi}\frac{\partial \phi}{\partial x} + \frac{\partial f}{\partial \eta}\frac{\partial \eta}{\partial x}= \frac{\partial f}{\partial \phi}\left(\frac{\partial \phi}{\partial x}\frac{\partial x}{\partial x} + \frac{\partial \phi }{\partial \psi}\frac{\partial \psi}{\partial x}\right) + \frac{\partial f}{\partial \eta}\frac{\partial \eta}{\partial x}$$

And in the same way for the derivative in $y$.

Hence the gradient then shall be the union of those two terms.

Am I right? Probably not. Can you illustrate me where am I wrong and why?