<s>[INST] 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???
 [/INST] 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$
</s>