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

  • $\begingroup$ Maybe the plot of the integrand will help. WA $\endgroup$
    – Kaster
    Feb 13, 2017 at 17:43
  • $\begingroup$ I know that but I want to know steps. As WA not shows any steps. $\endgroup$
    – Amar
    Feb 13, 2017 at 17:45
  • $\begingroup$ Do you where value changes from 1 to 2 for inner expression $\endgroup$ Feb 13, 2017 at 18:03
  • $\begingroup$ @Archis Welankar please help me to solve this. $\endgroup$
    – Amar
    Feb 13, 2017 at 18:41
  • $\begingroup$ The first step is to break the interval of integration into the two parts, $[-\pi/2,0] \cup [0,\pi/2]$. You will then find the integrand simplifies in each part (and indeed, the two parts are symmetric). $\endgroup$
    – hardmath
    Feb 14, 2017 at 1:30

2 Answers 2


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.

  • $\begingroup$ What about greatest integer function? $\endgroup$
    – Amar
    Feb 13, 2017 at 18:40

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


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

enter image description here

Explanation of the result in (1): We have to find the solutions of


Using Weierstrass substitution formulas (https://en.wikipedia.org/wiki/Tangent_half-angle_substitution), (2) is equivalent to:


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

  • $\begingroup$ Why not to use the fact that the function is even . $\endgroup$ Feb 13, 2017 at 19:21
  • $\begingroup$ In fact, I was just modifiying my answer in order to take this fact into account from the beginning:) $\endgroup$
    – Jean Marie
    Feb 13, 2017 at 19:29
  • 1
    $\begingroup$ @Amar I see you have asked 9 questions today and yesterday, and today especialy you have asked 4 questions in a few hours. Consider it is too much. It is not the way you will progress in mathematics. Moreover, you have been helped a lot. Answer to our questions by "please help me" is definitely not an adult attitude. You should react to the answers that are provided to you and say, "I don't understand" this, or, at the opposite, "This answer is convenient" (in this case, it has to be validated). You must have a dialog with us. Math S.E. is not a "quick serve" "(not)pay and carry"... $\endgroup$
    – Jean Marie
    Feb 13, 2017 at 20:30
  • $\begingroup$ Can you please provide solution without graphically. $\endgroup$
    – Amar
    Feb 15, 2017 at 2:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.