Is it true that $\max\limits_D |f(x)|=\max\limits\{|\max\limits_D f(x)|, |\min\limits_D f(x)|\}$? I came across an equality, which states that 

If $D\subset\mathbb{R}^n, n\geq 2$ is compact, for each $ f\in C(D)$, we have the following equality
  $$\max\limits_D |f(x)|=\max\limits\{|\max\limits_D f(x)|, |\min\limits_D f(x)|\}.$$

Actually I can not judge if it is right. Can anyone tell me if it is right, and if so, how to prove it?
Thanks a lot.

I assume that you are assuming that $\max$ and $\min$ exists or that you are assuming that $f(x)$ is continuous which in-turn guarantees that $\max$ and $\min$ exists, since $D$ is compact.
First note that if we have $a \leq y \leq b$, then $\vert y \vert \leq \max\{\vert a \vert, \vert b \vert\}$, where $a,b,y \in \mathbb{R}$. Hence, $$\min_D f(x) \leq f(x) \leq \max_D f(x) \implies \vert f(x) \vert \leq \max\{\vert \max_D f(x) \vert, \vert \min_D f(x) \vert\}, \, \forall x$$
Hence, we have that $$\max_D \vert f(x) \vert \leq \max\{\vert \max_D f(x) \vert, \vert \min_D f(x) \vert\}$$
Now we need to prove the inequality the other way around. Note that we have $$\vert f(x) \vert \leq \max_D \vert f(x) \vert$$ This implies $$-\max_D \vert f(x) \vert \leq f(x) \leq \max_D\vert f(x) \vert$$
This implies
$$-\max_D \vert f(x) \vert \leq \max_D f(x) \leq \max_D\vert f(x) \vert$$
$$-\max_D \vert f(x) \vert \leq \min_D f(x) \leq \max_D\vert f(x) \vert$$
Hence, we have that $$\vert \max_D f(x) \rvert \leq \max_D\vert f(x) \vert$$ $$\vert \min_D f(x) \rvert \leq \max_D\vert f(x) \vert$$
The above two can be put together as $$\max \{\vert \max_D f(x) \rvert, \vert \min_D f(x) \rvert \} \leq \max_D\vert f(x) \vert$$
Hence, we can now conclude that $$\max \{\vert \max_D f(x) \rvert, \vert \min_D f(x) \rvert \} = \max_D\vert f(x) \vert$$
