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.

Since $f$ is continuous on a compact set $D$, the minimum and maximum of $f(x)$ over $D$ exist. Suppose that the minimum is $a$ and the maximum is $b$.
There are two cases, depending on the relative size  of $|a|$ and $|b|$. 
Case 1: $|a| \le |b|$. Then $\max |f(x)|=|b|$. (Actually, the absolute value sign around $b$ is unnecessary, since if $|a|\le |b|$ then $b$ must be $\ge 0$.) 
But $|\max f(x)|=|b|$ and $|\min f(x)|=|a|$,  so $\max\{|\max f(x)|, |\min f(x)|\}=|b|$.
Case 2: $|a| \gt |b|$. This can only happen if $a$ is negative.  Then $\max|f(x)|=|a|$. But $|\max f(x)|=|b|$ and $|\min f(x)|=|a|$,  so $\max\{|\max f(x)|, |\min f(x)|\}=|a|$.
