Problem 12 at Section 5.3 in Bartle and Sherbert's books on Real Analysis Consider the function $f(x) = \sup\{x^2, \cos x\}$, $x \in [0, \tfrac{\pi}{2}]$. Show that there exists a point $x_0 \in [0, \tfrac{\pi}{2}]$ such that $f(x_0) = \min_{x \in [0, \tfrac{\pi}{2}]} f(x)$. Also show that $\cos x_0 = x_0^2$. 
The first part is obvious due to continuity of $f$ in $[0, \tfrac{\pi}{2}]$. Second part is also obvious from the graph of $f$. But how to mathematically prove that $\cos x_0 = x_0^2$?
I was trying to show it using the expression of $f$ $f(x) = \tfrac{1}{2}\{x^2 + \cos x + |x^2 - \cos x|\}$. Can anybody please help me out? 
 A: Consider an $x_*\in\bigl[0,{\pi\over2}\bigr]$. If $\cos x_*>x_*^2$ then (a) $x_*\ne{\pi\over2}$, and (b) $f(x)=\cos x$ in a full neighborhood of $x_*$. As $\cos$ is strictly decreasing in $\bigl[0,{\pi\over2}\bigr]$ there are points $x$ immediately to the right of $x_*$ where $f(x)<f(x_*)$. In a similar way one argues when $\cos x_*<x_*^2$. In this case $x_*\ne0$, and there are points $x$ immediately to the left of $x_*$ where $f(x)<f(x_*)$.
This allows to conclude that at the point $x_0$ where $f$ is minimal one necessarily has $\cos x_0=x_0^2$.
Note that we have used the monotonicity of $\cos$ and the square function in the given interval. Without this assumption it would be easy to give counterexamples.
A: By the Location of Roots Theorem, we know that there is some $c\in(0,\pi/2)$ such that $f(c)=0$. So we claim that $x_o=c$. Let's prove this by contradiction. Suppose that $x_o\neq c$. Notice first that $x_o, c\in I$ and in fact $x_o,c\in (0,\pi/2)$. Case 1: $a<x_o<c<b$. Then $x_o^2<c^2=\cos(c)<\cos (x_o)$ because $x^2$ is increasing and $\cos(x)$ is decreasing on the given interval. This implies that $f(x_o)=\cos(x_o)$. Since we proved that there is an absolute minimum at $c$, then it should be that $f(x_o)=\cos(x_o)\leq \cos(c)=f(c)$, which is a contradiction. Case 2: $a<c<x_o<b$. Then $\cos(x_o)<\cos(c)=c^2<x_o$ because $x^2$ is increasing and $\cos(x)$ is decreasing on the given interval. Since we proved that there is an absolute minimum at $c$, then it should be that $f(x_o)=x_o^2\leq c^2=f(c)$, which is a contradiction. Thus, $c=x_o$.
A: If not, then let $cos\ x_0 >(x_o)^2$. Then by the definition of $f$, $f(x_0)=cos\ x_0\implies\ cos\ x_0$ is the minimum value when $x\in [0,\frac \pi2]$, which is a contradiction to the fact that $cos\ x_0>(x_0)^2$ as it turns out to be the minimum value. Similarly if $(x_0)^2 > cos\ x_o$ then again we have a contradiction.
