Find the maximum value of $(x+2) \cdot (12-3x)$ , x is a Real number Question:- Find the maximum value of $(x+2) \cdot (12-3x)$. $x$ is a Real number.
The solution given in the textbook applies AM-GM to solve this
$$3 \cdot (x+2) \cdot (4-x)$$
Now, $x+2 = a$ and $4-x = b$
$a+b=6$
Objective to maximize $3 \cdot a \cdot b$
by AM-GM inequality,
$$\frac{a+b}{2} \geq \sqrt{ab}$$
$$a \cdot b \leq 9$$
Therefore $3 \cdot a \cdot b \leq 27$
But is the solution correct? as we know that while applying AM-GM, the terms should be positive real but $a$ and $b$ are not positive for every $x$ as Real number , if I am correct the range of $(-\infty,-2)$ to $(4, \infty)$ should be given for $a$ and $b$ to be both positive and then apply AM-GM, please suggest if some other way is possible too to solve this.

Technically, as you mentioned, you cannot directly use AM-GM in this case. But we can just use the inequality $$(a+b)^2 \geq 4ab$$ instead. This inequality holds for any real numbers $a$ and $b$, since
\begin{align*}
(a+b)^2 &= a^2 + 2ab + b^2 \\
&= (a^2 - 2ab + b^2) + 4ab \\
&= (a-b)^2 + 4ab \\
&\geq 0 + 4ab \\
&= 4ab.
\end{align*}
