Solution (source code)

= Solution

At a regular constrained stationary point of $F$ on $G=0$, the <Lagrange multiplier> method solves
$$
\nabla F=\lambda\nabla G,
\qquad G=0.
$$
For the first problem, substitute $z=1+xy$ to obtain
$$
F=x^2+y^2+(1+xy)^2.
$$
Its stationary equations imply either $x=y$ or $xy=0$, and in either case the only real stationary point is $x=y=0$, $z=1$. Coercivity ensures that the minimum is attained, so
$$
\boxed{\min(x^2+y^2+z^2)=1}
$$
at $(0,0,1)$.

For the second problem, the <arithmetic-geometric mean inequality> gives
$$
-xy\leq\frac{x^2+y^2}{2}=\frac{1-z^2}{2}.
$$
Consequently
$$
z-xy\leq z+\frac{1-z^2}{2}
=1-\frac{(z-1)^2}{2}\leq1.
$$
Equality occurs at $(0,0,1)$, and hence
$$
\boxed{\max_{x^2+y^2+z^2=1}(z-xy)=1}.
$$