Finding max/min of multivariable function The following function
$f(x,y) = 3xy + \frac{6}{1 + x^2 + y^2 }$ within $\frac{1}{3} \leq x^2 +y^2 \leq 4$
I do partial differention 
$\frac{\partial z}{\partial x} = 3y - \frac{12x}{1 + x^2 + y^2}$
$\frac{\partial z}{\partial y} = 3x - \frac{12y}{1 + x^2+ y^2 }$
I try to simplify and get an expression of just one variable setting 
$\frac{\partial z}{\partial x} - \frac{\partial z}{\partial x} = 0$
getting that $x = y$
$3x - \frac{12x}{1 + x^2+x^2 }$ 
solving for $x = 0$, $x_1 = 0, x_2 = \frac{1}{\sqrt{2}}, x_3 = \frac{-1}{\sqrt{2}}$
which gives me 
$f(\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}}) = 3\frac{1}{\sqrt{2}}\frac{1}{\sqrt{2}} + \frac{6}{1 + \left(\frac{1}{\sqrt{2}}\right)^2 + \left(\frac{1}{\sqrt{2}}\right)^2 } = \frac{9}{2}$
second part of the problem is to try the outer and inner boundaries. I set for inner boundary: 
$x = \frac{1}{\sqrt{3}}\cos{t}$
, $y = \frac{1}{\sqrt{3}}\sin{t}$
and outer 
$x = 2\cos{t}$
, $y = 2sin{t}$
I then create a new function: 
$h(t) = f(x, y) = f(2\cos{t}, 2\sin{t})$ differentiate and get $\sin{t} = \cos{t}$ for $ x = 0$
$f(2\frac{1}{\sqrt{2}},2\frac{1}{\sqrt{2}}) = 3\frac{2}{\sqrt{2}}\frac{2}{\sqrt{2}} + \frac{6}{1 + \left(\frac{2}{\sqrt{2}}\right)^2 + \left(\frac{2}{\sqrt{2}}\right)^2 } = \frac{36}{5}$
which actually yields the correct maximum. 
for the inner boundary I get 
$f(\frac{1}{\sqrt{3}}\frac{1}{\sqrt{2}},\frac{1}{\sqrt{3}}\frac{1}{\sqrt{2}}) = 5$
but neither 9/2 or 5 gets the correct minimum! I can't see what i'm doing wrong.
 A: The partial derivatives
$\frac{\partial f}{\partial x} = 3y - \frac{-12x}{1 + x^2 + y^2},$
and
$\frac{\partial f}{\partial y} = 3x - \frac{-12y}{1 + x^2+ y^2 }$
are wrong. One has
$\frac{\partial f}{\partial x} = 3y - \frac{-12x}{(1 + x^2 + y^2)^2}$
and
$\frac{\partial f}{\partial y} = 3x - \frac{-12y}{(1 + x^2 + y^2)^2}.$
A: This function is begging for the substitution $x=\sqrt r\cos\varphi$, $y=\sqrt r\sin\varphi$, because then you want to find the minimum or the maximum of 
$$f(r,\varphi)=3r\cos\varphi\sin\varphi+\frac{6}{1+r}=\frac{3r}2\sin(2\varphi)+\frac6{1+r}$$
where $\dfrac13\leq r\leq4$. Note that
$$\frac6{1+r}-\frac{3r}2\le\frac6{1+r}+\frac{3r}2\sin(2\varphi)\le\frac6{1+r}+\frac{3r}2$$
with equalities if $\sin(2\varphi)=-1$ or $\sin(2\varphi)=1$.
You should be able to find the minimum of $\dfrac6{1+r}-\dfrac{3r}2$ and the maximum of $\dfrac6{1+r}+\dfrac{3r}2$ easily.
This can be done with almost no computing:


*

*$\dfrac6{1+r}-\dfrac{3r}2$ is obviously decreasing, so the minimum is for $r=4$.

*$\left(\dfrac6{1+r}+\dfrac{3r}2\right)''=\dfrac{12}{(1+r)^3}>0$, so the function is convex and you only have to check value for $r=\dfrac13$ or $r=4$. The maximum is for $r=4$, because even $$\frac6{1+0}+\frac{3\cdot0}2=6<\frac6{1+4}+6=\frac6{1+4}+\frac{3\cdot4}2$$

