<s>[INST] Maximum value of a variable from a system of 2 equations From the following $2$ equations, find the maximum value of $d$.
$a + b + c + d = 8$  and $ab + ac + ad + bc + bd + cd = 12$
How to go about with this problem?
Please help.
Thankyou.
 [/INST] Without loss of generality we can assume
$a = p + q$, $b = p - q$, with $q > 0$.
The first equation is simplified as
(1)
$$
c + d = 8 - 2 \, p.
$$
Similarly, for the second equation, we have
\begin{align}
12 & = c d + (a + b)(c+ d) + a b \\
   & = c d + 2\,p (c + d) + p^2 - q^2, \\
   & = c d + 2\,p (8 - 2p) + p^2 - q^2 \\
   & = c d + 16\,p - 3\,p^2 - q^2,
\end{align}
where we have used (1) on the third line.
Thus,
\begin{align}
c + d &= 8 - 2 \, p, \\
cd &= 12 -16 \, p + 3 \, p^2 + q^2
\end{align}
This means that $c$ and $d$ are the roots of the quadratic equation,
$$
x^2 - (8 - 2 \, p) \, x + 12 - 16 \, p + 3 \, p^2 +q^2 = 0.
$$
In other words,
\begin{align}
c &= 4 - p - \sqrt{4 + 16 \, p - 2 \, p^2 - q^2} \\
d &= 4 - p + \sqrt{4 + 16 \, p - 2 \, p^2 - q^2},
\end{align}
where we have assumed that $d$ gets the plus sign, because we want to maximize $d$.
Now the expression is $d$ obviously maximized with $q = 0$, so let us assume that,
\begin{align}
d &= 4 - p + \sqrt{4 + 16 \, p - 2 \, p^2} \\
  &= (4 - p) + \sqrt{36 - 2 \, (4-p)^2}
\end{align}
Finally, let us ask for what value of $p$, $d$ is maximized?
For this, let us replace $4 - p = 3 \, \sqrt{2} \, \sin t$, then we have
\begin{align}
d &= 3 \sqrt{2} \, \left( \sin t + \sqrt{2} \cos t \right) \\
  &= 3 \sqrt{2} \, \sqrt{3} \, \left(\sqrt{\frac 1 3} \sin t + \sqrt{\frac 2 3} \cos t \right) \\
  &= 3 \sqrt{6} \, \sin\left(t + \tan^{-1}\sqrt2 \right) \\
  &\le 3 \sqrt{6}.
\end{align}
</s>