Number of integral values of $x\in (\frac{\pi}{2},5\frac{\pi}{2})$ such that $\max(x^2+\cos x-1,1-x^2-\cos x)=\max(\cos x+x^2-1,x^2-1-\cos x)$ The number of integral values of $x\in(\frac{\pi}{2},5\frac{\pi}{2})$ such that
$$\max(x^2+\cos x-1,1-x^2-\cos x)=\max(\cos x+x^2-1,x^2-1-\cos x)$$ is satisfied is... ?
I understand that $\max(x,-x)=|x|$ but I could not simplify the right hand side of the equation.Please help me in this regard. Thanks.
 A: For $x\in (\frac{\pi}{2},\frac{5}{2}\pi)$, we have that
$$\begin{align}(x^2+\cos x-1)-(1-x^2-\cos x)&=2(x^2+\cos x-1)\\\\&\ge 2(x^2-2)\\\\&\gt 2\left(\left(\frac{\pi}{2}\right)^2-2\right)\\\\&=\frac{1}{2}(\pi^2-8)\\\\&\gt 0\end{align}$$
and that
$$(\cos x+x^2-1)-(x^2-1-\cos x)=2\cos x\begin{cases}
\lt 0 & \text{if}\ x\in (\frac{\pi}{2},\frac{3}{2}\pi)\\[2ex]
\ge 0  & \text{if}\ x\in[\frac{3}{2}\pi,\frac{5}{2}\pi) 
\end{cases}
$$
For $x\in (\frac{\pi}{2},\frac{3}{2}\pi)$, the equation can be written as
$$x^2+\cos x-1=x^2-1-\cos x,$$
i.e.
$$\cos x=0$$
which does not hold.
For $x\in[\frac{3}{2}\pi,\frac{5}{2}\pi)$, the equation can be written as
$$x^2+\cos x-1=\cos x+x^2-1$$
which always holds.
Therefore, the answer is $\color{red}{3}$. ($x=5,6,7$)
A: two possibilities. if the first part of LHS is greater then, the values of $x$ for which $cos(x)\,> -cos(x)$ are solutions. that is $5\,,\,6$.
 second possibility is second part of LHS and RHS are equal and greater than first part. there are two values for which second parts of max functions are equal and none of them are in the interval. hence there are only two values of x in the given interval which satisfy the equation namely, $5\,,\,6$. by  first part and second part I mean first  and second inputs to max function respectively.
