Solution (source code)

= Solution

The <double-angle formula> gives $r^2\sin2\phi=2(r\cos\phi)(r\sin\phi)=2xy$. Therefore
$$
\boxed{f(x,y)=2xy,\qquad\nabla f=(2y,2x).}
$$