# Maximum and minimum value of absolute value function.

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$$).

$$\square$$ If the function always takes non-negative values only then $$\max_{x\in J}|f(x)| = \max(|\max_{x\in J}f(x)|, |\min_{x\in J}f(x)|),$$ because left-hand side and the right-hand side are trivially equal.
Now, suppose if the function takes negative values for certain values of $$x$$ in its domain. Then it may so happen that the modulus of the minimum negative value may exceed the maximum of those positive values; hence we must have $$\max_{x\in J}|f(x)| =\max(|\max_{x\in J}f(x)|, |\min_{x\in J}f(x)|).$$
$$\square$$ For addressing your second query, if $$|f(x)|$$ is not differentiable in only a finite number of points, then by differentiating the function on the other intervals (where the function is in fact differentiable) gives you an idea how the function behaves. Lastly you can find the maximum and minimum values of $$|f|$$ by comparing the maximum and minimum values of the function on the differentiable region and the values of the function at the points where it is not differentiable.