Calculating $\nabla g(3,-3)$? 
Given $f(x,y)$, a function that has continuous partial derivatives in
every point.
such that $\nabla f(0,-18)=-2i+3j$
We define a new function $g(x,y)=f(xy+x^2,xy-y^2)$ calculate $\nabla
 g(3,-3)$

How I tried to solve this?
I need to find:
$$\nabla g(3,-3)$ = g_x'(3,-3)i+g_y'(3,-3)j=f(xy+x^2,xy-y^2)_x'(3,-3)i+f(xy+x^2,xy-y^2)_y'(3,-3)j$$
and I have a formula for $\nabla g(3,-3)$, in other words I am evaluating the gradient of $g$ at the point $x=3$ and $y=-3$. In this formula I have the terms $f(xy+x^2, xy-y^2)^{'}_x$ and  $f(xy+x^2, xy-y^2)^{'}_y$ so I need to substitute $x=3$ and $y=-3$ into them which gives me a final answer of $-2i+3j$ which is wrong.
 A: I think you may have forgotten to apply the chain rule: here $g=f(\phi(x,y))$ so
$$\nabla g = D\phi \times \nabla f$$
where $$D\phi =\left(\begin{array}[cc]
\;\frac{\partial\phi_x}{\partial x}
& \frac{\partial\phi_y}{\partial x}\\
 \frac{\partial\phi_x}{\partial y}
&\frac{\partial\phi_y}{\partial y}
\end{array}\right) =   \left(\begin{array}[cc]
\;2x +y & y \\
x & x-2y 
\end{array}\right) $$
So $\nabla g(3,-3) = \left(\begin{array}[cc]
\;3& -3\\
3& 9
\end{array}\right)\times \left(\begin{array}[c]
\;-2 \\
\;\;3
\end{array}\right)$ and thus, dropping matrix notation, $\nabla g(3,-3)=-15 i +21j$.
I hope I didn't make any mistake..
A: In short, you need to use the chain rule.
Let $u(x,y) = xy+x^2$, $v(x,y) = xy-y^2$. Then $g(x,y) = f(u(x,y),v(x,y))$. So $\frac{\partial u}{\partial x}(3,-3) = (y+2x)|_{x=3,y=-3}=-3+6=3$, and similarly $\frac{\partial v}{\partial x}(3,-3) = -3$. Notice that when $(x,y) = (3,-3)$, $(u,v) = (0,-18)$.
Therefore,
\begin{equation}
\frac{\partial g}{\partial x}= \frac{\partial f}{\partial u}\frac{\partial u}{\partial x}+\frac{\partial f}{\partial v}\frac{\partial v}{\partial x}
=-2\frac{\partial u}{\partial x}+3\frac{\partial v}{\partial x}=-2\times3+3\times(-3)=-15.
\end{equation}
And similarly,
\begin{equation}
\frac{\partial g}{\partial y}= \frac{\partial f}{\partial u}\frac{\partial u}{\partial y}+\frac{\partial f}{\partial v}\frac{\partial v}{\partial y}
=-2\frac{\partial u}{\partial y}+3\frac{\partial v}{\partial y}=-2\times3+3\times9=21.
\end{equation}
