What is the maximum of $\ 2(a+b)-ab$ if we have: $\ a^2+b^2=8\ (a,b\ real)$ What is the maximum of $\quad 2(a+b)-ab\ $ if we have: $a^2+b^2=8 \ (a,b\ real)  $
My work is as follows:
According to AM-GM inequality:
     $$\frac{a^2+b^2}2\ge\sqrt{a^2b^2} \Rightarrow $$
     $$ab\le4 $$
On the other hand , from  $\ a^2+b^2=8\ ,\  $we have:  $\ 2(a+b)-ab=2\sqrt{8+2ab}-ab$
We can get this:  $$2\sqrt{8+2ab}\le8$$
Is it possible to somehow combine these two inequalities to find the maximum value of $\ 2(a+b)-ab$ ?
I think in this solution technique we must find the minimum value of $ab\ $ , but how???
 A: Another, easier method(without trigonometry and differentiation):
$$a^2+b^2 = (a + b)^2 - 2ab = 8 \rightarrow ab=\frac{(a + b)^2}{2} - 4$$
Substitute in your expression. Now you have to find the maximum of the following:
$$2(a + b) - \frac{(a + b)^2}{2} + 4$$Let $t = a + b$. Since $a, b$ are arbitrary reals, then $t$ is also arbitrary real.
$$f(t) = -\frac{1}{2}t^2 + 2t + 4$$
$f(t)$ is a quadratic function, since the coefficient before $t^2$ is negative, the parabola is turned downwards. Its vertex is $t_0 = -\frac{b}{2a} = 2$, hence f(t) attains maximum value when $t = 2$ and that value is $$f(2) = 6$$
A: Using differentiation: Let $f(t)=2\sqrt{8+2t}-t$, then $f'(t)=\frac{2}{\sqrt{8+2t}}-1$. Then $f(t)$ increases when $-4<t<-2$ and decreases when $-2<t<4$. Thus $f(t)$ has a maximum at $t=-2$ and $f(-2)=2\sqrt{8-4}+2=6$. Since $|ab|\le 4$, $2(a+b)-ab$ has a maximum $6$.
Alternative method: Let $a=2\sqrt{2}\cos\theta$ and $b=2\sqrt{2}\sin\theta$, then
\begin{align}
2(a+b)-ab&=-4(\cos\theta+\sin\theta)^2+4\sqrt{2}(\cos\theta+\sin\theta)+4\\
&=-4((\cos\theta+\sin\theta)^2-\sqrt{2}(\cos\theta+\sin\theta)-1)\\
&=-4\left(\left(\cos\theta+\sin\theta-\frac{1}{\sqrt{2}}\right)^2-\frac{3}{2}\right)
\end{align}
Therefore, $2(a+b)-ab$ has maximum $6$ when $\sin\theta+\cos\theta=\frac{1}{\sqrt{2}}$.
A: let $u=\sqrt{8+2ab} \implies ab=\dfrac{u^2-8}{2} \implies 2u-\dfrac{u^2-8}{2}=-\dfrac{(u-2)^2}{2}+6,|ab| \le \dfrac{a^2+b^2}{2}=4 \implies 0\le u \le 4$
