Solution (source code)

= Solution

Near each <local minimum>, the <gradient> points outward; near each <local maximum>, it points inward. The five remaining points have saddle directions, determined by their indefinite <Hessian matrices>.

On the $x$-axis the exact <gradient> is $(0,x(x^2-1))^T$, and on the $y$-axis it is $(y(y^2-1),0)^T$. Thus arrows are perpendicular to the axes and reverse direction at the origin and the unit-axis <stationary points>.

On the unit <circle>, substitute $x^2+y^2=1$ into the <gradient> to obtain
$$
\boxed{\nabla f=2xy(x,y)^T}.
$$
It is radial outward in quadrants I and III, radial inward in quadrants II and IV, and zero at the four axis intersections. These arrows, together with the nearby saddle and extremum patterns, are shown in the right panel of the contour figure. The <gradient> is normal to every regular <level curve> and points toward increasing values of $f$.