Counterexample in A.M.-G.M. inequality. TL;DR:
Why does A.M.-G.M. inequality not give desired result for $x^4+\frac{1}{x^2}$, in the form $x^4+\frac{1}{x^2}\ge 2\sqrt{x^2}$ but $2^{\sin x} + 2^{\cos x}$ does?

My confusion about the application of this inequality keeps on increasing. First, the things I believe are true:

*

*For the equality to hold, each term must be equal.

*To get the actual absolute extrema, there should be a constant value on other side. (Because otherwise it will keep changing?)

And that's why, this inequality does not work for $x^4+\frac{1}{x^2}$ in the form $$x^4+\frac{1}{x^2}\ge 2\sqrt{x^2}$$
Though, both terms are equal at $x=1$ but since there's not a constant value on RHS, we don't get desired result.
Here's the question I encountered in my yesterday's exam:

Find the minimum value of $2^{\sin x} + 2^{\cos x}$

I found that in this case there is not going to be a constant term in any case. Hence, A.M.-G.M. inequality is not useful here. So I just left question assuming it is out of my league.
However, later my classmate showed me that the minimum value will be $2^{1-\frac{1}{\sqrt{2}}}$ using A.M.-G.M. inequality.

$2^{\sin x}+2^{\cos x}\ge 2\cdot 2^{\frac12({\sin x +\cos x})}$   For minima, $\sin x +\cos x =-\sqrt2$

I pointed out that there should be a constant value. He then showed me the graph of the function on desmos and the minimum value is actually the absolute minima!
My question is,
Why does A.M.-G.M. inequality not give desired result for $x^4+\frac{1}{x^2}$, in the form $x^4+\frac{1}{x^2}\ge 2\sqrt{x^2}$ but $2^{\sin x} + 2^{\cos x}$ does?
Is this application of A.M.-G.M. inequality mere pure coincidence? (I'm not asking the condition for quality to hold).
If yes, then how do we know which ones are suitable and which ones are not?
If not, then how do we find the absolute extrema?

And, I was thinking it has something to do with minimum of  $\sqrt{x^2}$ not being in domain of $x^4+\frac{1}{x^2}$. So I checked for $(x^2+x+1)^2+\frac{1}{(x^2+x+1}$ which verifies that my suspicion was wrong.
 A: This is a very good question. Although it is not a counterexample to the AM-GM inequality, it is rather a counterexample to the "constant-value" rule of thumb that you stated.
To tackle this, let's consider exactly why you are taught this rule. Suppose we have an expression $f(x) + g(x)$. Then by AM-GM we get $$f(x) + g(x) \ge 2\sqrt{f(x)g(x)}.$$ This is always true if $f(x), g(x) \ge 0$. There is no counterexample to it. However, the RHS may involve $x$, so for example $2^{\sin x} + 2^{\cos x} \ge 2\times2^{\sin x + \cos x}$.
Now, you want to find the minimum of the expression, so a mere inequality doesn't do: you need an inequality such that one side is a constant value. And that's why you are taught that rule. But, as a rule of thumbs, you can't trust it in every case. So let's examine closely why your classmate is right.
$${2^{\sin x} + 2^{\cos x} \ge 2\times2^{\sin x + \cos x} \ge 2\times 2^{-\sqrt{2}/2}}$$
Each inequality holds, so indeed you have $2^{\sin x} + 2^{\cos x} \ge 2^{1-\sqrt{2}/2}.$ What about the other example? $$x^4 + \frac1{x^2} \ge 2|x| \ge 0$$
Each inequality holds, so indeed you have $x^4 + \frac1{x^2}\ge 0$. This inequality is correct! The only thing is that it is not the minimum. And why is that? Let's review the condition for the equality to hold. For the first inequality, it holds when $x^4 = \frac1{x^2}$, i.e. when $x=\pm1$. while for the second inequality, it holds when $2|x|=0$, i.e. when $x=0$. A mismatch! This means that the equality for $x^4+\frac1{x^2} \ge 0$ will never hold, since it requires $x=\pm1$ and $x=0$, at the same time!
Now let's turn to $2^{\sin x} + 2^{\cos x}$. The first equality holds when $2^{\sin x} = 2^{\cos x}$, i.e. when $\sin x = \cos x = \pm\frac{\sqrt 2}2$. The second equality holds when $\sin x = \cos x = -\frac{\sqrt2}2$. So the overall equality for $2^{\sin x} + 2^{\cos x} \ge 2^{1-\sqrt2/2}$ can be made to hold, when we take $x = -\frac{3\pi} 4$, for example.
To conclude, if you want to use multiple inequalities to obtain some minimum (in this case, first AM-GM then an inequality for trig functions), you must ensure that all the equalities can hold simultaneously. And that's a more general version of your rule of thumb (your version essentially says that you should only use one inequality when calculating minima, and this of course ensures that the equality can hold simultaneously -- there is just one equality in consideration!).
Edit: the exercise may be a bit inappropriate, deleted.
