Definite integral of terms $\int _{\frac{-\pi}2}^{\frac{\pi}2} [2\sin |x| + \cos |x|] dx $
As this integral contains greatest integer function and magnitude function. So I have no clue to how to solve.
Any hint is appreciated. Thank you.
 A: Since $|x|$ changes sign at $x = 0$, split the integral into two parts. $|x| = -x$ for $x <0$ and $|x| + x$ for $x \geq 0$.
For $a < 0, b > 0$
$$\int_a^b f(|x|) = \int_a^0 f(-x) + \int_0^b f(x)$$
Then use properties of sine and cosine to simplify further.
A: Let $\varphi(x)=[2\sin |x| + \cos |x|]$. 
As  $\varphi(-x)= \varphi(x)$, $\varphi$ is an even function. Thus the integral to be computed is
$$\tag{0}2\int_{0}^{\frac{\pi}{2}} [2\sin |x| + \cos |x|] =2\int_{0}^{\frac{\pi}{2}}  [f(x)] dx$$
with $f(x):=2\sin(x) + \cos(x).$
It is very important to situate the abscissa of the jump. To have a clear idea of it, one needs to plot the curves of $y=f(x)$.  See figure below (where the other part of the curve of $y=\varphi(x)$ is represented as well).
let:
$$x_0=2 \tan^{-1}(1/3)\approx 0.6435. \ \ \text{(Explanation at the bottom)}$$
For $0<x<x_0$, $[f(x)]=2.$
For $x>x_0$, $[f(x)]=3.$ 
Thus, using (0), the result is obtained by computing the area of 2 rectangles:
$$2(2 x_0+3(\dfrac{\pi}{2}-x_0))=3 \pi-2x_0=3\pi-4 \tan^{-1}(1/3)$$

Explanation of the result in (1): We have to find the solutions of 
$$\tag{2}2\sin(x)+cos(x)=2.$$
Using Weierstrass substitution formulas (https://en.wikipedia.org/wiki/Tangent_half-angle_substitution), (2) is equivalent to:
$$\tag{3}2\dfrac{2t}{1+t^2}+\dfrac{1-t^2}{1+t^2}=2.$$
whence quadratic equation $3t^2-4t+1=0$ with solutions $t=1$ corresponding to $\pi/2$ and $t=1/3$. Thus, as $t=tan(x/2)$, $x_0=2 \tan^{-1}(1/3)$.
