Question: let $f$ be function defined on some domain $D$ and let $J\subseteq D$ then is $$\max_\limits {x\in J}|f(x)|=\max(|\max_\limits {x\in J}f(x)|, |\min_\limits {x\in J}f(x)|)$$
When I consider continuous functions like $\sin\ t$ and $\cos\ t$ and $J$ to be compact subset of $\mathbb{R}$ then I saw above holds. Is the above formula holds in general? I am not able find to find the counter examples. Please help..
Further how to find maximum and minimum values of absolute value function (can we apply second derivative test? But, absolute value function like $|f(x)|$ is not differentiable at points where $f(x)=0$).